-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support additional_emails field on Customer
- Loading branch information
1 parent
1928b7f
commit 07b687e
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,6 +145,8 @@ async fn test_customers() { | |
assert_eq!(customer.billing_address, None); | ||
assert_eq!(customer.shipping_address, None); | ||
assert_eq!(customer.tax_id, None); | ||
let empty_emails: Vec<String> = vec![]; | ||
assert_eq!(customer.additional_emails, empty_emails); | ||
|
||
// Test fetching the customer by ID. | ||
let customer = client.get_customer(&customer.id).await.unwrap(); | ||
|
@@ -242,6 +244,37 @@ async fn test_customers() { | |
assert_eq!(customer.email, "[email protected]"); | ||
let customer = client.get_customer(&customer.id).await.unwrap(); | ||
assert_eq!(customer.email, "[email protected]"); | ||
let empty_emails: Vec<String> = vec![]; | ||
assert_eq!(customer.additional_emails, empty_emails); | ||
|
||
// Test updating additional_emails by ID | ||
let customer = client | ||
.update_customer( | ||
&customer.id, | ||
&UpdateCustomerRequest { | ||
additional_emails: Some(vec![ | ||
"[email protected]", | ||
"[email protected]", | ||
]), | ||
..Default::default() | ||
}, | ||
) | ||
.await | ||
.unwrap(); | ||
assert!(customer | ||
.additional_emails | ||
.contains(&"[email protected]".to_string())); | ||
assert!(customer | ||
.additional_emails | ||
.contains(&"[email protected]".to_string())); | ||
let customer = client.get_customer(&customer.id).await.unwrap(); | ||
assert!(customer | ||
.additional_emails | ||
.contains(&"[email protected]".to_string())); | ||
assert!(customer | ||
.additional_emails | ||
.contains(&"[email protected]".to_string())); | ||
assert_eq!(customer.email, "[email protected]"); | ||
|
||
// Test updating the customer by external ID. | ||
let customer = client | ||
|