Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/dnsimple/domains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ pub struct Domain {
pub auto_renew: bool,
/// Set to true if the domain is WHOIS protected
pub private_whois: bool,
/// True if the trustee service is enabled for the domain.
/// True if the trustee is enabled for the domain.
#[serde(default)]
pub trustee_service: bool,
pub trustee: bool,
/// The day the domain will expire
pub expires_on: Option<String>,
/// The exact expiration time of the domain
Expand Down
24 changes: 12 additions & 12 deletions src/dnsimple/registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pub struct DomainPrice {
pub renewal_price: f32,
/// The price for transfer
pub transfer_price: f32,
/// The trustee service price (if supported by the TLD).
pub trustee_service_price: Option<f32>,
/// The trustee price (if supported by the TLD).
pub trustee_price: Option<f32>,
}

/// The payload to register a domain
Expand All @@ -39,9 +39,9 @@ pub struct DomainRegistrationPayload {
/// True if the domain WHOIS privacy was requested.
#[serde(skip_serializing_if = "Option::is_none")]
pub whois_privacy: Option<bool>,
/// True if the trustee service was requested.
/// True if trustee was requested for registration.
#[serde(skip_serializing_if = "Option::is_none")]
pub trustee_service: Option<bool>,
pub trustee: Option<bool>,
/// True if the domain auto-renew was requested.
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_renew: Option<bool>,
Expand Down Expand Up @@ -70,8 +70,8 @@ pub struct DomainRegistration {
pub auto_renew: bool,
/// True if the domain WHOIS privacy was requested.
pub whois_privacy: bool,
/// True if the trustee service was enabled for the domain.
pub trustee_service: bool,
/// True if the trustee is enabled for the domain.
pub trustee: bool,
/// When the domain renewal was created in DNSimple.
pub created_at: String,
/// When the domain renewal was last updated in DNSimple.
Expand All @@ -88,9 +88,9 @@ pub struct DomainTransferPayload {
/// True if the domain WHOIS privacy was requested.
#[serde(skip_serializing_if = "Option::is_none")]
pub whois_privacy: Option<bool>,
/// True if the trustee service was requested.
/// True if trustee was requested for transfer.
#[serde(skip_serializing_if = "Option::is_none")]
pub trustee_service: Option<bool>,
pub trustee: Option<bool>,
/// True if the domain auto-renew was requested.
#[serde(skip_serializing_if = "Option::is_none")]
pub auto_renew: Option<bool>,
Expand All @@ -117,8 +117,8 @@ pub struct DomainTransfer {
pub auto_renew: bool,
/// True if the domain WHOIS privacy was requested.
pub whois_privacy: bool,
/// True if the trustee service was enabled for the domain.
pub trustee_service: bool,
/// True if the trustee is enabled for the domain.
pub trustee: bool,
/// The reason if transfer failed.
pub status_description: Option<String>,
/// When the domain renewal was created in DNSimple.
Expand Down Expand Up @@ -329,7 +329,7 @@ impl Registrar<'_> {
/// let payload = DomainRegistrationPayload {
/// registrant_id: 42,
/// whois_privacy: None,
/// trustee_service: None,
/// trustee: None,
/// auto_renew: None,
/// extended_attributes: None,
/// premium_price: None,
Expand Down Expand Up @@ -378,7 +378,7 @@ impl Registrar<'_> {
/// registrant_id: 42,
/// auth_code: "Some code".to_string(),
/// whois_privacy: None,
/// trustee_service: None,
/// trustee: None,
/// auto_renew: None,
/// extended_attributes: None,
/// premium_price: None,
Expand Down
2 changes: 1 addition & 1 deletion tests/domains_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ async fn test_get_domain() {
assert_eq!("registered", domain.state);
assert!(!domain.auto_renew);
assert!(!domain.private_whois);
assert!(!domain.trustee_service);
assert!(!domain.trustee);
assert_eq!("2021-06-05", domain.expires_on.unwrap());
assert_eq!("2021-06-05T02:15:00Z", domain.expires_at.unwrap());
assert_eq!("2020-06-04T19:15:14Z", domain.created_at);
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/cancelDomainTransfer/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ x-xss-protection: 1; mode=block
x-download-options: noopen
x-permitted-cross-domain-policies: none

{"data":{"id":361,"domain_id":182245,"registrant_id":2715,"state":"transferring","auto_renew":false,"whois_privacy":false,"trustee_service":false,"status_description":null,"created_at":"2020-06-05T18:08:00Z","updated_at":"2020-06-05T18:08:04Z"}}
{"data":{"id":361,"domain_id":182245,"registrant_id":2715,"state":"transferring","auto_renew":false,"whois_privacy":false,"trustee":false,"status_description":null,"created_at":"2020-06-05T18:08:00Z","updated_at":"2020-06-05T18:08:04Z"}}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/getDomain/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ x-download-options: noopen
x-permitted-cross-domain-policies: none
strict-transport-security: max-age=31536000

{"data":{"id":181984,"account_id":1385,"registrant_id":2715,"name":"example-alpha.com","unicode_name":"example-alpha.com","state":"registered","auto_renew":false,"private_whois":false,"trustee_service":false,"expires_on":"2021-06-05","expires_at":"2021-06-05T02:15:00Z","created_at":"2020-06-04T19:15:14Z","updated_at":"2020-06-04T19:15:21Z"}}
{"data":{"id":181984,"account_id":1385,"registrant_id":2715,"name":"example-alpha.com","unicode_name":"example-alpha.com","state":"registered","auto_renew":false,"private_whois":false,"trustee":false,"expires_on":"2021-06-05","expires_at":"2021-06-05T02:15:00Z","created_at":"2020-06-04T19:15:14Z","updated_at":"2020-06-04T19:15:21Z"}}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/getDomainPrices/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ x-permitted-cross-domain-policies: none
content-security-policy: frame-ancestors 'none'
strict-transport-security: max-age=31536000

{"data":{"domain":"bingo.pizza","premium":true,"registration_price":20.0,"renewal_price":20.0,"transfer_price":20.0,"restore_price":20.0,"trustee_service_price":20.0}}
{"data":{"domain":"bingo.pizza","premium":true,"registration_price":20.0,"renewal_price":20.0,"transfer_price":20.0,"restore_price":20.0,"trustee_price":20.0}}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/getDomainRegistration/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ x-download-options: noopen
x-permitted-cross-domain-policies: none
strict-transport-security: max-age=31536000

{"data":{"id":361,"domain_id":104040,"registrant_id":2715,"period":1,"state":"registering","auto_renew":false,"whois_privacy":false,"trustee_service":false,"created_at":"2023-01-27T17:44:32Z","updated_at":"2023-01-27T17:44:40Z"}}
{"data":{"id":361,"domain_id":104040,"registrant_id":2715,"period":1,"state":"registering","auto_renew":false,"whois_privacy":false,"trustee":false,"created_at":"2023-01-27T17:44:32Z","updated_at":"2023-01-27T17:44:40Z"}}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/getDomainTransfer/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ x-download-options: noopen
x-permitted-cross-domain-policies: none
strict-transport-security: max-age=31536000

{"data":{"id":361,"domain_id":182245,"registrant_id":2715,"state":"cancelled","auto_renew":false,"whois_privacy":false,"trustee_service":false,"status_description":"Canceled by customer","created_at":"2020-06-05T18:08:00Z","updated_at":"2020-06-05T18:10:01Z"}}
{"data":{"id":361,"domain_id":182245,"registrant_id":2715,"state":"cancelled","auto_renew":false,"whois_privacy":false,"trustee":false,"status_description":"Canceled by customer","created_at":"2020-06-05T18:08:00Z","updated_at":"2020-06-05T18:10:01Z"}}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/listCharges/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ cache-control: no-store, must-revalidate, private, max-age=0
x-request-id: a57a87c8-626a-4361-9fb8-b55ca9be8e5d
x-runtime: 0.060526

{"data":[{"invoiced_at":"2023-08-17T05:53:36Z","total_amount":"14.50","balance_amount":"0.00","reference":"1-2","state":"collected","items":[{"description":"Register bubble-registered.com","amount":"14.50","product_id":1,"product_type":"domain-registration","product_reference":"bubble-registered.com"}]},{"invoiced_at":"2023-08-17T05:57:53Z","total_amount":"14.50","balance_amount":"0.00","reference":"2-2","state":"refunded","items":[{"description":"Register example.com","amount":"14.50","product_id":2,"product_type":"domain-registration","product_reference":"example.com"}]},{"invoiced_at":"2023-10-24T07:49:05Z","total_amount":"1099999.99","balance_amount":"0.00","reference":"4-2","state":"collected","items":[{"description":"Test Line Item 1","amount":"99999.99","product_id":null,"product_type":"manual","product_reference":null},{"description":"Test Line Item 2","amount":"1000000.00","product_id":null,"product_type":"manual","product_reference":null}]},{"invoiced_at":"2023-10-24T09:00:00Z","total_amount":"20.00","balance_amount":"0.00","reference":"5-2","state":"collected","items":[{"description":"Purchase Certificate www.bubble-registered.com","amount":"20.00","product_id":42,"product_type":"certificate-purchase","product_reference":"42"}]}],"pagination":{"current_page":1,"per_page":30,"total_entries":4,"total_pages":1}}
{"data":[{"invoiced_at":"2023-08-17T05:53:36Z","total_amount":"14.50","balance_amount":"0.00","reference":"1-2","state":"collected","items":[{"description":"Register bubble-registered.com","amount":"14.50","product_id":1,"product_type":"domain-registration","product_reference":"bubble-registered.com"}]},{"invoiced_at":"2023-08-17T05:57:53Z","total_amount":"14.50","balance_amount":"0.00","reference":"2-2","state":"refunded","items":[{"description":"Register example.com","amount":"14.50","product_id":2,"product_type":"domain-registration","product_reference":"example.com"}]},{"invoiced_at":"2023-10-24T07:49:05Z","total_amount":"1099999.99","balance_amount":"0.00","reference":"4-2","state":"collected","items":[{"description":"Test Line Item 1","amount":"99999.99","product_id":null,"product_type":"manual","product_reference":null},{"description":"Test Line Item 2","amount":"1000000.00","product_id":null,"product_type":"manual","product_reference":null}]},{"invoiced_at":"2023-10-24T09:00:00Z","total_amount":"20.00","balance_amount":"0.00","reference":"5-2","state":"collected","items":[{"description":"Purchase Certificate www.bubble-registered.com","amount":"20.00","product_id":42,"product_type":"certificate-purchase","product_reference":"42"}]}],"pagination":{"current_page":1,"per_page":30,"total_entries":4,"total_pages":1}}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/registerDomain/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000

{"data":{"id":1,"domain_id":999,"registrant_id":2,"period":1,"state":"new","auto_renew":false,"whois_privacy":false,"trustee_service":false,"created_at":"2016-12-09T19:35:31Z","updated_at":"2016-12-09T19:35:31Z"}}
{"data":{"id":1,"domain_id":999,"registrant_id":2,"period":1,"state":"new","auto_renew":false,"whois_privacy":false,"trustee":false,"created_at":"2016-12-09T19:35:31Z","updated_at":"2016-12-09T19:35:31Z"}}
2 changes: 1 addition & 1 deletion tests/fixtures/v2/api/transferDomain/success.http
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ x-permitted-cross-domain-policies: none
x-xss-protection: 1; mode=block
strict-transport-security: max-age=31536000

{"data":{"id":1,"domain_id":999,"registrant_id":2,"state":"transferring","auto_renew":false,"whois_privacy":false,"trustee_service":false,"created_at":"2016-12-09T19:43:41Z","updated_at":"2016-12-09T19:43:43Z"}}
{"data":{"id":1,"domain_id":999,"registrant_id":2,"state":"transferring","auto_renew":false,"whois_privacy":false,"trustee":false,"created_at":"2016-12-09T19:43:41Z","updated_at":"2016-12-09T19:43:43Z"}}
22 changes: 11 additions & 11 deletions tests/registrar_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ async fn test_get_domain_prices() {
assert_eq!(20.0, domain_prices.registration_price);
assert_eq!(20.0, domain_prices.renewal_price);
assert_eq!(20.0, domain_prices.transfer_price);
if let Some(trustee_service_price) = domain_prices.trustee_service_price {
assert_eq!(20.0, trustee_service_price);
if let Some(trustee_price) = domain_prices.trustee_price {
assert_eq!(20.0, trustee_price);
}
}

Expand Down Expand Up @@ -105,7 +105,7 @@ async fn test_get_domain_registration() {
assert_eq!(domain_registration.state, "registering");
assert!(!domain_registration.auto_renew);
assert!(!domain_registration.whois_privacy);
assert!(!domain_registration.trustee_service);
assert!(!domain_registration.trustee);
assert_eq!(domain_registration.created_at, "2023-01-27T17:44:32Z");
assert_eq!(domain_registration.updated_at, "2023-01-27T17:44:40Z");
}
Expand Down Expand Up @@ -152,7 +152,7 @@ async fn test_register_domain() {
let payload = DomainRegistrationPayload {
registrant_id: 2,
whois_privacy: None,
trustee_service: None,
trustee: None,
auto_renew: None,
extended_attributes: None,
premium_price: None,
Expand All @@ -172,7 +172,7 @@ async fn test_register_domain() {
assert_eq!("new", domain_registration.state);
assert!(!domain_registration.auto_renew);
assert!(!domain_registration.whois_privacy);
assert!(!domain_registration.trustee_service);
assert!(!domain_registration.trustee);
assert_eq!("2016-12-09T19:35:31Z", domain_registration.created_at);
assert_eq!("2016-12-09T19:35:31Z", domain_registration.updated_at);
}
Expand All @@ -192,7 +192,7 @@ async fn test_transfer_domain() {
registrant_id: 2,
auth_code: String::from("THE_AUTH_CODE"),
whois_privacy: None,
trustee_service: None,
trustee: None,
auto_renew: None,
extended_attributes: None,
premium_price: None,
Expand All @@ -211,7 +211,7 @@ async fn test_transfer_domain() {
assert_eq!("transferring", domain_transfer.state);
assert!(!domain_transfer.auto_renew);
assert!(!domain_transfer.whois_privacy);
assert!(!domain_transfer.trustee_service);
assert!(!domain_transfer.trustee);
assert_eq!("2016-12-09T19:43:41Z", domain_transfer.created_at);
assert_eq!("2016-12-09T19:43:43Z", domain_transfer.updated_at);
}
Expand All @@ -231,7 +231,7 @@ async fn test_transfer_domain_error_in_dnsimple() {
registrant_id: 2,
auth_code: String::from("THE_AUTH_CODE"),
whois_privacy: None,
trustee_service: None,
trustee: None,
auto_renew: None,
extended_attributes: None,
premium_price: None,
Expand Down Expand Up @@ -264,7 +264,7 @@ async fn test_transfer_domain_error_missing_auth_code() {
registrant_id: 2,
auth_code: String::from(""),
whois_privacy: None,
trustee_service: None,
trustee: None,
auto_renew: None,
extended_attributes: None,
premium_price: None,
Expand Down Expand Up @@ -305,7 +305,7 @@ async fn test_retrieve_domain_transfer() {
assert_eq!("cancelled", transfer.state);
assert!(!transfer.auto_renew);
assert!(!transfer.whois_privacy);
assert!(!transfer.trustee_service);
assert!(!transfer.trustee);
assert_eq!("Canceled by customer", transfer.status_description.unwrap());
assert_eq!("2020-06-05T18:08:00Z", transfer.created_at);
assert_eq!("2020-06-05T18:10:01Z", transfer.updated_at);
Expand Down Expand Up @@ -340,7 +340,7 @@ async fn test_cancel_domain_transfer() {
assert_eq!("transferring", transfer.state);
assert!(!transfer.auto_renew);
assert!(!transfer.whois_privacy);
assert!(!transfer.trustee_service);
assert!(!transfer.trustee);
assert_eq!(None, transfer.status_description);
assert_eq!("2020-06-05T18:08:00Z", transfer.created_at);
assert_eq!("2020-06-05T18:08:04Z", transfer.updated_at);
Expand Down