-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[sc-62679] SDK Unmerge Support - Golang (#72)
* Add support for unmerge endpoint. * Remove duplicate code.
- Loading branch information
1 parent
b3e4ad6
commit 9877974
Showing
5 changed files
with
50 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
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 |
---|---|---|
|
@@ -40,6 +40,8 @@ func TestListCustomersIntegration(t *testing.T) { | |
|
||
validateListCustomers(api, ds.UUID, t) | ||
validateSearchCustomers(api, "[email protected]", t) | ||
validateMergeCustomers(api, t) | ||
validateUnmergeCustomers(api, t) | ||
validateCustomerRetrievalAndUpdate(api, customers[1], t) | ||
} | ||
|
||
|
@@ -113,6 +115,30 @@ func validateSearchCustomers(api *cm.API, email string, t *testing.T) { | |
} | ||
} | ||
|
||
// validateMergeCustomers validates that the specified customers can be correctly merged using the API. | ||
func validateMergeCustomers(api *cm.API, t *testing.T) { | ||
err := api.MergeCustomers(&cm.MergeCustomersParams{ | ||
From: cm.CustID{CustomerUUID: "cus_2706d304-76b7-11ee-93d6-5b3d820d37cd"}, | ||
Into: cm.CustID{CustomerUUID: "cus_23740208-2c7e-11ee-9ea2-ffd2435982bb"}, | ||
}) | ||
if err != nil { | ||
t.Fatalf("Failed to merge customers: %v", err) | ||
} | ||
} | ||
|
||
// validateUnmergeCustomers validates that the specified customers can be correctly unmerged using the API. | ||
func validateUnmergeCustomers(api *cm.API, t *testing.T) { | ||
err := api.UnmergeCustomers(&cm.UnmergeCustomersParams{ | ||
CustomerUUID: "cus_cd9e5f29-6299-40e5-b343-0bd1ed228b4f", | ||
ExternalID: "cus_O075O8NH0LrtG8", | ||
DataSourceUUID: "ds_788ec6ae-dd51-11ee-bd46-a3ec952dc041", | ||
MoveToNewCustomer: []string{"tasks"}, | ||
}) | ||
if err != nil { | ||
t.Fatalf("Failed to unmerge customers: %v", err) | ||
} | ||
} | ||
|
||
// validatecustomerRetrievalAndUpdate checks that a given customer can be retrieved and updated | ||
// correctly through the API. | ||
func validateCustomerRetrievalAndUpdate(api *cm.API, customerToUpdate *cm.Customer, t *testing.T) { | ||
|