diff --git a/components_controller.go b/components_controller.go
index de98fb32..470df573 100644
--- a/components_controller.go
+++ b/components_controller.go
@@ -613,6 +613,9 @@ func (c *ComponentsController) UpdateComponentPricePoint(
return models.NewApiResponse(result, resp), err
}
+ if resp.StatusCode == 422 {
+ err = errors.NewErrorArrayMapResponse(422, "Unprocessable Entity (WebDAV)")
+ }
return models.NewApiResponse(result, resp), err
}
@@ -648,6 +651,9 @@ func (c *ComponentsController) ArchiveComponentPricePoint(
return models.NewApiResponse(result, resp), err
}
+ if resp.StatusCode == 422 {
+ err = errors.NewErrorListResponse(422, "Unprocessable Entity (WebDAV)")
+ }
return models.NewApiResponse(result, resp), err
}
diff --git a/custom_fields_controller.go b/custom_fields_controller.go
index 91f1e4c8..a5d03256 100644
--- a/custom_fields_controller.go
+++ b/custom_fields_controller.go
@@ -125,15 +125,13 @@ func (c *CustomFieldsController) ListMetafields(
return models.NewApiResponse(result, resp), err
}
-// UpdateMetafield takes context, resourceType, name, currentName, body as parameters and
+// UpdateMetafield takes context, resourceType, body as parameters and
// returns an models.ApiResponse with []models.Metafield data and
// an error if there was an issue with the request or response.
// Use the following method to update metafields for your Site. Metafields can be populated with metadata after the fact.
func (c *CustomFieldsController) UpdateMetafield(
ctx context.Context,
resourceType models.ResourceType,
- name string,
- currentName *string,
body *models.UpdateMetafieldsRequest) (
models.ApiResponse[[]models.Metafield],
error) {
@@ -144,10 +142,6 @@ func (c *CustomFieldsController) UpdateMetafield(
)
req.Authenticate(true)
req.Header("Content-Type", "application/json")
- req.QueryParam("name", name)
- if currentName != nil {
- req.QueryParam("current_name", *currentName)
- }
if body != nil {
req.Json(*body)
}
diff --git a/doc/controllers/components.md b/doc/controllers/components.md
index ecaf8a56..e1650784 100644
--- a/doc/controllers/components.md
+++ b/doc/controllers/components.md
@@ -1232,24 +1232,24 @@ pricePointId := 10
bodyPricePointPrices0 := models.UpdatePrice{
Id: models.ToPointer(1),
- EndingQuantity: models.ToPointer(100),
- UnitPrice: models.ToPointer(5),
+ EndingQuantity: models.ToPointer(interface{}("[key1, val1][key2, val2]")),
+ UnitPrice: models.ToPointer(interface{}("[key1, val1][key2, val2]")),
}
bodyPricePointPrices1 := models.UpdatePrice{
Id: models.ToPointer(2),
- Destroy: models.ToPointer("true"),
+ Destroy: models.ToPointer(true),
}
bodyPricePointPrices2 := models.UpdatePrice{
- UnitPrice: models.ToPointer(4),
- StartingQuantity: models.ToPointer(101),
+ UnitPrice: models.ToPointer(interface{}("[key1, val1][key2, val2]")),
+ StartingQuantity: models.ToPointer(interface{}("[key1, val1][key2, val2]")),
}
bodyPricePointPrices := []models.UpdatePrice{bodyPricePointPrices0, bodyPricePointPrices1, bodyPricePointPrices2}
bodyPricePoint := models.UpdateComponentPricePoint{
- Name: models.ToPointer("Default"),
- Prices: bodyPricePointPrices,
+ Name: models.ToPointer("Default"),
+ Prices: bodyPricePointPrices,
}
body := models.UpdateComponentPricePointRequest{
@@ -1266,6 +1266,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorArrayMapResponseException`](../../doc/models/error-array-map-response-exception.md) |
+
# Archive Component Price Point
@@ -1342,6 +1348,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
+
# Unarchive Component Price Point
diff --git a/doc/controllers/coupons.md b/doc/controllers/coupons.md
index 5c2b7fd7..4c358db5 100644
--- a/doc/controllers/coupons.md
+++ b/doc/controllers/coupons.md
@@ -166,7 +166,7 @@ if err != nil {
"updated_at": "2016-10-21T17:06:11-04:00",
"start_date": "2016-10-21T17:02:08-04:00",
"end_date": null,
- "percentage": 50,
+ "percentage": "50",
"recurring": true,
"duration_period_count": null,
"duration_interval": 1,
@@ -192,7 +192,7 @@ if err != nil {
"updated_at": "2016-10-21T17:06:11-04:00",
"start_date": "2016-10-21T17:02:08-04:00",
"end_date": null,
- "percentage": 50,
+ "percentage": "50",
"recurring": true,
"duration_period_count": null,
"duration_interval": 1,
@@ -218,7 +218,7 @@ if err != nil {
"updated_at": "2016-10-21T17:06:11-04:00",
"start_date": "2016-10-21T17:02:08-04:00",
"end_date": null,
- "percentage": 25,
+ "percentage": "25",
"recurring": true,
"duration_period_count": null,
"duration_interval": 1,
@@ -348,7 +348,7 @@ if err != nil {
"updated_at": "2017-11-08T10:01:15-05:00",
"start_date": "2017-11-08T10:01:15-05:00",
"end_date": null,
- "percentage": 33.3333,
+ "percentage": "33.3333",
"duration_period_count": null,
"duration_interval": null,
"duration_interval_unit": null,
@@ -612,7 +612,7 @@ if err != nil {
"product_family_name": "string",
"start_date": "string",
"end_date": "string",
- "percentage": 0,
+ "percentage": "10",
"recurring": true,
"recurring_scheme": "do_not_recur",
"duration_period_count": 0,
diff --git a/doc/controllers/custom-fields.md b/doc/controllers/custom-fields.md
index 3643dd5b..15eeabef 100644
--- a/doc/controllers/custom-fields.md
+++ b/doc/controllers/custom-fields.md
@@ -208,8 +208,6 @@ Use the following method to update metafields for your Site. Metafields can be p
UpdateMetafield(
ctx context.Context,
resourceType models.ResourceType,
- name string,
- currentName *string,
body *models.UpdateMetafieldsRequest) (
models.ApiResponse[[]models.Metafield],
error)
@@ -220,8 +218,6 @@ UpdateMetafield(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `resourceType` | [`models.ResourceType`](../../doc/models/resource-type.md) | Template, Required | the resource type to which the metafields belong |
-| `name` | `string` | Query, Required | Name of the custom field. |
-| `currentName` | `*string` | Query, Optional | This only applies when you are updating an existing record and you wish to rename the field. Note you must supply name and current_name to rename the field |
| `body` | [`*models.UpdateMetafieldsRequest`](../../doc/models/update-metafields-request.md) | Body, Optional | - |
## Response Type
@@ -233,9 +229,8 @@ UpdateMetafield(
```go
ctx := context.Background()
resourceType := models.ResourceType("subscriptions")
-name := "name0"
-apiResponse, err := customFieldsController.UpdateMetafield(ctx, resourceType, name, nil, nil)
+apiResponse, err := customFieldsController.UpdateMetafield(ctx, resourceType, nil)
if err != nil {
log.Fatalln(err)
} else {
diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md
index 253f3100..a16ac3e5 100644
--- a/doc/controllers/invoices.md
+++ b/doc/controllers/invoices.md
@@ -2735,7 +2735,7 @@ if err != nil {
| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
-| 422 | Unprocessable Entity (WebDAV) | [`NestedErrorResponseException`](../../doc/models/nested-error-response-exception.md) |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorArrayMapResponseException`](../../doc/models/error-array-map-response-exception.md) |
# Send Invoice
diff --git a/doc/controllers/offers.md b/doc/controllers/offers.md
index 3103e874..be5b144f 100644
--- a/doc/controllers/offers.md
+++ b/doc/controllers/offers.md
@@ -132,7 +132,7 @@ if err != nil {
| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
-| 422 | Unprocessable Entity (WebDAV) | [`ErrorMapResponseException`](../../doc/models/error-map-response-exception.md) |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorArrayMapResponseException`](../../doc/models/error-array-map-response-exception.md) |
# List Offers
diff --git a/doc/controllers/payment-profiles.md b/doc/controllers/payment-profiles.md
index d9c699fa..1ef1197a 100644
--- a/doc/controllers/payment-profiles.md
+++ b/doc/controllers/payment-profiles.md
@@ -275,7 +275,7 @@ You may wish to redirect customers to different pages depending on whether their
CreatePaymentProfile(
ctx context.Context,
body *models.CreatePaymentProfileRequest) (
- models.ApiResponse[models.CreatePaymentProfileResponse],
+ models.ApiResponse[models.PaymentProfileResponse],
error)
```
@@ -287,7 +287,7 @@ CreatePaymentProfile(
## Response Type
-[`models.CreatePaymentProfileResponse`](../../doc/models/create-payment-profile-response.md)
+[`models.PaymentProfileResponse`](../../doc/models/payment-profile-response.md)
## Example Usage
@@ -300,8 +300,8 @@ bodyPaymentProfile := models.CreatePaymentProfile{
BankName: models.ToPointer("Best Bank"),
BankRoutingNumber: models.ToPointer("021000089"),
BankAccountNumber: models.ToPointer("111111111111"),
- BankAccountType: models.ToPointer("checking"),
- BankAccountHolderType: models.ToPointer("business"),
+ BankAccountType: models.ToPointer(models.BankAccountType("checking")),
+ BankAccountHolderType: models.ToPointer(models.BankAccountHolderType("business")),
}
body := models.CreatePaymentProfileRequest{
@@ -326,6 +326,7 @@ if err != nil {
"first_name": "Jessica",
"last_name": "Test",
"card_type": "visa",
+ "masked_card_number": "XXXX-XXXX-XXXX-1111",
"expiration_month": 10,
"expiration_year": 2018,
"customer_id": 19195410,
@@ -361,7 +362,7 @@ This method will return all of the active `payment_profiles` for a Site, or for
```go
ListPaymentProfiles(
ctx context.Context,input ListPaymentProfilesInput) (
- models.ApiResponse[[]models.ListPaymentProfilesResponse],
+ models.ApiResponse[[]models.PaymentProfileResponse],
error)
```
@@ -375,7 +376,7 @@ ListPaymentProfiles(
## Response Type
-[`[]models.ListPaymentProfilesResponse`](../../doc/models/list-payment-profiles-response.md)
+[`[]models.PaymentProfileResponse`](../../doc/models/payment-profile-response.md)
## Example Usage
@@ -419,6 +420,7 @@ if err != nil {
"bank_account_type": "checking",
"bank_account_holder_type": "personal",
"payment_type": "bank_account",
+ "verified": true,
"site_gateway_setting_id": 1,
"gateway_handle": "handle"
}
@@ -444,6 +446,7 @@ if err != nil {
"bank_account_type": "checking",
"bank_account_holder_type": "personal",
"payment_type": "bank_account",
+ "verified": true,
"site_gateway_setting_id": 1,
"gateway_handle": "handle"
}
@@ -493,8 +496,8 @@ Example response for Bank Account:
```go
ReadPaymentProfile(
ctx context.Context,
- paymentProfileId string) (
- models.ApiResponse[models.ReadPaymentProfileResponse],
+ paymentProfileId int) (
+ models.ApiResponse[models.PaymentProfileResponse],
error)
```
@@ -502,17 +505,17 @@ ReadPaymentProfile(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
-| `paymentProfileId` | `string` | Template, Required | The Chargify id of the payment profile |
+| `paymentProfileId` | `int` | Template, Required | The Chargify id of the payment profile |
## Response Type
-[`models.ReadPaymentProfileResponse`](../../doc/models/read-payment-profile-response.md)
+[`models.PaymentProfileResponse`](../../doc/models/payment-profile-response.md)
## Example Usage
```go
ctx := context.Background()
-paymentProfileId := "payment_profile_id2"
+paymentProfileId := 198
apiResponse, err := paymentProfilesController.ReadPaymentProfile(ctx, paymentProfileId)
if err != nil {
@@ -553,6 +556,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 404 | Not Found | `ApiError` |
+
# Update Payment Profile
@@ -594,9 +603,9 @@ The result will be that you have updated the billing information for the card, y
```go
UpdatePaymentProfile(
ctx context.Context,
- paymentProfileId string,
+ paymentProfileId int,
body *models.UpdatePaymentProfileRequest) (
- models.ApiResponse[models.UpdatePaymentProfileResponse],
+ models.ApiResponse[models.PaymentProfileResponse],
error)
```
@@ -604,18 +613,18 @@ UpdatePaymentProfile(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
-| `paymentProfileId` | `string` | Template, Required | The Chargify id of the payment profile |
+| `paymentProfileId` | `int` | Template, Required | The Chargify id of the payment profile |
| `body` | [`*models.UpdatePaymentProfileRequest`](../../doc/models/update-payment-profile-request.md) | Body, Optional | - |
## Response Type
-[`models.UpdatePaymentProfileResponse`](../../doc/models/update-payment-profile-response.md)
+[`models.PaymentProfileResponse`](../../doc/models/payment-profile-response.md)
## Example Usage
```go
ctx := context.Background()
-paymentProfileId := "payment_profile_id2"
+paymentProfileId := 198
bodyPaymentProfile := models.UpdatePaymentProfile{
FirstName: models.ToPointer("Graham"),
@@ -676,6 +685,13 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 404 | Not Found | `ApiError` |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorStringMapResponseException`](../../doc/models/error-string-map-response-exception.md) |
+
# Delete Unused Payment Profile
@@ -686,7 +702,7 @@ If the payment profile is in use by one or more subscriptions or groups, a 422 a
```go
DeleteUnusedPaymentProfile(
ctx context.Context,
- paymentProfileId string) (
+ paymentProfileId int) (
http.Response,
error)
```
@@ -695,7 +711,7 @@ DeleteUnusedPaymentProfile(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
-| `paymentProfileId` | `string` | Template, Required | The Chargify id of the payment profile |
+| `paymentProfileId` | `int` | Template, Required | The Chargify id of the payment profile |
## Response Type
@@ -705,7 +721,7 @@ DeleteUnusedPaymentProfile(
```go
ctx := context.Background()
-paymentProfileId := "payment_profile_id2"
+paymentProfileId := 198
resp, err := paymentProfilesController.DeleteUnusedPaymentProfile(ctx, paymentProfileId)
if err != nil {
@@ -719,6 +735,7 @@ if err != nil {
| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
+| 404 | Not Found | `ApiError` |
| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
@@ -734,7 +751,7 @@ This will delete a payment profile belonging to the customer on the subscription
DeleteSubscriptionsPaymentProfile(
ctx context.Context,
subscriptionId int,
- paymentProfileId string) (
+ paymentProfileId int) (
http.Response,
error)
```
@@ -744,7 +761,7 @@ DeleteSubscriptionsPaymentProfile(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `subscriptionId` | `int` | Template, Required | The Chargify id of the subscription |
-| `paymentProfileId` | `string` | Template, Required | The Chargify id of the payment profile |
+| `paymentProfileId` | `int` | Template, Required | The Chargify id of the payment profile |
## Response Type
@@ -755,7 +772,7 @@ DeleteSubscriptionsPaymentProfile(
```go
ctx := context.Background()
subscriptionId := 222
-paymentProfileId := "payment_profile_id2"
+paymentProfileId := 198
resp, err := paymentProfilesController.DeleteSubscriptionsPaymentProfile(ctx, subscriptionId, paymentProfileId)
if err != nil {
@@ -861,7 +878,7 @@ This will delete a Payment Profile belonging to a Subscription Group.
DeleteSubscriptionGroupPaymentProfile(
ctx context.Context,
uid string,
- paymentProfileId string) (
+ paymentProfileId int) (
http.Response,
error)
```
@@ -871,7 +888,7 @@ DeleteSubscriptionGroupPaymentProfile(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `uid` | `string` | Template, Required | The uid of the subscription group |
-| `paymentProfileId` | `string` | Template, Required | The Chargify id of the payment profile |
+| `paymentProfileId` | `int` | Template, Required | The Chargify id of the payment profile |
## Response Type
@@ -882,7 +899,7 @@ DeleteSubscriptionGroupPaymentProfile(
```go
ctx := context.Background()
uid := "uid0"
-paymentProfileId := "payment_profile_id2"
+paymentProfileId := 198
resp, err := paymentProfilesController.DeleteSubscriptionGroupPaymentProfile(ctx, uid, paymentProfileId)
if err != nil {
@@ -969,6 +986,7 @@ if err != nil {
| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
+| 404 | Not Found | `ApiError` |
| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
@@ -984,7 +1002,7 @@ The new payment profile must belong to the subscription group's customer, otherw
UpdateSubscriptionGroupDefaultPaymentProfile(
ctx context.Context,
uid string,
- paymentProfileId string) (
+ paymentProfileId int) (
models.ApiResponse[models.PaymentProfileResponse],
error)
```
@@ -994,7 +1012,7 @@ UpdateSubscriptionGroupDefaultPaymentProfile(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `uid` | `string` | Template, Required | The uid of the subscription group |
-| `paymentProfileId` | `string` | Template, Required | The Chargify id of the payment profile |
+| `paymentProfileId` | `int` | Template, Required | The Chargify id of the payment profile |
## Response Type
@@ -1005,7 +1023,7 @@ UpdateSubscriptionGroupDefaultPaymentProfile(
```go
ctx := context.Background()
uid := "uid0"
-paymentProfileId := "payment_profile_id2"
+paymentProfileId := 198
apiResponse, err := paymentProfilesController.UpdateSubscriptionGroupDefaultPaymentProfile(ctx, uid, paymentProfileId)
if err != nil {
diff --git a/doc/controllers/product-price-points.md b/doc/controllers/product-price-points.md
index 4b3b5cd1..0a7e9efa 100644
--- a/doc/controllers/product-price-points.md
+++ b/doc/controllers/product-price-points.md
@@ -783,7 +783,7 @@ if err != nil {
| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
-| 422 | Unprocessable Entity (WebDAV) | [`ErrorMapResponseException`](../../doc/models/error-map-response-exception.md) |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorArrayMapResponseException`](../../doc/models/error-array-map-response-exception.md) |
# Update Product Currency Prices
@@ -866,7 +866,7 @@ if err != nil {
| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
-| 422 | Unprocessable Entity (WebDAV) | [`ErrorMapResponseException`](../../doc/models/error-map-response-exception.md) |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorArrayMapResponseException`](../../doc/models/error-array-map-response-exception.md) |
# List All Product Price Points
diff --git a/doc/controllers/proforma-invoices.md b/doc/controllers/proforma-invoices.md
index 65f531b8..bc31d82e 100644
--- a/doc/controllers/proforma-invoices.md
+++ b/doc/controllers/proforma-invoices.md
@@ -447,7 +447,7 @@ if err != nil {
| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 400 | Bad Request | [`ProformaBadRequestErrorResponseException`](../../doc/models/proforma-bad-request-error-response-exception.md) |
-| 422 | Unprocessable Entity (WebDAV) | [`ErrorMapResponseException`](../../doc/models/error-map-response-exception.md) |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorArrayMapResponseException`](../../doc/models/error-array-map-response-exception.md) |
# Preview Signup Proforma Invoice
@@ -515,5 +515,5 @@ if err != nil {
| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 400 | Bad Request | [`ProformaBadRequestErrorResponseException`](../../doc/models/proforma-bad-request-error-response-exception.md) |
-| 422 | Unprocessable Entity (WebDAV) | [`ErrorMapResponseException`](../../doc/models/error-map-response-exception.md) |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorArrayMapResponseException`](../../doc/models/error-array-map-response-exception.md) |
diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md
index 1983cb84..8f536a69 100644
--- a/doc/controllers/subscriptions.md
+++ b/doc/controllers/subscriptions.md
@@ -2110,5 +2110,5 @@ if err != nil {
| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
-| 400 | Bad Request | [`NestedErrorResponseException`](../../doc/models/nested-error-response-exception.md) |
+| 400 | Bad Request | [`ErrorArrayMapResponseException`](../../doc/models/error-array-map-response-exception.md) |
diff --git a/doc/models/bank-account-attributes.md b/doc/models/bank-account-attributes.md
index 8715cf29..e598f84d 100644
--- a/doc/models/bank-account-attributes.md
+++ b/doc/models/bank-account-attributes.md
@@ -13,11 +13,11 @@
| `BankName` | `*string` | Optional | (Required when creating a subscription with ACH or GoCardless) The name of the bank where the customer’s account resides |
| `BankRoutingNumber` | `*string` | Optional | (Required when creating a subscription with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API |
| `BankAccountNumber` | `*string` | Optional | (Required when creating a subscription with ACH. Required when creating a subscription with GoCardless and bank_iban is blank) The customerʼs bank account number |
-| `BankAccountType` | `*string` | Optional | - |
+| `BankAccountType` | [`*models.BankAccountType`](../../doc/models/bank-account-type.md) | Optional | Defaults to checking
**Default**: `"checking"` |
| `BankBranchCode` | `*string` | Optional | (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be provided |
| `BankIban` | `*string` | Optional | (Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided |
-| `BankAccountHolderType` | `*string` | Optional | - |
-| `PaymentType` | `*string` | Optional | - |
+| `BankAccountHolderType` | [`*models.BankAccountHolderType`](../../doc/models/bank-account-holder-type.md) | Optional | Defaults to personal |
+| `PaymentType` | [`*models.PaymentType`](../../doc/models/payment-type.md) | Optional | **Default**: `"credit_card"` |
| `CurrentVault` | [`*models.BankAccountVault`](../../doc/models/bank-account-vault.md) | Optional | The vault that stores the payment profile with the provided vault_token. |
| `VaultToken` | `*string` | Optional | - |
| `CustomerVaultToken` | `*string` | Optional | (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token |
@@ -26,11 +26,12 @@
```json
{
+ "bank_account_type": "checking",
+ "payment_type": "credit_card",
"chargify_token": "chargify_token0",
"bank_name": "bank_name2",
"bank_routing_number": "bank_routing_number8",
- "bank_account_number": "bank_account_number4",
- "bank_account_type": "bank_account_type0"
+ "bank_account_number": "bank_account_number4"
}
```
diff --git a/doc/models/bank-account-holder-type.md b/doc/models/bank-account-holder-type.md
new file mode 100644
index 00000000..ebb220db
--- /dev/null
+++ b/doc/models/bank-account-holder-type.md
@@ -0,0 +1,16 @@
+
+# Bank Account Holder Type
+
+Defaults to personal
+
+## Enumeration
+
+`BankAccountHolderType`
+
+## Fields
+
+| Name |
+| --- |
+| `PERSONAL` |
+| `BUSINESS` |
+
diff --git a/doc/models/bank-account-payment-profile.md b/doc/models/bank-account-payment-profile.md
new file mode 100644
index 00000000..d2468856
--- /dev/null
+++ b/doc/models/bank-account-payment-profile.md
@@ -0,0 +1,51 @@
+
+# Bank Account Payment Profile
+
+## Structure
+
+`BankAccountPaymentProfile`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `Id` | `*int` | Optional | The Chargify-assigned ID of the stored bank account. This value can be used as an input to payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the same customer |
+| `FirstName` | `*string` | Optional | The first name of the bank account holder |
+| `LastName` | `*string` | Optional | The last name of the bank account holder |
+| `CustomerId` | `*int` | Optional | The Chargify-assigned id for the customer record to which the bank account belongs |
+| `CurrentVault` | [`*models.BankAccountVault`](../../doc/models/bank-account-vault.md) | Optional | The vault that stores the payment profile with the provided vault_token. |
+| `VaultToken` | `*string` | Optional | The “token” provided by your vault storage for an already stored payment profile |
+| `BillingAddress` | `Optional[string]` | Optional | The current billing street address for the bank account |
+| `BillingCity` | `Optional[string]` | Optional | The current billing address city for the bank account |
+| `BillingState` | `Optional[string]` | Optional | The current billing address state for the bank account |
+| `BillingZip` | `Optional[string]` | Optional | The current billing address zip code for the bank account |
+| `BillingCountry` | `Optional[string]` | Optional | The current billing address country for the bank account |
+| `CustomerVaultToken` | `Optional[string]` | Optional | (only for Authorize.Net CIM storage): the customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token. |
+| `BillingAddress2` | `Optional[string]` | Optional | The current billing street address, second line, for the bank account |
+| `BankName` | `*string` | Optional | The bank where the account resides |
+| `MaskedBankRoutingNumber` | `string` | Required | A string representation of the stored bank routing number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’). payment_type will be bank_account |
+| `MaskedBankAccountNumber` | `string` | Required | A string representation of the stored bank account number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’) |
+| `BankAccountType` | [`*models.BankAccountType`](../../doc/models/bank-account-type.md) | Optional | Defaults to checking
**Default**: `"checking"` |
+| `BankAccountHolderType` | [`*models.BankAccountHolderType`](../../doc/models/bank-account-holder-type.md) | Optional | Defaults to personal |
+| `PaymentType` | [`*models.PaymentType`](../../doc/models/payment-type.md) | Optional | **Default**: `"credit_card"` |
+| `Verified` | `*bool` | Optional | denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account
**Default**: `false` |
+| `SiteGatewaySettingId` | `*int` | Optional | - |
+| `GatewayHandle` | `Optional[string]` | Optional | - |
+
+## Example (as JSON)
+
+```json
+{
+ "masked_bank_routing_number": "masked_bank_routing_number8",
+ "masked_bank_account_number": "masked_bank_account_number8",
+ "bank_account_type": "checking",
+ "payment_type": "credit_card",
+ "verified": false,
+ "id": 188,
+ "first_name": "first_name6",
+ "last_name": "last_name4",
+ "customer_id": 226,
+ "current_vault": "authorizenet"
+}
+```
+
diff --git a/doc/models/bank-account-response.md b/doc/models/bank-account-response.md
index 418749fd..44d537ad 100644
--- a/doc/models/bank-account-response.md
+++ b/doc/models/bank-account-response.md
@@ -9,13 +9,17 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `PaymentProfile` | [`models.BankAccount`](../../doc/models/bank-account.md) | Required | - |
+| `PaymentProfile` | [`models.BankAccountPaymentProfile`](../../doc/models/bank-account-payment-profile.md) | Required | - |
## Example (as JSON)
```json
{
"payment_profile": {
+ "masked_bank_routing_number": "masked_bank_routing_number0",
+ "masked_bank_account_number": "masked_bank_account_number6",
+ "bank_account_type": "checking",
+ "payment_type": "credit_card",
"verified": false,
"id": 44,
"first_name": "first_name4",
diff --git a/doc/models/bank-account-type.md b/doc/models/bank-account-type.md
index de68e5e3..8bbb5ed2 100644
--- a/doc/models/bank-account-type.md
+++ b/doc/models/bank-account-type.md
@@ -1,6 +1,8 @@
# Bank Account Type
+Defaults to checking
+
## Enumeration
`BankAccountType`
diff --git a/doc/models/bank-account.md b/doc/models/bank-account.md
deleted file mode 100644
index c222d04d..00000000
--- a/doc/models/bank-account.md
+++ /dev/null
@@ -1,47 +0,0 @@
-
-# Bank Account
-
-## Structure
-
-`BankAccount`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `Id` | `*int` | Optional | - |
-| `FirstName` | `*string` | Optional | - |
-| `LastName` | `*string` | Optional | - |
-| `CustomerId` | `*int` | Optional | - |
-| `CurrentVault` | [`*models.BankAccountVault`](../../doc/models/bank-account-vault.md) | Optional | The vault that stores the payment profile with the provided vault_token. |
-| `VaultToken` | `*string` | Optional | - |
-| `BillingAddress` | `*string` | Optional | - |
-| `BillingCity` | `*string` | Optional | - |
-| `BillingState` | `*string` | Optional | - |
-| `BillingZip` | `*string` | Optional | - |
-| `BillingCountry` | `*string` | Optional | - |
-| `CustomerVaultToken` | `Optional[string]` | Optional | - |
-| `BillingAddress2` | `*string` | Optional | - |
-| `BankName` | `*string` | Optional | - |
-| `MaskedBankRoutingNumber` | `*string` | Optional | - |
-| `MaskedBankAccountNumber` | `*string` | Optional | - |
-| `BankAccountType` | `*string` | Optional | - |
-| `BankAccountHolderType` | `*string` | Optional | - |
-| `PaymentType` | `*string` | Optional | - |
-| `Verified` | `*bool` | Optional | denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account
**Default**: `false` |
-| `SiteGatewaySettingId` | `*int` | Optional | - |
-| `GatewayHandle` | `*string` | Optional | - |
-
-## Example (as JSON)
-
-```json
-{
- "verified": false,
- "id": 190,
- "first_name": "first_name2",
- "last_name": "last_name0",
- "customer_id": 228,
- "current_vault": "stripe_connect"
-}
-```
-
diff --git a/doc/models/card-type.md b/doc/models/card-type.md
index 73ca6264..4ae44cca 100644
--- a/doc/models/card-type.md
+++ b/doc/models/card-type.md
@@ -11,17 +11,40 @@ The type of card used.
| Name |
| --- |
-| `BOGUS` |
| `VISA` |
| `MASTER` |
+| `ELO` |
+| `CABAL` |
+| `ALELO` |
| `DISCOVER` |
| `AMERICANEXPRESS` |
+| `NARANJA` |
| `DINERSCLUB` |
| `JCB` |
-| `ENUMSWITCH` |
-| `SOLO` |
| `DANKORT` |
| `MAESTRO` |
-| `LASER` |
+| `MAESTRONOLUHN` |
| `FORBRUGSFORENINGEN` |
+| `SODEXO` |
+| `ALIA` |
+| `VR` |
+| `UNIONPAY` |
+| `CARNET` |
+| `CARTESBANCAIRES` |
+| `OLIMPICA` |
+| `CREDITEL` |
+| `CONFIABLE` |
+| `SYNCHRONY` |
+| `ROUTEX` |
+| `MADA` |
+| `BPPLUS` |
+| `PASSCARD` |
+| `EDENRED` |
+| `ANDA` |
+| `TARJETAD` |
+| `HIPERCARD` |
+| `BOGUS` |
+| `ENUMSWITCH` |
+| `SOLO` |
+| `LASER` |
diff --git a/doc/models/component-currency-price.md b/doc/models/component-currency-price.md
new file mode 100644
index 00000000..5af54000
--- /dev/null
+++ b/doc/models/component-currency-price.md
@@ -0,0 +1,30 @@
+
+# Component Currency Price
+
+## Structure
+
+`ComponentCurrencyPrice`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `Id` | `*int` | Optional | - |
+| `Currency` | `*string` | Optional | - |
+| `Price` | `*string` | Optional | - |
+| `FormattedPrice` | `*string` | Optional | - |
+| `PriceId` | `*int` | Optional | - |
+| `PricePointId` | `*int` | Optional | - |
+
+## Example (as JSON)
+
+```json
+{
+ "id": 4,
+ "currency": "currency8",
+ "price": "price4",
+ "formatted_price": "formatted_price6",
+ "price_id": 162
+}
+```
+
diff --git a/doc/models/component-price-point.md b/doc/models/component-price-point.md
index eb559f49..b25e609d 100644
--- a/doc/models/component-price-point.md
+++ b/doc/models/component-price-point.md
@@ -16,15 +16,16 @@
| `PricingScheme` | [`*models.PricingScheme`](../../doc/models/pricing-scheme.md) | Optional | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. |
| `ComponentId` | `*int` | Optional | - |
| `Handle` | `*string` | Optional | - |
-| `ArchivedAt` | `Optional[string]` | Optional | - |
-| `CreatedAt` | `*string` | Optional | - |
-| `UpdatedAt` | `*string` | Optional | - |
+| `ArchivedAt` | `Optional[time.Time]` | Optional | - |
+| `CreatedAt` | `*time.Time` | Optional | - |
+| `UpdatedAt` | `*time.Time` | Optional | - |
| `Prices` | [`[]models.ComponentPricePointPrice`](../../doc/models/component-price-point-price.md) | Optional | - |
| `UseSiteExchangeRate` | `*bool` | Optional | Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site.
**Default**: `true` |
| `SubscriptionId` | `*int` | Optional | (only used for Custom Pricing - ie. when the price point's type is `custom`) The id of the subscription that the custom price point is for. |
| `TaxIncluded` | `*bool` | Optional | - |
-| `Interval` | `*int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. |
-| `IntervalUnit` | [`*models.IntervalUnit`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. |
+| `Interval` | `Optional[int]` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. |
+| `IntervalUnit` | [`Optional[models.IntervalUnit]`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. |
+| `CurrencyPrices` | [`[]models.ComponentCurrencyPrice`](../../doc/models/component-currency-price.md) | Optional | An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. |
## Example (as JSON)
diff --git a/doc/models/component-price-points-response.md b/doc/models/component-price-points-response.md
index 068290b7..45df0633 100644
--- a/doc/models/component-price-points-response.md
+++ b/doc/models/component-price-points-response.md
@@ -10,6 +10,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `PricePoints` | [`[]models.ComponentPricePoint`](../../doc/models/component-price-point.md) | Optional | - |
+| `Meta` | [`*models.ListPublicKeysMeta`](../../doc/models/list-public-keys-meta.md) | Optional | - |
## Example (as JSON)
@@ -30,7 +31,13 @@
"name": "name2",
"pricing_scheme": "per_unit"
}
- ]
+ ],
+ "meta": {
+ "total_count": 150,
+ "current_page": 126,
+ "total_pages": 138,
+ "per_page": 152
+ }
}
```
diff --git a/doc/models/coupon.md b/doc/models/coupon.md
index 8c2e655e..b6ca8b6d 100644
--- a/doc/models/coupon.md
+++ b/doc/models/coupon.md
@@ -19,7 +19,7 @@
| `ProductFamilyName` | `Optional[string]` | Optional | - |
| `StartDate` | `*string` | Optional | - |
| `EndDate` | `Optional[string]` | Optional | - |
-| `Percentage` | `Optional[float64]` | Optional | - |
+| `Percentage` | `Optional[string]` | Optional | - |
| `Recurring` | `*bool` | Optional | - |
| `RecurringScheme` | [`*models.RecurringScheme`](../../doc/models/recurring-scheme.md) | Optional | - |
| `DurationPeriodCount` | `Optional[int]` | Optional | - |
diff --git a/doc/models/create-payment-profile-request.md b/doc/models/create-payment-profile-request.md
index f5940850..1e4f9ff7 100644
--- a/doc/models/create-payment-profile-request.md
+++ b/doc/models/create-payment-profile-request.md
@@ -19,6 +19,7 @@
"chargify_token": "tok_9g6hw85pnpt6knmskpwp4ttt",
"payment_type": "credit_card",
"full_number": "5424000000000015",
+ "bank_account_type": "checking",
"id": 44,
"first_name": "first_name4",
"last_name": "last_name2"
diff --git a/doc/models/create-payment-profile-response.md b/doc/models/create-payment-profile-response.md
deleted file mode 100644
index 53d2db7c..00000000
--- a/doc/models/create-payment-profile-response.md
+++ /dev/null
@@ -1,27 +0,0 @@
-
-# Create Payment Profile Response
-
-## Structure
-
-`CreatePaymentProfileResponse`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `PaymentProfile` | [`models.CreatedPaymentProfile`](../../doc/models/created-payment-profile.md) | Required | - |
-
-## Example (as JSON)
-
-```json
-{
- "payment_profile": {
- "id": 44,
- "first_name": "first_name4",
- "last_name": "last_name2",
- "masked_card_number": "masked_card_number2",
- "card_type": "card_type0"
- }
-}
-```
-
diff --git a/doc/models/create-payment-profile.md b/doc/models/create-payment-profile.md
index b8b5e65c..b20bade7 100644
--- a/doc/models/create-payment-profile.md
+++ b/doc/models/create-payment-profile.md
@@ -38,8 +38,8 @@
| `BankRoutingNumber` | `*string` | Optional | (Required when creating with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API |
| `BankAccountNumber` | `*string` | Optional | (Required when creating with ACH, GoCardless, Stripe BECS Direct Debit and bank_iban is blank) The customerʼs bank account number |
| `BankBranchCode` | `*string` | Optional | (Optional when creating with GoCardless, required with Stripe BECS Direct Debit) Branch code. Alternatively, an IBAN can be provided |
-| `BankAccountType` | `*string` | Optional | - |
-| `BankAccountHolderType` | `*string` | Optional | - |
+| `BankAccountType` | [`*models.BankAccountType`](../../doc/models/bank-account-type.md) | Optional | Defaults to checking
**Default**: `"checking"` |
+| `BankAccountHolderType` | [`*models.BankAccountHolderType`](../../doc/models/bank-account-holder-type.md) | Optional | Defaults to personal |
| `LastFour` | `*string` | Optional | (Optional) Used for creating subscription with payment profile imported using vault_token, for proper display in Advanced Billing UI |
## Example (as JSON)
@@ -49,6 +49,7 @@
"chargify_token": "tok_9g6hw85pnpt6knmskpwp4ttt",
"payment_type": "credit_card",
"full_number": "5424000000000015",
+ "bank_account_type": "checking",
"id": 76,
"first_name": "first_name8",
"last_name": "last_name6"
diff --git a/doc/models/created-payment-profile.md b/doc/models/created-payment-profile.md
deleted file mode 100644
index 84969a72..00000000
--- a/doc/models/created-payment-profile.md
+++ /dev/null
@@ -1,51 +0,0 @@
-
-# Created Payment Profile
-
-## Structure
-
-`CreatedPaymentProfile`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `Id` | `*int` | Optional | - |
-| `FirstName` | `*string` | Optional | - |
-| `LastName` | `*string` | Optional | - |
-| `MaskedCardNumber` | `Optional[string]` | Optional | - |
-| `CardType` | `*string` | Optional | - |
-| `ExpirationMonth` | `*int` | Optional | - |
-| `ExpirationYear` | `*int` | Optional | - |
-| `CustomerId` | `*int` | Optional | - |
-| `CurrentVault` | [`*models.CurrentVault`](../../doc/models/current-vault.md) | Optional | The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing. |
-| `VaultToken` | `*string` | Optional | - |
-| `BillingAddress` | `*string` | Optional | - |
-| `BillingCity` | `*string` | Optional | - |
-| `BillingState` | `*string` | Optional | - |
-| `BillingZip` | `*string` | Optional | - |
-| `BillingCountry` | `*string` | Optional | - |
-| `CustomerVaultToken` | `Optional[string]` | Optional | - |
-| `BillingAddress2` | `Optional[string]` | Optional | - |
-| `PaymentType` | `*string` | Optional | - |
-| `BankName` | `*string` | Optional | - |
-| `MaskedBankRoutingNumber` | `*string` | Optional | - |
-| `MaskedBankAccountNumber` | `*string` | Optional | - |
-| `BankAccountType` | `*string` | Optional | - |
-| `BankAccountHolderType` | `*string` | Optional | - |
-| `Verified` | `*bool` | Optional | - |
-| `SiteGatewaySettingId` | `*int` | Optional | - |
-| `GatewayHandle` | `*string` | Optional | - |
-| `Disabled` | `*bool` | Optional | - |
-
-## Example (as JSON)
-
-```json
-{
- "id": 14,
- "first_name": "first_name0",
- "last_name": "last_name8",
- "masked_card_number": "masked_card_number8",
- "card_type": "card_type4"
-}
-```
-
diff --git a/doc/models/payment-profile.md b/doc/models/credit-card-payment-profile.md
similarity index 86%
rename from doc/models/payment-profile.md
rename to doc/models/credit-card-payment-profile.md
index 8fb4409c..1b709904 100644
--- a/doc/models/payment-profile.md
+++ b/doc/models/credit-card-payment-profile.md
@@ -1,9 +1,9 @@
-# Payment Profile
+# Credit Card Payment Profile
## Structure
-`PaymentProfile`
+`CreditCardPaymentProfile`
## Fields
@@ -12,7 +12,7 @@
| `Id` | `*int` | Optional | The Chargify-assigned ID of the stored card. This value can be used as an input to payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the same customer. |
| `FirstName` | `*string` | Optional | The first name of the card holder. |
| `LastName` | `*string` | Optional | The last name of the card holder. |
-| `MaskedCardNumber` | `*string` | Optional | A string representation of the credit card number with all but the last 4 digits masked with X’s (i.e. ‘XXXX-XXXX-XXXX-1234’). |
+| `MaskedCardNumber` | `string` | Required | A string representation of the credit card number with all but the last 4 digits masked with X’s (i.e. ‘XXXX-XXXX-XXXX-1234’). |
| `CardType` | [`*models.CardType`](../../doc/models/card-type.md) | Optional | The type of card used. |
| `ExpirationMonth` | `*int` | Optional | An integer representing the expiration month of the card(1 – 12). |
| `ExpirationYear` | `*int` | Optional | An integer representing the 4-digit expiration year of the card(i.e. ‘2012’). |
@@ -28,7 +28,7 @@
| `BillingAddress2` | `Optional[string]` | Optional | The current billing street address, second line, for the card. |
| `PaymentType` | [`*models.PaymentType`](../../doc/models/payment-type.md) | Optional | **Default**: `"credit_card"` |
| `Disabled` | `*bool` | Optional | - |
-| `ChargifyToken` | `*string` | Optional | Token received after sending billing informations using chargify.js. |
+| `ChargifyToken` | `*string` | Optional | Token received after sending billing information using chargify.js. This token will only be received if passed as a sole attribute of credit_card_attributes (i.e. tok_9g6hw85pnpt6knmskpwp4ttt) |
| `SiteGatewaySettingId` | `Optional[int]` | Optional | - |
| `GatewayHandle` | `Optional[string]` | Optional | An identifier of connected gateway. |
diff --git a/doc/models/error-map-response-exception.md b/doc/models/error-array-map-response-exception.md
similarity index 73%
rename from doc/models/error-map-response-exception.md
rename to doc/models/error-array-map-response-exception.md
index 2d83cf47..960a0f69 100644
--- a/doc/models/error-map-response-exception.md
+++ b/doc/models/error-array-map-response-exception.md
@@ -1,9 +1,9 @@
-# Error Map Response Exception
+# Error Array Map Response Exception
## Structure
-`ErrorMapResponseException`
+`ErrorArrayMapResponseException`
## Fields
diff --git a/doc/models/error-string-map-response-exception.md b/doc/models/error-string-map-response-exception.md
new file mode 100644
index 00000000..9cf6bb0c
--- /dev/null
+++ b/doc/models/error-string-map-response-exception.md
@@ -0,0 +1,24 @@
+
+# Error String Map Response Exception
+
+## Structure
+
+`ErrorStringMapResponseException`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `Errors` | `map[string]string` | Optional | - |
+
+## Example (as JSON)
+
+```json
+{
+ "errors": {
+ "key0": "errors3",
+ "key1": "errors4"
+ }
+}
+```
+
diff --git a/doc/models/get-one-time-token-payment-profile.md b/doc/models/get-one-time-token-payment-profile.md
index 65d081ac..eb4e5c30 100644
--- a/doc/models/get-one-time-token-payment-profile.md
+++ b/doc/models/get-one-time-token-payment-profile.md
@@ -13,7 +13,7 @@
| `FirstName` | `string` | Required | **Constraints**: *Minimum Length*: `1` |
| `LastName` | `string` | Required | **Constraints**: *Minimum Length*: `1` |
| `MaskedCardNumber` | `string` | Required | **Constraints**: *Minimum Length*: `1` |
-| `CardType` | `string` | Required | **Constraints**: *Minimum Length*: `1` |
+| `CardType` | [`models.CardType`](../../doc/models/card-type.md) | Required | The type of card used. |
| `ExpirationMonth` | `float64` | Required | - |
| `ExpirationYear` | `float64` | Required | - |
| `CustomerId` | `Optional[string]` | Optional | - |
@@ -39,7 +39,7 @@
"first_name": "first_name2",
"last_name": "last_name0",
"masked_card_number": "masked_card_number0",
- "card_type": "card_type8",
+ "card_type": "routex",
"expiration_month": 187.78,
"expiration_year": 164.44,
"customer_id": "customer_id0",
diff --git a/doc/models/get-one-time-token-request.md b/doc/models/get-one-time-token-request.md
index d3b872ec..0fa94e18 100644
--- a/doc/models/get-one-time-token-request.md
+++ b/doc/models/get-one-time-token-request.md
@@ -20,7 +20,7 @@
"first_name": "first_name4",
"last_name": "last_name2",
"masked_card_number": "masked_card_number2",
- "card_type": "card_type0",
+ "card_type": "bogus",
"expiration_month": 133.5,
"expiration_year": 156.84,
"customer_id": "customer_id2",
diff --git a/doc/models/holder-type.md b/doc/models/holder-type.md
deleted file mode 100644
index 062309b2..00000000
--- a/doc/models/holder-type.md
+++ /dev/null
@@ -1,14 +0,0 @@
-
-# Holder Type
-
-## Enumeration
-
-`HolderType`
-
-## Fields
-
-| Name |
-| --- |
-| `PERSONAL` |
-| `BUSINESS` |
-
diff --git a/doc/models/list-payment-profile-item.md b/doc/models/list-payment-profile-item.md
deleted file mode 100644
index 88b7a9fd..00000000
--- a/doc/models/list-payment-profile-item.md
+++ /dev/null
@@ -1,45 +0,0 @@
-
-# List Payment Profile Item
-
-## Structure
-
-`ListPaymentProfileItem`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `Id` | `*int` | Optional | - |
-| `FirstName` | `*string` | Optional | - |
-| `LastName` | `*string` | Optional | - |
-| `CustomerId` | `*int` | Optional | - |
-| `CurrentVault` | [`*models.CurrentVault`](../../doc/models/current-vault.md) | Optional | The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing. |
-| `VaultToken` | `*string` | Optional | - |
-| `BillingAddress` | `*string` | Optional | - |
-| `BillingCity` | `*string` | Optional | - |
-| `BillingState` | `*string` | Optional | - |
-| `BillingZip` | `*string` | Optional | - |
-| `BillingCountry` | `*string` | Optional | - |
-| `CustomerVaultToken` | `Optional[string]` | Optional | - |
-| `BillingAddress2` | `*string` | Optional | - |
-| `BankName` | `*string` | Optional | - |
-| `MaskedBankRoutingNumber` | `*string` | Optional | - |
-| `MaskedBankAccountNumber` | `*string` | Optional | - |
-| `BankAccountType` | `*string` | Optional | - |
-| `BankAccountHolderType` | `*string` | Optional | - |
-| `PaymentType` | `*string` | Optional | - |
-| `SiteGatewaySettingId` | `*int` | Optional | - |
-| `GatewayHandle` | `*string` | Optional | - |
-
-## Example (as JSON)
-
-```json
-{
- "id": 56,
- "first_name": "first_name6",
- "last_name": "last_name4",
- "customer_id": 94,
- "current_vault": "bogus"
-}
-```
-
diff --git a/doc/models/list-payment-profiles-response.md b/doc/models/list-payment-profiles-response.md
deleted file mode 100644
index 064ab58a..00000000
--- a/doc/models/list-payment-profiles-response.md
+++ /dev/null
@@ -1,27 +0,0 @@
-
-# List Payment Profiles Response
-
-## Structure
-
-`ListPaymentProfilesResponse`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `PaymentProfile` | [`*models.ListPaymentProfileItem`](../../doc/models/list-payment-profile-item.md) | Optional | - |
-
-## Example (as JSON)
-
-```json
-{
- "payment_profile": {
- "id": 44,
- "first_name": "first_name4",
- "last_name": "last_name2",
- "customer_id": 82,
- "current_vault": "eway"
- }
-}
-```
-
diff --git a/doc/models/nested-error-response-exception.md b/doc/models/nested-error-response-exception.md
deleted file mode 100644
index fe53f820..00000000
--- a/doc/models/nested-error-response-exception.md
+++ /dev/null
@@ -1,30 +0,0 @@
-
-# Nested Error Response Exception
-
-## Structure
-
-`NestedErrorResponseException`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `Errors` | `map[string]interface{}` | Optional | - |
-
-## Example (as JSON)
-
-```json
-{
- "errors": {
- "key0": {
- "key1": "val1",
- "key2": "val2"
- },
- "key1": {
- "key1": "val1",
- "key2": "val2"
- }
- }
-}
-```
-
diff --git a/doc/models/payment-profile-response.md b/doc/models/payment-profile-response.md
index d2e4e28d..240afb48 100644
--- a/doc/models/payment-profile-response.md
+++ b/doc/models/payment-profile-response.md
@@ -9,33 +9,15 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `PaymentProfile` | [`models.PaymentProfile`](../../doc/models/payment-profile.md) | Required | - |
+| `PaymentProfile` | `interface{}` | Required | - |
## Example (as JSON)
```json
{
"payment_profile": {
- "id": 10088716,
- "first_name": "Test",
- "last_name": "Subscription",
- "masked_card_number": "XXXX-XXXX-XXXX-1",
- "card_type": "bogus",
- "expiration_month": 1,
- "expiration_year": 2022,
- "customer_id": 14543792,
- "current_vault": "bogus",
- "vault_token": "1",
- "billing_address": "123 Montana Way",
- "billing_city": "Billings",
- "billing_state": "MT",
- "billing_zip": "59101",
- "billing_country": "US",
- "customer_vault_token": null,
- "billing_address_2": "",
- "payment_type": "credit_card",
- "site_gateway_setting_id": 1,
- "gateway_handle": null
+ "key1": "val1",
+ "key2": "val2"
}
}
```
diff --git a/doc/models/price-point.md b/doc/models/price-point.md
index 9f8afc78..78bef318 100644
--- a/doc/models/price-point.md
+++ b/doc/models/price-point.md
@@ -14,6 +14,7 @@
| `PricingScheme` | [`*models.PricingScheme`](../../doc/models/pricing-scheme.md) | Optional | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. |
| `Prices` | [`[]models.Price`](../../doc/models/price.md) | Optional | - |
| `UseSiteExchangeRate` | `*bool` | Optional | Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site.
**Default**: `true` |
+| `TaxIncluded` | `*bool` | Optional | Whether or not the price point includes tax |
| `Interval` | `*int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. |
| `IntervalUnit` | [`*models.IntervalUnit`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this price point, either month or day. This property is only available for sites with Multifrequency enabled. |
| `OveragePricing` | [`*models.OveragePricing`](../../doc/models/overage-pricing.md) | Optional | - |
diff --git a/doc/models/product-price-point.md b/doc/models/product-price-point.md
index b8e73141..fb3837a0 100644
--- a/doc/models/product-price-point.md
+++ b/doc/models/product-price-point.md
@@ -32,6 +32,7 @@
| `Type` | [`*models.PricePointType`](../../doc/models/price-point-type.md) | Optional | The type of price point |
| `TaxIncluded` | `*bool` | Optional | Whether or not the price point includes tax |
| `SubscriptionId` | `Optional[int]` | Optional | The subscription id this price point belongs to |
+| `CurrencyPrices` | [`[]models.CurrencyPrice`](../../doc/models/currency-price.md) | Optional | An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter. |
## Example (as JSON)
diff --git a/doc/models/read-payment-profile-response.md b/doc/models/read-payment-profile-response.md
deleted file mode 100644
index 86aa34d6..00000000
--- a/doc/models/read-payment-profile-response.md
+++ /dev/null
@@ -1,24 +0,0 @@
-
-# Read Payment Profile Response
-
-## Structure
-
-`ReadPaymentProfileResponse`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `PaymentProfile` | `interface{}` | Required | - |
-
-## Example (as JSON)
-
-```json
-{
- "payment_profile": {
- "key1": "val1",
- "key2": "val2"
- }
-}
-```
-
diff --git a/doc/models/subscription-bank-account.md b/doc/models/subscription-bank-account.md
deleted file mode 100644
index e5d32a3d..00000000
--- a/doc/models/subscription-bank-account.md
+++ /dev/null
@@ -1,45 +0,0 @@
-
-# Subscription Bank Account
-
-## Structure
-
-`SubscriptionBankAccount`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `BankAccountHolderType` | `*string` | Optional | Defaults to personal |
-| `BankAccountType` | `*string` | Optional | Defaults to checking |
-| `BankName` | `*string` | Optional | The bank where the account resides |
-| `BillingAddress` | `*string` | Optional | The current billing street address for the bank account |
-| `BillingAddress2` | `*string` | Optional | The current billing street address, second line, for the bank account |
-| `BillingCity` | `*string` | Optional | The current billing address city for the bank account |
-| `BillingState` | `*string` | Optional | The current billing address state for the bank account |
-| `BillingZip` | `*string` | Optional | The current billing address zip code for the bank account |
-| `BillingCountry` | `*string` | Optional | The current billing address country for the bank account |
-| `CurrentVault` | [`*models.BankAccountVault`](../../doc/models/bank-account-vault.md) | Optional | The vault that stores the payment profile with the provided vault_token. |
-| `CustomerId` | `*int` | Optional | The Chargify-assigned id for the customer record to which the bank account belongs |
-| `CustomerVaultToken` | `*string` | Optional | (only for Authorize.Net CIM storage): the customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token |
-| `FirstName` | `*string` | Optional | The first name of the bank account holder |
-| `LastName` | `*string` | Optional | The last name of the bank account holder |
-| `Id` | `*int` | Optional | The Chargify-assigned ID of the stored bank account. This value can be used as an input to payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the same customer |
-| `MaskedBankAccountNumber` | `*string` | Optional | A string representation of the stored bank account number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’) |
-| `MaskedBankRoutingNumber` | `*string` | Optional | A string representation of the stored bank routing number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’). payment_type will be bank_account |
-| `VaultToken` | `*string` | Optional | The “token” provided by your vault storage for an already stored payment profile |
-| `ChargifyToken` | `*string` | Optional | Token received after sending billing informations using chargify.js. This token will only be received if passed as a sole attribute of credit_card_attributes (i.e. tok_9g6hw85pnpt6knmskpwp4ttt) |
-| `SiteGatewaySettingId` | `*int` | Optional | - |
-| `GatewayHandle` | `*string` | Optional | - |
-
-## Example (as JSON)
-
-```json
-{
- "bank_account_holder_type": "bank_account_holder_type4",
- "bank_account_type": "bank_account_type4",
- "bank_name": "bank_name8",
- "billing_address": "billing_address8",
- "billing_address_2": "billing_address_28"
-}
-```
-
diff --git a/doc/models/subscription-group-bank-account.md b/doc/models/subscription-group-bank-account.md
index de1cf186..5b687c42 100644
--- a/doc/models/subscription-group-bank-account.md
+++ b/doc/models/subscription-group-bank-account.md
@@ -14,9 +14,9 @@
| `BankRoutingNumber` | `*string` | Optional | (Required when creating a subscription with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API |
| `BankIban` | `*string` | Optional | (Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided |
| `BankBranchCode` | `*string` | Optional | (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be provided |
-| `BankAccountType` | [`*models.BankAccountType`](../../doc/models/bank-account-type.md) | Optional | **Default**: `"checking"` |
-| `BankAccountHolderType` | [`*models.HolderType`](../../doc/models/holder-type.md) | Optional | - |
-| `PaymentType` | `*string` | Optional | - |
+| `BankAccountType` | [`*models.BankAccountType`](../../doc/models/bank-account-type.md) | Optional | Defaults to checking
**Default**: `"checking"` |
+| `BankAccountHolderType` | [`*models.BankAccountHolderType`](../../doc/models/bank-account-holder-type.md) | Optional | Defaults to personal |
+| `PaymentType` | [`*models.PaymentType`](../../doc/models/payment-type.md) | Optional | **Default**: `"credit_card"` |
| `BillingAddress` | `*string` | Optional | - |
| `BillingCity` | `*string` | Optional | - |
| `BillingState` | `*string` | Optional | - |
@@ -31,6 +31,7 @@
```json
{
"bank_account_type": "checking",
+ "payment_type": "credit_card",
"bank_name": "bank_name2",
"bank_account_number": "bank_account_number4",
"bank_routing_number": "bank_routing_number8",
diff --git a/doc/models/subscription-group-credit-card.md b/doc/models/subscription-group-credit-card.md
index 29fe96ee..f3c4b4eb 100644
--- a/doc/models/subscription-group-credit-card.md
+++ b/doc/models/subscription-group-credit-card.md
@@ -25,7 +25,7 @@
| `BillingZip` | `*string` | Optional | - |
| `BillingCountry` | `*string` | Optional | - |
| `LastFour` | `*string` | Optional | - |
-| `CardType` | `*string` | Optional | - |
+| `CardType` | [`*models.CardType`](../../doc/models/card-type.md) | Optional | The type of card used. |
| `CustomerVaultToken` | `*string` | Optional | - |
| `Cvv` | `*string` | Optional | - |
| `PaymentType` | `*string` | Optional | - |
@@ -39,7 +39,6 @@
"key2": "val2"
},
"chargify_token": "tok_592nf92ng0sjd4300p",
- "card_type": "visa",
"expiration_month": {
"key1": "val1",
"key2": "val2"
diff --git a/doc/models/subscription-included-coupon.md b/doc/models/subscription-included-coupon.md
index 7f0578bf..f9f707c0 100644
--- a/doc/models/subscription-included-coupon.md
+++ b/doc/models/subscription-included-coupon.md
@@ -14,7 +14,7 @@
| `UsesAllowed` | `*int` | Optional | - |
| `ExpiresAt` | `Optional[string]` | Optional | - |
| `Recurring` | `*bool` | Optional | - |
-| `AmountInCents` | `Optional[int64]` | Optional | - |
+| `AmountInCents` | `Optional[int64]` | Optional | **Constraints**: `>= 0` |
| `Percentage` | `Optional[string]` | Optional | - |
## Example (as JSON)
diff --git a/doc/models/subscription.md b/doc/models/subscription.md
index 131e9ba5..00bee4b3 100644
--- a/doc/models/subscription.md
+++ b/doc/models/subscription.md
@@ -37,9 +37,9 @@
| `PaymentCollectionMethod` | [`*models.PaymentCollectionMethod`](../../doc/models/payment-collection-method.md) | Optional | The type of payment collection to be used in the subscription. For legacy Statements Architecture valid options are - `invoice`, `automatic`. For current Relationship Invoicing Architecture valid options are - `remittance`, `automatic`, `prepaid`.
**Default**: `"automatic"` |
| `Customer` | [`*models.Customer`](../../doc/models/customer.md) | Optional | - |
| `Product` | [`*models.Product`](../../doc/models/product.md) | Optional | - |
-| `CreditCard` | [`*models.PaymentProfile`](../../doc/models/payment-profile.md) | Optional | - |
+| `CreditCard` | [`*models.CreditCardPaymentProfile`](../../doc/models/credit-card-payment-profile.md) | Optional | - |
| `Group` | [`Optional[models.NestedSubscriptionGroup]`](../../doc/models/nested-subscription-group.md) | Optional | - |
-| `BankAccount` | [`*models.SubscriptionBankAccount`](../../doc/models/subscription-bank-account.md) | Optional | - |
+| `BankAccount` | [`*models.BankAccountPaymentProfile`](../../doc/models/bank-account-payment-profile.md) | Optional | - |
| `PaymentType` | `Optional[string]` | Optional | The payment profile type for the active profile on file. |
| `ReferralCode` | `Optional[string]` | Optional | The subscription's unique code that can be given to referrals. |
| `NextProductId` | `Optional[int]` | Optional | If a delayed product change is scheduled, the ID of the product that the subscription will be changed to at the next renewal. |
diff --git a/doc/models/update-component-price-point-request.md b/doc/models/update-component-price-point-request.md
index a8f37354..2be8bc1e 100644
--- a/doc/models/update-component-price-point-request.md
+++ b/doc/models/update-component-price-point-request.md
@@ -17,31 +17,10 @@
{
"price_point": {
"name": "name0",
- "interval": 44,
- "interval_unit": "day",
- "prices": [
- {
- "id": 18,
- "ending_quantity": 38,
- "unit_price": 88,
- "_destroy": "_destroy4",
- "starting_quantity": 64
- },
- {
- "id": 18,
- "ending_quantity": 38,
- "unit_price": 88,
- "_destroy": "_destroy4",
- "starting_quantity": 64
- },
- {
- "id": 18,
- "ending_quantity": 38,
- "unit_price": 88,
- "_destroy": "_destroy4",
- "starting_quantity": 64
- }
- ]
+ "handle": "handle6",
+ "pricing_scheme": "per_unit",
+ "use_site_exchange_rate": false,
+ "tax_included": false
}
}
```
diff --git a/doc/models/update-component-price-point.md b/doc/models/update-component-price-point.md
index 9e5915a9..a5bfdc11 100644
--- a/doc/models/update-component-price-point.md
+++ b/doc/models/update-component-price-point.md
@@ -10,6 +10,10 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `Name` | `*string` | Optional | - |
+| `Handle` | `*string` | Optional | - |
+| `PricingScheme` | [`*models.PricingScheme`](../../doc/models/pricing-scheme.md) | Optional | The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes. |
+| `UseSiteExchangeRate` | `*bool` | Optional | Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site. |
+| `TaxIncluded` | `*bool` | Optional | Whether or not the price point includes tax |
| `Interval` | `*int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. |
| `IntervalUnit` | [`*models.IntervalUnit`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled. |
| `Prices` | [`[]models.UpdatePrice`](../../doc/models/update-price.md) | Optional | - |
@@ -19,24 +23,10 @@
```json
{
"name": "name2",
- "interval": 216,
- "interval_unit": "day",
- "prices": [
- {
- "id": 18,
- "ending_quantity": 38,
- "unit_price": 88,
- "_destroy": "_destroy4",
- "starting_quantity": 64
- },
- {
- "id": 18,
- "ending_quantity": 38,
- "unit_price": 88,
- "_destroy": "_destroy4",
- "starting_quantity": 64
- }
- ]
+ "handle": "handle8",
+ "pricing_scheme": "per_unit",
+ "use_site_exchange_rate": false,
+ "tax_included": false
}
```
diff --git a/doc/models/update-payment-profile-request.md b/doc/models/update-payment-profile-request.md
index 46a7580a..615013e4 100644
--- a/doc/models/update-payment-profile-request.md
+++ b/doc/models/update-payment-profile-request.md
@@ -19,7 +19,7 @@
"full_number": "5424000000000015",
"first_name": "first_name4",
"last_name": "last_name2",
- "card_type": "discover",
+ "card_type": "bogus",
"expiration_month": "expiration_month0"
}
}
diff --git a/doc/models/update-payment-profile-response.md b/doc/models/update-payment-profile-response.md
deleted file mode 100644
index deb7230e..00000000
--- a/doc/models/update-payment-profile-response.md
+++ /dev/null
@@ -1,27 +0,0 @@
-
-# Update Payment Profile Response
-
-## Structure
-
-`UpdatePaymentProfileResponse`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `PaymentProfile` | [`models.UpdatedPaymentProfile`](../../doc/models/updated-payment-profile.md) | Required | - |
-
-## Example (as JSON)
-
-```json
-{
- "payment_profile": {
- "id": 44,
- "first_name": "first_name4",
- "last_name": "last_name2",
- "card_type": "card_type0",
- "expiration_month": 38
- }
-}
-```
-
diff --git a/doc/models/update-payment-profile.md b/doc/models/update-payment-profile.md
index 9eaec5f6..9be5bc01 100644
--- a/doc/models/update-payment-profile.md
+++ b/doc/models/update-payment-profile.md
@@ -30,7 +30,7 @@
"full_number": "5424000000000015",
"first_name": "first_name2",
"last_name": "last_name0",
- "card_type": "switch",
+ "card_type": "carnet",
"expiration_month": "expiration_month2"
}
```
diff --git a/doc/models/update-price.md b/doc/models/update-price.md
index a650c64d..acceeb39 100644
--- a/doc/models/update-price.md
+++ b/doc/models/update-price.md
@@ -10,20 +10,29 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `Id` | `*int` | Optional | - |
-| `EndingQuantity` | `*int` | Optional | - |
-| `UnitPrice` | `*int` | Optional | - |
-| `Destroy` | `*string` | Optional | - |
-| `StartingQuantity` | `*int` | Optional | - |
+| `EndingQuantity` | `*interface{}` | Optional | - |
+| `UnitPrice` | `*interface{}` | Optional | The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065 |
+| `Destroy` | `*bool` | Optional | - |
+| `StartingQuantity` | `*interface{}` | Optional | - |
## Example (as JSON)
```json
{
"id": 18,
- "ending_quantity": 38,
- "unit_price": 88,
- "_destroy": "_destroy0",
- "starting_quantity": 64
+ "ending_quantity": {
+ "key1": "val1",
+ "key2": "val2"
+ },
+ "unit_price": {
+ "key1": "val1",
+ "key2": "val2"
+ },
+ "_destroy": false,
+ "starting_quantity": {
+ "key1": "val1",
+ "key2": "val2"
+ }
}
```
diff --git a/doc/models/updated-payment-profile.md b/doc/models/updated-payment-profile.md
deleted file mode 100644
index 7d5d74f0..00000000
--- a/doc/models/updated-payment-profile.md
+++ /dev/null
@@ -1,44 +0,0 @@
-
-# Updated Payment Profile
-
-## Structure
-
-`UpdatedPaymentProfile`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `Id` | `*int` | Optional | - |
-| `FirstName` | `*string` | Optional | - |
-| `LastName` | `*string` | Optional | - |
-| `CardType` | `*string` | Optional | - |
-| `ExpirationMonth` | `*int` | Optional | - |
-| `ExpirationYear` | `*int` | Optional | - |
-| `CustomerId` | `*int` | Optional | - |
-| `CurrentVault` | [`*models.CurrentVault`](../../doc/models/current-vault.md) | Optional | The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing. |
-| `VaultToken` | `*string` | Optional | - |
-| `BillingAddress` | `*string` | Optional | - |
-| `BillingAddress2` | `*string` | Optional | - |
-| `BillingCity` | `*string` | Optional | - |
-| `BillingState` | `*string` | Optional | - |
-| `BillingZip` | `*string` | Optional | - |
-| `BillingCountry` | `*string` | Optional | - |
-| `PaymentType` | `*string` | Optional | - |
-| `SiteGatewaySettingId` | `*int` | Optional | - |
-| `GatewayHandle` | `Optional[string]` | Optional | - |
-| `MaskedCardNumber` | `*string` | Optional | - |
-| `CustomerVaultToken` | `Optional[string]` | Optional | - |
-
-## Example (as JSON)
-
-```json
-{
- "id": 232,
- "first_name": "first_name0",
- "last_name": "last_name8",
- "card_type": "card_type4",
- "expiration_month": 150
-}
-```
-
diff --git a/doc/models/usage.md b/doc/models/usage.md
index a0c0c581..169bfdfa 100644
--- a/doc/models/usage.md
+++ b/doc/models/usage.md
@@ -9,7 +9,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `Id` | `*int` | Optional | - |
+| `Id` | `*int64` | Optional | **Constraints**: `>= 0` |
| `Memo` | `*string` | Optional | - |
| `CreatedAt` | `*time.Time` | Optional | - |
| `PricePointId` | `*int` | Optional | - |
diff --git a/errors/errors.go b/errors/errors.go
index 85c76ea1..cc09b332 100644
--- a/errors/errors.go
+++ b/errors/errors.go
@@ -139,6 +139,31 @@ func (s *SingleErrorResponse) Error() string {
return fmt.Sprintf("SingleErrorResponse occured %v", s.Body)
}
+// ErrorArrayMapResponse is a custom error.
+type ErrorArrayMapResponse struct {
+ apiError.ApiError
+ Errors map[string]interface{} `json:"errors,omitempty"`
+}
+
+// NewErrorArrayMapResponse is a constructor for ErrorArrayMapResponse.
+// It creates and returns a pointer to a new ErrorArrayMapResponse instance with the given statusCode and body.
+func NewErrorArrayMapResponse(
+ statusCode int,
+ body string) *ErrorArrayMapResponse {
+ return &ErrorArrayMapResponse{
+ ApiError: apiError.ApiError{
+ StatusCode: statusCode,
+ Body: body,
+ },
+ }
+}
+
+// Error implements the Error method for the error interface.
+// It returns a formatted error message for ErrorArrayMapResponse.
+func (e *ErrorArrayMapResponse) Error() string {
+ return fmt.Sprintf("ErrorArrayMapResponse occured %v", e.Body)
+}
+
// ProductPricePointErrorResponse is a custom error.
type ProductPricePointErrorResponse struct {
apiError.ApiError
@@ -164,18 +189,18 @@ func (p *ProductPricePointErrorResponse) Error() string {
return fmt.Sprintf("ProductPricePointErrorResponse occured %v", p.Body)
}
-// ErrorMapResponse is a custom error.
-type ErrorMapResponse struct {
+// ErrorStringMapResponse is a custom error.
+type ErrorStringMapResponse struct {
apiError.ApiError
- Errors map[string]interface{} `json:"errors,omitempty"`
+ Errors map[string]string `json:"errors,omitempty"`
}
-// NewErrorMapResponse is a constructor for ErrorMapResponse.
-// It creates and returns a pointer to a new ErrorMapResponse instance with the given statusCode and body.
-func NewErrorMapResponse(
+// NewErrorStringMapResponse is a constructor for ErrorStringMapResponse.
+// It creates and returns a pointer to a new ErrorStringMapResponse instance with the given statusCode and body.
+func NewErrorStringMapResponse(
statusCode int,
- body string) *ErrorMapResponse {
- return &ErrorMapResponse{
+ body string) *ErrorStringMapResponse {
+ return &ErrorStringMapResponse{
ApiError: apiError.ApiError{
StatusCode: statusCode,
Body: body,
@@ -184,9 +209,9 @@ func NewErrorMapResponse(
}
// Error implements the Error method for the error interface.
-// It returns a formatted error message for ErrorMapResponse.
-func (e *ErrorMapResponse) Error() string {
- return fmt.Sprintf("ErrorMapResponse occured %v", e.Body)
+// It returns a formatted error message for ErrorStringMapResponse.
+func (e *ErrorStringMapResponse) Error() string {
+ return fmt.Sprintf("ErrorStringMapResponse occured %v", e.Body)
}
// ComponentPricePointError is a custom error.
@@ -264,31 +289,6 @@ func (s *SubscriptionComponentAllocationError) Error() string {
return fmt.Sprintf("SubscriptionComponentAllocationError occured %v", s.Body)
}
-// NestedErrorResponse is a custom error.
-type NestedErrorResponse struct {
- apiError.ApiError
- Errors map[string]interface{} `json:"errors,omitempty"`
-}
-
-// NewNestedErrorResponse is a constructor for NestedErrorResponse.
-// It creates and returns a pointer to a new NestedErrorResponse instance with the given statusCode and body.
-func NewNestedErrorResponse(
- statusCode int,
- body string) *NestedErrorResponse {
- return &NestedErrorResponse{
- ApiError: apiError.ApiError{
- StatusCode: statusCode,
- Body: body,
- },
- }
-}
-
-// Error implements the Error method for the error interface.
-// It returns a formatted error message for NestedErrorResponse.
-func (n *NestedErrorResponse) Error() string {
- return fmt.Sprintf("NestedErrorResponse occured %v", n.Body)
-}
-
// SubscriptionGroupSignupErrorResponse is a custom error.
type SubscriptionGroupSignupErrorResponse struct {
apiError.ApiError
diff --git a/invoices_controller.go b/invoices_controller.go
index e1f05abf..9d9286cf 100644
--- a/invoices_controller.go
+++ b/invoices_controller.go
@@ -829,7 +829,7 @@ func (i *InvoicesController) CreateInvoice(
}
if resp.StatusCode == 422 {
- err = errors.NewNestedErrorResponse(422, "Unprocessable Entity (WebDAV)")
+ err = errors.NewErrorArrayMapResponse(422, "Unprocessable Entity (WebDAV)")
}
return models.NewApiResponse(result, resp), err
}
diff --git a/models/bank_account.go b/models/bank_account.go
deleted file mode 100644
index 5d65d8be..00000000
--- a/models/bank_account.go
+++ /dev/null
@@ -1,170 +0,0 @@
-package models
-
-import (
- "encoding/json"
-)
-
-// BankAccount represents a BankAccount struct.
-type BankAccount struct {
- Id *int `json:"id,omitempty"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- CustomerId *int `json:"customer_id,omitempty"`
- // The vault that stores the payment profile with the provided vault_token.
- CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- CustomerVaultToken Optional[string] `json:"customer_vault_token"`
- BillingAddress2 *string `json:"billing_address_2,omitempty"`
- BankName *string `json:"bank_name,omitempty"`
- MaskedBankRoutingNumber *string `json:"masked_bank_routing_number,omitempty"`
- MaskedBankAccountNumber *string `json:"masked_bank_account_number,omitempty"`
- BankAccountType *string `json:"bank_account_type,omitempty"`
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
- PaymentType *string `json:"payment_type,omitempty"`
- // denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account
- Verified *bool `json:"verified,omitempty"`
- SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
- GatewayHandle *string `json:"gateway_handle,omitempty"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for BankAccount.
-// It customizes the JSON marshaling process for BankAccount objects.
-func (b *BankAccount) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(b.toMap())
-}
-
-// toMap converts the BankAccount object to a map representation for JSON marshaling.
-func (b *BankAccount) toMap() map[string]any {
- structMap := make(map[string]any)
- if b.Id != nil {
- structMap["id"] = b.Id
- }
- if b.FirstName != nil {
- structMap["first_name"] = b.FirstName
- }
- if b.LastName != nil {
- structMap["last_name"] = b.LastName
- }
- if b.CustomerId != nil {
- structMap["customer_id"] = b.CustomerId
- }
- if b.CurrentVault != nil {
- structMap["current_vault"] = b.CurrentVault
- }
- if b.VaultToken != nil {
- structMap["vault_token"] = b.VaultToken
- }
- if b.BillingAddress != nil {
- structMap["billing_address"] = b.BillingAddress
- }
- if b.BillingCity != nil {
- structMap["billing_city"] = b.BillingCity
- }
- if b.BillingState != nil {
- structMap["billing_state"] = b.BillingState
- }
- if b.BillingZip != nil {
- structMap["billing_zip"] = b.BillingZip
- }
- if b.BillingCountry != nil {
- structMap["billing_country"] = b.BillingCountry
- }
- if b.CustomerVaultToken.IsValueSet() {
- structMap["customer_vault_token"] = b.CustomerVaultToken.Value()
- }
- if b.BillingAddress2 != nil {
- structMap["billing_address_2"] = b.BillingAddress2
- }
- if b.BankName != nil {
- structMap["bank_name"] = b.BankName
- }
- if b.MaskedBankRoutingNumber != nil {
- structMap["masked_bank_routing_number"] = b.MaskedBankRoutingNumber
- }
- if b.MaskedBankAccountNumber != nil {
- structMap["masked_bank_account_number"] = b.MaskedBankAccountNumber
- }
- if b.BankAccountType != nil {
- structMap["bank_account_type"] = b.BankAccountType
- }
- if b.BankAccountHolderType != nil {
- structMap["bank_account_holder_type"] = b.BankAccountHolderType
- }
- if b.PaymentType != nil {
- structMap["payment_type"] = b.PaymentType
- }
- if b.Verified != nil {
- structMap["verified"] = b.Verified
- }
- if b.SiteGatewaySettingId != nil {
- structMap["site_gateway_setting_id"] = b.SiteGatewaySettingId
- }
- if b.GatewayHandle != nil {
- structMap["gateway_handle"] = b.GatewayHandle
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for BankAccount.
-// It customizes the JSON unmarshaling process for BankAccount objects.
-func (b *BankAccount) UnmarshalJSON(input []byte) error {
- temp := &struct {
- Id *int `json:"id,omitempty"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- CustomerId *int `json:"customer_id,omitempty"`
- CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- CustomerVaultToken Optional[string] `json:"customer_vault_token"`
- BillingAddress2 *string `json:"billing_address_2,omitempty"`
- BankName *string `json:"bank_name,omitempty"`
- MaskedBankRoutingNumber *string `json:"masked_bank_routing_number,omitempty"`
- MaskedBankAccountNumber *string `json:"masked_bank_account_number,omitempty"`
- BankAccountType *string `json:"bank_account_type,omitempty"`
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
- PaymentType *string `json:"payment_type,omitempty"`
- Verified *bool `json:"verified,omitempty"`
- SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
- GatewayHandle *string `json:"gateway_handle,omitempty"`
- }{}
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
-
- b.Id = temp.Id
- b.FirstName = temp.FirstName
- b.LastName = temp.LastName
- b.CustomerId = temp.CustomerId
- b.CurrentVault = temp.CurrentVault
- b.VaultToken = temp.VaultToken
- b.BillingAddress = temp.BillingAddress
- b.BillingCity = temp.BillingCity
- b.BillingState = temp.BillingState
- b.BillingZip = temp.BillingZip
- b.BillingCountry = temp.BillingCountry
- b.CustomerVaultToken = temp.CustomerVaultToken
- b.BillingAddress2 = temp.BillingAddress2
- b.BankName = temp.BankName
- b.MaskedBankRoutingNumber = temp.MaskedBankRoutingNumber
- b.MaskedBankAccountNumber = temp.MaskedBankAccountNumber
- b.BankAccountType = temp.BankAccountType
- b.BankAccountHolderType = temp.BankAccountHolderType
- b.PaymentType = temp.PaymentType
- b.Verified = temp.Verified
- b.SiteGatewaySettingId = temp.SiteGatewaySettingId
- b.GatewayHandle = temp.GatewayHandle
- return nil
-}
diff --git a/models/bank_account_attributes.go b/models/bank_account_attributes.go
index d84b02a5..1d2ef949 100644
--- a/models/bank_account_attributes.go
+++ b/models/bank_account_attributes.go
@@ -6,25 +6,27 @@ import (
// BankAccountAttributes represents a BankAccountAttributes struct.
type BankAccountAttributes struct {
- ChargifyToken *string `json:"chargify_token,omitempty"`
+ ChargifyToken *string `json:"chargify_token,omitempty"`
// (Required when creating a subscription with ACH or GoCardless) The name of the bank where the customer’s account resides
- BankName *string `json:"bank_name,omitempty"`
+ BankName *string `json:"bank_name,omitempty"`
// (Required when creating a subscription with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API
- BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
+ BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
// (Required when creating a subscription with ACH. Required when creating a subscription with GoCardless and bank_iban is blank) The customerʼs bank account number
- BankAccountNumber *string `json:"bank_account_number,omitempty"`
- BankAccountType *string `json:"bank_account_type,omitempty"`
+ BankAccountNumber *string `json:"bank_account_number,omitempty"`
+ // Defaults to checking
+ BankAccountType *BankAccountType `json:"bank_account_type,omitempty"`
// (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be provided
- BankBranchCode *string `json:"bank_branch_code,omitempty"`
+ BankBranchCode *string `json:"bank_branch_code,omitempty"`
// (Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided
- BankIban *string `json:"bank_iban,omitempty"`
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
- PaymentType *string `json:"payment_type,omitempty"`
+ BankIban *string `json:"bank_iban,omitempty"`
+ // Defaults to personal
+ BankAccountHolderType *BankAccountHolderType `json:"bank_account_holder_type,omitempty"`
+ PaymentType *PaymentType `json:"payment_type,omitempty"`
// The vault that stores the payment profile with the provided vault_token.
- CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
+ CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
+ VaultToken *string `json:"vault_token,omitempty"`
// (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token
- CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
+ CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
}
// MarshalJSON implements the json.Marshaler interface for BankAccountAttributes.
@@ -81,18 +83,18 @@ func (b *BankAccountAttributes) toMap() map[string]any {
// It customizes the JSON unmarshaling process for BankAccountAttributes objects.
func (b *BankAccountAttributes) UnmarshalJSON(input []byte) error {
temp := &struct {
- ChargifyToken *string `json:"chargify_token,omitempty"`
- BankName *string `json:"bank_name,omitempty"`
- BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
- BankAccountNumber *string `json:"bank_account_number,omitempty"`
- BankAccountType *string `json:"bank_account_type,omitempty"`
- BankBranchCode *string `json:"bank_branch_code,omitempty"`
- BankIban *string `json:"bank_iban,omitempty"`
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
- PaymentType *string `json:"payment_type,omitempty"`
- CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
- CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
+ ChargifyToken *string `json:"chargify_token,omitempty"`
+ BankName *string `json:"bank_name,omitempty"`
+ BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
+ BankAccountNumber *string `json:"bank_account_number,omitempty"`
+ BankAccountType *BankAccountType `json:"bank_account_type,omitempty"`
+ BankBranchCode *string `json:"bank_branch_code,omitempty"`
+ BankIban *string `json:"bank_iban,omitempty"`
+ BankAccountHolderType *BankAccountHolderType `json:"bank_account_holder_type,omitempty"`
+ PaymentType *PaymentType `json:"payment_type,omitempty"`
+ CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
+ VaultToken *string `json:"vault_token,omitempty"`
+ CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
}{}
err := json.Unmarshal(input, &temp)
if err != nil {
diff --git a/models/bank_account_payment_profile.go b/models/bank_account_payment_profile.go
new file mode 100644
index 00000000..9e38f11c
--- /dev/null
+++ b/models/bank_account_payment_profile.go
@@ -0,0 +1,183 @@
+package models
+
+import (
+ "encoding/json"
+)
+
+// BankAccountPaymentProfile represents a BankAccountPaymentProfile struct.
+type BankAccountPaymentProfile struct {
+ // The Chargify-assigned ID of the stored bank account. This value can be used as an input to payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the same customer
+ Id *int `json:"id,omitempty"`
+ // The first name of the bank account holder
+ FirstName *string `json:"first_name,omitempty"`
+ // The last name of the bank account holder
+ LastName *string `json:"last_name,omitempty"`
+ // The Chargify-assigned id for the customer record to which the bank account belongs
+ CustomerId *int `json:"customer_id,omitempty"`
+ // The vault that stores the payment profile with the provided vault_token.
+ CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
+ // The “token” provided by your vault storage for an already stored payment profile
+ VaultToken *string `json:"vault_token,omitempty"`
+ // The current billing street address for the bank account
+ BillingAddress Optional[string] `json:"billing_address"`
+ // The current billing address city for the bank account
+ BillingCity Optional[string] `json:"billing_city"`
+ // The current billing address state for the bank account
+ BillingState Optional[string] `json:"billing_state"`
+ // The current billing address zip code for the bank account
+ BillingZip Optional[string] `json:"billing_zip"`
+ // The current billing address country for the bank account
+ BillingCountry Optional[string] `json:"billing_country"`
+ // (only for Authorize.Net CIM storage): the customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token.
+ CustomerVaultToken Optional[string] `json:"customer_vault_token"`
+ // The current billing street address, second line, for the bank account
+ BillingAddress2 Optional[string] `json:"billing_address_2"`
+ // The bank where the account resides
+ BankName *string `json:"bank_name,omitempty"`
+ // A string representation of the stored bank routing number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’). payment_type will be bank_account
+ MaskedBankRoutingNumber string `json:"masked_bank_routing_number"`
+ // A string representation of the stored bank account number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’)
+ MaskedBankAccountNumber string `json:"masked_bank_account_number"`
+ // Defaults to checking
+ BankAccountType *BankAccountType `json:"bank_account_type,omitempty"`
+ // Defaults to personal
+ BankAccountHolderType *BankAccountHolderType `json:"bank_account_holder_type,omitempty"`
+ PaymentType *PaymentType `json:"payment_type,omitempty"`
+ // denotes whether a bank account has been verified by providing the amounts of two small deposits made into the account
+ Verified *bool `json:"verified,omitempty"`
+ SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
+ GatewayHandle Optional[string] `json:"gateway_handle"`
+}
+
+// MarshalJSON implements the json.Marshaler interface for BankAccountPaymentProfile.
+// It customizes the JSON marshaling process for BankAccountPaymentProfile objects.
+func (b *BankAccountPaymentProfile) MarshalJSON() (
+ []byte,
+ error) {
+ return json.Marshal(b.toMap())
+}
+
+// toMap converts the BankAccountPaymentProfile object to a map representation for JSON marshaling.
+func (b *BankAccountPaymentProfile) toMap() map[string]any {
+ structMap := make(map[string]any)
+ if b.Id != nil {
+ structMap["id"] = b.Id
+ }
+ if b.FirstName != nil {
+ structMap["first_name"] = b.FirstName
+ }
+ if b.LastName != nil {
+ structMap["last_name"] = b.LastName
+ }
+ if b.CustomerId != nil {
+ structMap["customer_id"] = b.CustomerId
+ }
+ if b.CurrentVault != nil {
+ structMap["current_vault"] = b.CurrentVault
+ }
+ if b.VaultToken != nil {
+ structMap["vault_token"] = b.VaultToken
+ }
+ if b.BillingAddress.IsValueSet() {
+ structMap["billing_address"] = b.BillingAddress.Value()
+ }
+ if b.BillingCity.IsValueSet() {
+ structMap["billing_city"] = b.BillingCity.Value()
+ }
+ if b.BillingState.IsValueSet() {
+ structMap["billing_state"] = b.BillingState.Value()
+ }
+ if b.BillingZip.IsValueSet() {
+ structMap["billing_zip"] = b.BillingZip.Value()
+ }
+ if b.BillingCountry.IsValueSet() {
+ structMap["billing_country"] = b.BillingCountry.Value()
+ }
+ if b.CustomerVaultToken.IsValueSet() {
+ structMap["customer_vault_token"] = b.CustomerVaultToken.Value()
+ }
+ if b.BillingAddress2.IsValueSet() {
+ structMap["billing_address_2"] = b.BillingAddress2.Value()
+ }
+ if b.BankName != nil {
+ structMap["bank_name"] = b.BankName
+ }
+ structMap["masked_bank_routing_number"] = b.MaskedBankRoutingNumber
+ structMap["masked_bank_account_number"] = b.MaskedBankAccountNumber
+ if b.BankAccountType != nil {
+ structMap["bank_account_type"] = b.BankAccountType
+ }
+ if b.BankAccountHolderType != nil {
+ structMap["bank_account_holder_type"] = b.BankAccountHolderType
+ }
+ if b.PaymentType != nil {
+ structMap["payment_type"] = b.PaymentType
+ }
+ if b.Verified != nil {
+ structMap["verified"] = b.Verified
+ }
+ if b.SiteGatewaySettingId != nil {
+ structMap["site_gateway_setting_id"] = b.SiteGatewaySettingId
+ }
+ if b.GatewayHandle.IsValueSet() {
+ structMap["gateway_handle"] = b.GatewayHandle.Value()
+ }
+ return structMap
+}
+
+// UnmarshalJSON implements the json.Unmarshaler interface for BankAccountPaymentProfile.
+// It customizes the JSON unmarshaling process for BankAccountPaymentProfile objects.
+func (b *BankAccountPaymentProfile) UnmarshalJSON(input []byte) error {
+ temp := &struct {
+ Id *int `json:"id,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
+ CustomerId *int `json:"customer_id,omitempty"`
+ CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
+ VaultToken *string `json:"vault_token,omitempty"`
+ BillingAddress Optional[string] `json:"billing_address"`
+ BillingCity Optional[string] `json:"billing_city"`
+ BillingState Optional[string] `json:"billing_state"`
+ BillingZip Optional[string] `json:"billing_zip"`
+ BillingCountry Optional[string] `json:"billing_country"`
+ CustomerVaultToken Optional[string] `json:"customer_vault_token"`
+ BillingAddress2 Optional[string] `json:"billing_address_2"`
+ BankName *string `json:"bank_name,omitempty"`
+ MaskedBankRoutingNumber string `json:"masked_bank_routing_number"`
+ MaskedBankAccountNumber string `json:"masked_bank_account_number"`
+ BankAccountType *BankAccountType `json:"bank_account_type,omitempty"`
+ BankAccountHolderType *BankAccountHolderType `json:"bank_account_holder_type,omitempty"`
+ PaymentType *PaymentType `json:"payment_type,omitempty"`
+ Verified *bool `json:"verified,omitempty"`
+ SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
+ GatewayHandle Optional[string] `json:"gateway_handle"`
+ }{}
+ err := json.Unmarshal(input, &temp)
+ if err != nil {
+ return err
+ }
+
+ b.Id = temp.Id
+ b.FirstName = temp.FirstName
+ b.LastName = temp.LastName
+ b.CustomerId = temp.CustomerId
+ b.CurrentVault = temp.CurrentVault
+ b.VaultToken = temp.VaultToken
+ b.BillingAddress = temp.BillingAddress
+ b.BillingCity = temp.BillingCity
+ b.BillingState = temp.BillingState
+ b.BillingZip = temp.BillingZip
+ b.BillingCountry = temp.BillingCountry
+ b.CustomerVaultToken = temp.CustomerVaultToken
+ b.BillingAddress2 = temp.BillingAddress2
+ b.BankName = temp.BankName
+ b.MaskedBankRoutingNumber = temp.MaskedBankRoutingNumber
+ b.MaskedBankAccountNumber = temp.MaskedBankAccountNumber
+ b.BankAccountType = temp.BankAccountType
+ b.BankAccountHolderType = temp.BankAccountHolderType
+ b.PaymentType = temp.PaymentType
+ b.Verified = temp.Verified
+ b.SiteGatewaySettingId = temp.SiteGatewaySettingId
+ b.GatewayHandle = temp.GatewayHandle
+ return nil
+}
diff --git a/models/bank_account_response.go b/models/bank_account_response.go
index a9704b34..51a2e41b 100644
--- a/models/bank_account_response.go
+++ b/models/bank_account_response.go
@@ -6,7 +6,7 @@ import (
// BankAccountResponse represents a BankAccountResponse struct.
type BankAccountResponse struct {
- PaymentProfile BankAccount `json:"payment_profile"`
+ PaymentProfile BankAccountPaymentProfile `json:"payment_profile"`
}
// MarshalJSON implements the json.Marshaler interface for BankAccountResponse.
@@ -28,7 +28,7 @@ func (b *BankAccountResponse) toMap() map[string]any {
// It customizes the JSON unmarshaling process for BankAccountResponse objects.
func (b *BankAccountResponse) UnmarshalJSON(input []byte) error {
temp := &struct {
- PaymentProfile BankAccount `json:"payment_profile"`
+ PaymentProfile BankAccountPaymentProfile `json:"payment_profile"`
}{}
err := json.Unmarshal(input, &temp)
if err != nil {
diff --git a/models/component_currency_price.go b/models/component_currency_price.go
new file mode 100644
index 00000000..edd67372
--- /dev/null
+++ b/models/component_currency_price.go
@@ -0,0 +1,72 @@
+package models
+
+import (
+ "encoding/json"
+)
+
+// ComponentCurrencyPrice represents a ComponentCurrencyPrice struct.
+type ComponentCurrencyPrice struct {
+ Id *int `json:"id,omitempty"`
+ Currency *string `json:"currency,omitempty"`
+ Price *string `json:"price,omitempty"`
+ FormattedPrice *string `json:"formatted_price,omitempty"`
+ PriceId *int `json:"price_id,omitempty"`
+ PricePointId *int `json:"price_point_id,omitempty"`
+}
+
+// MarshalJSON implements the json.Marshaler interface for ComponentCurrencyPrice.
+// It customizes the JSON marshaling process for ComponentCurrencyPrice objects.
+func (c *ComponentCurrencyPrice) MarshalJSON() (
+ []byte,
+ error) {
+ return json.Marshal(c.toMap())
+}
+
+// toMap converts the ComponentCurrencyPrice object to a map representation for JSON marshaling.
+func (c *ComponentCurrencyPrice) toMap() map[string]any {
+ structMap := make(map[string]any)
+ if c.Id != nil {
+ structMap["id"] = c.Id
+ }
+ if c.Currency != nil {
+ structMap["currency"] = c.Currency
+ }
+ if c.Price != nil {
+ structMap["price"] = c.Price
+ }
+ if c.FormattedPrice != nil {
+ structMap["formatted_price"] = c.FormattedPrice
+ }
+ if c.PriceId != nil {
+ structMap["price_id"] = c.PriceId
+ }
+ if c.PricePointId != nil {
+ structMap["price_point_id"] = c.PricePointId
+ }
+ return structMap
+}
+
+// UnmarshalJSON implements the json.Unmarshaler interface for ComponentCurrencyPrice.
+// It customizes the JSON unmarshaling process for ComponentCurrencyPrice objects.
+func (c *ComponentCurrencyPrice) UnmarshalJSON(input []byte) error {
+ temp := &struct {
+ Id *int `json:"id,omitempty"`
+ Currency *string `json:"currency,omitempty"`
+ Price *string `json:"price,omitempty"`
+ FormattedPrice *string `json:"formatted_price,omitempty"`
+ PriceId *int `json:"price_id,omitempty"`
+ PricePointId *int `json:"price_point_id,omitempty"`
+ }{}
+ err := json.Unmarshal(input, &temp)
+ if err != nil {
+ return err
+ }
+
+ c.Id = temp.Id
+ c.Currency = temp.Currency
+ c.Price = temp.Price
+ c.FormattedPrice = temp.FormattedPrice
+ c.PriceId = temp.PriceId
+ c.PricePointId = temp.PricePointId
+ return nil
+}
diff --git a/models/component_price_point.go b/models/component_price_point.go
index 76c43aaf..3e49b46f 100644
--- a/models/component_price_point.go
+++ b/models/component_price_point.go
@@ -2,6 +2,8 @@ package models
import (
"encoding/json"
+ "log"
+ "time"
)
// ComponentPricePoint represents a ComponentPricePoint struct.
@@ -19,9 +21,9 @@ type ComponentPricePoint struct {
PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
ComponentId *int `json:"component_id,omitempty"`
Handle *string `json:"handle,omitempty"`
- ArchivedAt Optional[string] `json:"archived_at"`
- CreatedAt *string `json:"created_at,omitempty"`
- UpdatedAt *string `json:"updated_at,omitempty"`
+ ArchivedAt Optional[time.Time] `json:"archived_at"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ UpdatedAt *time.Time `json:"updated_at,omitempty"`
Prices []ComponentPricePointPrice `json:"prices,omitempty"`
// Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site.
UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
@@ -29,9 +31,11 @@ type ComponentPricePoint struct {
SubscriptionId *int `json:"subscription_id,omitempty"`
TaxIncluded *bool `json:"tax_included,omitempty"`
// The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled.
- Interval *int `json:"interval,omitempty"`
+ Interval Optional[int] `json:"interval"`
// A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled.
- IntervalUnit *IntervalUnit `json:"interval_unit,omitempty"`
+ IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
+ // An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter.
+ CurrencyPrices []ComponentCurrencyPrice `json:"currency_prices,omitempty"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentPricePoint.
@@ -67,13 +71,18 @@ func (c *ComponentPricePoint) toMap() map[string]any {
structMap["handle"] = c.Handle
}
if c.ArchivedAt.IsValueSet() {
- structMap["archived_at"] = c.ArchivedAt.Value()
+ var ArchivedAtVal *string = nil
+ if c.ArchivedAt.Value() != nil {
+ val := c.ArchivedAt.Value().Format(time.RFC3339)
+ ArchivedAtVal = &val
+ }
+ structMap["archived_at"] = ArchivedAtVal
}
if c.CreatedAt != nil {
- structMap["created_at"] = c.CreatedAt
+ structMap["created_at"] = c.CreatedAt.Format(time.RFC3339)
}
if c.UpdatedAt != nil {
- structMap["updated_at"] = c.UpdatedAt
+ structMap["updated_at"] = c.UpdatedAt.Format(time.RFC3339)
}
if c.Prices != nil {
structMap["prices"] = c.Prices
@@ -87,11 +96,14 @@ func (c *ComponentPricePoint) toMap() map[string]any {
if c.TaxIncluded != nil {
structMap["tax_included"] = c.TaxIncluded
}
- if c.Interval != nil {
- structMap["interval"] = c.Interval
+ if c.Interval.IsValueSet() {
+ structMap["interval"] = c.Interval.Value()
}
- if c.IntervalUnit != nil {
- structMap["interval_unit"] = c.IntervalUnit
+ if c.IntervalUnit.IsValueSet() {
+ structMap["interval_unit"] = c.IntervalUnit.Value()
+ }
+ if c.CurrencyPrices != nil {
+ structMap["currency_prices"] = c.CurrencyPrices
}
return structMap
}
@@ -114,8 +126,9 @@ func (c *ComponentPricePoint) UnmarshalJSON(input []byte) error {
UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
SubscriptionId *int `json:"subscription_id,omitempty"`
TaxIncluded *bool `json:"tax_included,omitempty"`
- Interval *int `json:"interval,omitempty"`
- IntervalUnit *IntervalUnit `json:"interval_unit,omitempty"`
+ Interval Optional[int] `json:"interval"`
+ IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
+ CurrencyPrices []ComponentCurrencyPrice `json:"currency_prices,omitempty"`
}{}
err := json.Unmarshal(input, &temp)
if err != nil {
@@ -129,14 +142,34 @@ func (c *ComponentPricePoint) UnmarshalJSON(input []byte) error {
c.PricingScheme = temp.PricingScheme
c.ComponentId = temp.ComponentId
c.Handle = temp.Handle
- c.ArchivedAt = temp.ArchivedAt
- c.CreatedAt = temp.CreatedAt
- c.UpdatedAt = temp.UpdatedAt
+ c.ArchivedAt.ShouldSetValue(temp.ArchivedAt.IsValueSet())
+ if temp.ArchivedAt.Value() != nil {
+ ArchivedAtVal, err := time.Parse(time.RFC3339, (*temp.ArchivedAt.Value()))
+ if err != nil {
+ log.Fatalf("Cannot Parse archived_at as % s format.", time.RFC3339)
+ }
+ c.ArchivedAt.SetValue(&ArchivedAtVal)
+ }
+ if temp.CreatedAt != nil {
+ CreatedAtVal, err := time.Parse(time.RFC3339, *temp.CreatedAt)
+ if err != nil {
+ log.Fatalf("Cannot Parse created_at as % s format.", time.RFC3339)
+ }
+ c.CreatedAt = &CreatedAtVal
+ }
+ if temp.UpdatedAt != nil {
+ UpdatedAtVal, err := time.Parse(time.RFC3339, *temp.UpdatedAt)
+ if err != nil {
+ log.Fatalf("Cannot Parse updated_at as % s format.", time.RFC3339)
+ }
+ c.UpdatedAt = &UpdatedAtVal
+ }
c.Prices = temp.Prices
c.UseSiteExchangeRate = temp.UseSiteExchangeRate
c.SubscriptionId = temp.SubscriptionId
c.TaxIncluded = temp.TaxIncluded
c.Interval = temp.Interval
c.IntervalUnit = temp.IntervalUnit
+ c.CurrencyPrices = temp.CurrencyPrices
return nil
}
diff --git a/models/component_price_points_response.go b/models/component_price_points_response.go
index 93d3d871..fd2babdc 100644
--- a/models/component_price_points_response.go
+++ b/models/component_price_points_response.go
@@ -7,6 +7,7 @@ import (
// ComponentPricePointsResponse represents a ComponentPricePointsResponse struct.
type ComponentPricePointsResponse struct {
PricePoints []ComponentPricePoint `json:"price_points,omitempty"`
+ Meta *ListPublicKeysMeta `json:"meta,omitempty"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentPricePointsResponse.
@@ -23,6 +24,9 @@ func (c *ComponentPricePointsResponse) toMap() map[string]any {
if c.PricePoints != nil {
structMap["price_points"] = c.PricePoints
}
+ if c.Meta != nil {
+ structMap["meta"] = c.Meta
+ }
return structMap
}
@@ -31,6 +35,7 @@ func (c *ComponentPricePointsResponse) toMap() map[string]any {
func (c *ComponentPricePointsResponse) UnmarshalJSON(input []byte) error {
temp := &struct {
PricePoints []ComponentPricePoint `json:"price_points,omitempty"`
+ Meta *ListPublicKeysMeta `json:"meta,omitempty"`
}{}
err := json.Unmarshal(input, &temp)
if err != nil {
@@ -38,5 +43,6 @@ func (c *ComponentPricePointsResponse) UnmarshalJSON(input []byte) error {
}
c.PricePoints = temp.PricePoints
+ c.Meta = temp.Meta
return nil
}
diff --git a/models/coupon.go b/models/coupon.go
index d49cfd27..d7e55a28 100644
--- a/models/coupon.go
+++ b/models/coupon.go
@@ -16,7 +16,7 @@ type Coupon struct {
ProductFamilyName Optional[string] `json:"product_family_name"`
StartDate *string `json:"start_date,omitempty"`
EndDate Optional[string] `json:"end_date"`
- Percentage Optional[float64] `json:"percentage"`
+ Percentage Optional[string] `json:"percentage"`
Recurring *bool `json:"recurring,omitempty"`
RecurringScheme *RecurringScheme `json:"recurring_scheme,omitempty"`
DurationPeriodCount Optional[int] `json:"duration_period_count"`
@@ -152,7 +152,7 @@ func (c *Coupon) UnmarshalJSON(input []byte) error {
ProductFamilyName Optional[string] `json:"product_family_name"`
StartDate *string `json:"start_date,omitempty"`
EndDate Optional[string] `json:"end_date"`
- Percentage Optional[float64] `json:"percentage"`
+ Percentage Optional[string] `json:"percentage"`
Recurring *bool `json:"recurring,omitempty"`
RecurringScheme *RecurringScheme `json:"recurring_scheme,omitempty"`
DurationPeriodCount Optional[int] `json:"duration_period_count"`
diff --git a/models/create_payment_profile.go b/models/create_payment_profile.go
index e2c8624f..e2d1beaf 100644
--- a/models/create_payment_profile.go
+++ b/models/create_payment_profile.go
@@ -7,64 +7,66 @@ import (
// CreatePaymentProfile represents a CreatePaymentProfile struct.
type CreatePaymentProfile struct {
// Token received after sending billing informations using chargify.js.
- ChargifyToken *string `json:"chargify_token,omitempty"`
- Id *int `json:"id,omitempty"`
- PaymentType *PaymentType `json:"payment_type,omitempty"`
+ ChargifyToken *string `json:"chargify_token,omitempty"`
+ Id *int `json:"id,omitempty"`
+ PaymentType *PaymentType `json:"payment_type,omitempty"`
// First name on card or bank account. If omitted, the first_name from customer attributes will be used.
- FirstName *string `json:"first_name,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
// Last name on card or bank account. If omitted, the last_name from customer attributes will be used.
- LastName *string `json:"last_name,omitempty"`
- MaskedCardNumber *string `json:"masked_card_number,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
+ MaskedCardNumber *string `json:"masked_card_number,omitempty"`
// The full credit card number
- FullNumber *string `json:"full_number,omitempty"`
+ FullNumber *string `json:"full_number,omitempty"`
// The type of card used.
- CardType *CardType `json:"card_type,omitempty"`
+ CardType *CardType `json:"card_type,omitempty"`
// (Optional when performing an Import via vault_token, required otherwise) The 1- or 2-digit credit card expiration month, as an integer or string, i.e. 5
- ExpirationMonth *interface{} `json:"expiration_month,omitempty"`
+ ExpirationMonth *interface{} `json:"expiration_month,omitempty"`
// (Optional when performing a Import via vault_token, required otherwise) The 4-digit credit card expiration year, as an integer or string, i.e. 2012
- ExpirationYear *interface{} `json:"expiration_year,omitempty"`
+ ExpirationYear *interface{} `json:"expiration_year,omitempty"`
// The credit card or bank account billing street address (i.e. 123 Main St.). This value is merely passed through to the payment gateway.
- BillingAddress *string `json:"billing_address,omitempty"`
+ BillingAddress *string `json:"billing_address,omitempty"`
// Second line of the customer’s billing address i.e. Apt. 100
- BillingAddress2 Optional[string] `json:"billing_address_2"`
+ BillingAddress2 Optional[string] `json:"billing_address_2"`
// The credit card or bank account billing address city (i.e. “Boston”). This value is merely passed through to the payment gateway.
- BillingCity *string `json:"billing_city,omitempty"`
+ BillingCity *string `json:"billing_city,omitempty"`
// The credit card or bank account billing address state (i.e. MA). This value is merely passed through to the payment gateway. This must conform to the [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1#Current_codes) in order to be valid for tax locale purposes.
- BillingState *string `json:"billing_state,omitempty"`
+ BillingState *string `json:"billing_state,omitempty"`
// The credit card or bank account billing address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”). This value is merely passed through to the payment gateway. Some gateways require country codes in a specific format. Please check your gateway’s documentation. If creating an ACH subscription, only US is supported at this time.
- BillingCountry *string `json:"billing_country,omitempty"`
+ BillingCountry *string `json:"billing_country,omitempty"`
// The credit card or bank account billing address zip code (i.e. 12345). This value is merely passed through to the payment gateway.
- BillingZip *string `json:"billing_zip,omitempty"`
+ BillingZip *string `json:"billing_zip,omitempty"`
// The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing.
- CurrentVault *CurrentVault `json:"current_vault,omitempty"`
+ CurrentVault *CurrentVault `json:"current_vault,omitempty"`
// The “token” provided by your vault storage for an already stored payment profile
- VaultToken *string `json:"vault_token,omitempty"`
+ VaultToken *string `json:"vault_token,omitempty"`
// (only for Authorize.Net CIM storage or Square) The customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token
- CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
+ CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
// (Required when creating a new payment profile) The Chargify customer id.
- CustomerId *int `json:"customer_id,omitempty"`
+ CustomerId *int `json:"customer_id,omitempty"`
// used by merchants that implemented BraintreeBlue javaScript libraries on their own. We recommend using Chargify.js instead.
- PaypalEmail *string `json:"paypal_email,omitempty"` // Deprecated
+ PaypalEmail *string `json:"paypal_email,omitempty"` // Deprecated
// used by merchants that implemented BraintreeBlue javaScript libraries on their own. We recommend using Chargify.js instead.
- PaymentMethodNonce *string `json:"payment_method_nonce,omitempty"` // Deprecated
+ PaymentMethodNonce *string `json:"payment_method_nonce,omitempty"` // Deprecated
// This attribute is only available if MultiGateway feature is enabled for your Site. This feature is in the Private Beta currently. gateway_handle is used to directly select a gateway where a payment profile will be stored in. Every connected gateway must have a unique gateway handle specified. Read [Multigateway description](https://chargify.zendesk.com/hc/en-us/articles/4407761759643#connecting-with-multiple-gateways) to learn more about new concepts that MultiGateway introduces and the default behavior when this attribute is not passed.
- GatewayHandle *string `json:"gateway_handle,omitempty"`
+ GatewayHandle *string `json:"gateway_handle,omitempty"`
// The 3- or 4-digit Card Verification Value. This value is merely passed through to the payment gateway.
- Cvv *string `json:"cvv,omitempty"`
+ Cvv *string `json:"cvv,omitempty"`
// (Required when creating with ACH or GoCardless, optional with Stripe Direct Debit). The name of the bank where the customerʼs account resides
- BankName *string `json:"bank_name,omitempty"`
+ BankName *string `json:"bank_name,omitempty"`
// (Optional when creating with GoCardless, required with Stripe Direct Debit). International Bank Account Number. Alternatively, local bank details can be provided
- BankIban *string `json:"bank_iban,omitempty"`
+ BankIban *string `json:"bank_iban,omitempty"`
// (Required when creating with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API
- BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
+ BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
// (Required when creating with ACH, GoCardless, Stripe BECS Direct Debit and bank_iban is blank) The customerʼs bank account number
- BankAccountNumber *string `json:"bank_account_number,omitempty"`
+ BankAccountNumber *string `json:"bank_account_number,omitempty"`
// (Optional when creating with GoCardless, required with Stripe BECS Direct Debit) Branch code. Alternatively, an IBAN can be provided
- BankBranchCode *string `json:"bank_branch_code,omitempty"`
- BankAccountType *string `json:"bank_account_type,omitempty"`
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
+ BankBranchCode *string `json:"bank_branch_code,omitempty"`
+ // Defaults to checking
+ BankAccountType *BankAccountType `json:"bank_account_type,omitempty"`
+ // Defaults to personal
+ BankAccountHolderType *BankAccountHolderType `json:"bank_account_holder_type,omitempty"`
// (Optional) Used for creating subscription with payment profile imported using vault_token, for proper display in Advanced Billing UI
- LastFour *string `json:"last_four,omitempty"`
+ LastFour *string `json:"last_four,omitempty"`
}
// MarshalJSON implements the json.Marshaler interface for CreatePaymentProfile.
@@ -181,38 +183,38 @@ func (c *CreatePaymentProfile) toMap() map[string]any {
// It customizes the JSON unmarshaling process for CreatePaymentProfile objects.
func (c *CreatePaymentProfile) UnmarshalJSON(input []byte) error {
temp := &struct {
- ChargifyToken *string `json:"chargify_token,omitempty"`
- Id *int `json:"id,omitempty"`
- PaymentType *PaymentType `json:"payment_type,omitempty"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- MaskedCardNumber *string `json:"masked_card_number,omitempty"`
- FullNumber *string `json:"full_number,omitempty"`
- CardType *CardType `json:"card_type,omitempty"`
- ExpirationMonth *interface{} `json:"expiration_month,omitempty"`
- ExpirationYear *interface{} `json:"expiration_year,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingAddress2 Optional[string] `json:"billing_address_2"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- CurrentVault *CurrentVault `json:"current_vault,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
- CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
- CustomerId *int `json:"customer_id,omitempty"`
- PaypalEmail *string `json:"paypal_email,omitempty"`
- PaymentMethodNonce *string `json:"payment_method_nonce,omitempty"`
- GatewayHandle *string `json:"gateway_handle,omitempty"`
- Cvv *string `json:"cvv,omitempty"`
- BankName *string `json:"bank_name,omitempty"`
- BankIban *string `json:"bank_iban,omitempty"`
- BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
- BankAccountNumber *string `json:"bank_account_number,omitempty"`
- BankBranchCode *string `json:"bank_branch_code,omitempty"`
- BankAccountType *string `json:"bank_account_type,omitempty"`
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
- LastFour *string `json:"last_four,omitempty"`
+ ChargifyToken *string `json:"chargify_token,omitempty"`
+ Id *int `json:"id,omitempty"`
+ PaymentType *PaymentType `json:"payment_type,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
+ MaskedCardNumber *string `json:"masked_card_number,omitempty"`
+ FullNumber *string `json:"full_number,omitempty"`
+ CardType *CardType `json:"card_type,omitempty"`
+ ExpirationMonth *interface{} `json:"expiration_month,omitempty"`
+ ExpirationYear *interface{} `json:"expiration_year,omitempty"`
+ BillingAddress *string `json:"billing_address,omitempty"`
+ BillingAddress2 Optional[string] `json:"billing_address_2"`
+ BillingCity *string `json:"billing_city,omitempty"`
+ BillingState *string `json:"billing_state,omitempty"`
+ BillingCountry *string `json:"billing_country,omitempty"`
+ BillingZip *string `json:"billing_zip,omitempty"`
+ CurrentVault *CurrentVault `json:"current_vault,omitempty"`
+ VaultToken *string `json:"vault_token,omitempty"`
+ CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
+ CustomerId *int `json:"customer_id,omitempty"`
+ PaypalEmail *string `json:"paypal_email,omitempty"`
+ PaymentMethodNonce *string `json:"payment_method_nonce,omitempty"`
+ GatewayHandle *string `json:"gateway_handle,omitempty"`
+ Cvv *string `json:"cvv,omitempty"`
+ BankName *string `json:"bank_name,omitempty"`
+ BankIban *string `json:"bank_iban,omitempty"`
+ BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
+ BankAccountNumber *string `json:"bank_account_number,omitempty"`
+ BankBranchCode *string `json:"bank_branch_code,omitempty"`
+ BankAccountType *BankAccountType `json:"bank_account_type,omitempty"`
+ BankAccountHolderType *BankAccountHolderType `json:"bank_account_holder_type,omitempty"`
+ LastFour *string `json:"last_four,omitempty"`
}{}
err := json.Unmarshal(input, &temp)
if err != nil {
diff --git a/models/create_payment_profile_response.go b/models/create_payment_profile_response.go
deleted file mode 100644
index d90fb9a8..00000000
--- a/models/create_payment_profile_response.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package models
-
-import (
- "encoding/json"
-)
-
-// CreatePaymentProfileResponse represents a CreatePaymentProfileResponse struct.
-type CreatePaymentProfileResponse struct {
- PaymentProfile CreatedPaymentProfile `json:"payment_profile"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for CreatePaymentProfileResponse.
-// It customizes the JSON marshaling process for CreatePaymentProfileResponse objects.
-func (c *CreatePaymentProfileResponse) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(c.toMap())
-}
-
-// toMap converts the CreatePaymentProfileResponse object to a map representation for JSON marshaling.
-func (c *CreatePaymentProfileResponse) toMap() map[string]any {
- structMap := make(map[string]any)
- structMap["payment_profile"] = c.PaymentProfile
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for CreatePaymentProfileResponse.
-// It customizes the JSON unmarshaling process for CreatePaymentProfileResponse objects.
-func (c *CreatePaymentProfileResponse) UnmarshalJSON(input []byte) error {
- temp := &struct {
- PaymentProfile CreatedPaymentProfile `json:"payment_profile"`
- }{}
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
-
- c.PaymentProfile = temp.PaymentProfile
- return nil
-}
diff --git a/models/created_payment_profile.go b/models/created_payment_profile.go
deleted file mode 100644
index 46730376..00000000
--- a/models/created_payment_profile.go
+++ /dev/null
@@ -1,199 +0,0 @@
-package models
-
-import (
- "encoding/json"
-)
-
-// CreatedPaymentProfile represents a CreatedPaymentProfile struct.
-type CreatedPaymentProfile struct {
- Id *int `json:"id,omitempty"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- MaskedCardNumber Optional[string] `json:"masked_card_number"`
- CardType *string `json:"card_type,omitempty"`
- ExpirationMonth *int `json:"expiration_month,omitempty"`
- ExpirationYear *int `json:"expiration_year,omitempty"`
- CustomerId *int `json:"customer_id,omitempty"`
- // The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing.
- CurrentVault *CurrentVault `json:"current_vault,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- CustomerVaultToken Optional[string] `json:"customer_vault_token"`
- BillingAddress2 Optional[string] `json:"billing_address_2"`
- PaymentType *string `json:"payment_type,omitempty"`
- BankName *string `json:"bank_name,omitempty"`
- MaskedBankRoutingNumber *string `json:"masked_bank_routing_number,omitempty"`
- MaskedBankAccountNumber *string `json:"masked_bank_account_number,omitempty"`
- BankAccountType *string `json:"bank_account_type,omitempty"`
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
- Verified *bool `json:"verified,omitempty"`
- SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
- GatewayHandle *string `json:"gateway_handle,omitempty"`
- Disabled *bool `json:"disabled,omitempty"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for CreatedPaymentProfile.
-// It customizes the JSON marshaling process for CreatedPaymentProfile objects.
-func (c *CreatedPaymentProfile) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(c.toMap())
-}
-
-// toMap converts the CreatedPaymentProfile object to a map representation for JSON marshaling.
-func (c *CreatedPaymentProfile) toMap() map[string]any {
- structMap := make(map[string]any)
- if c.Id != nil {
- structMap["id"] = c.Id
- }
- if c.FirstName != nil {
- structMap["first_name"] = c.FirstName
- }
- if c.LastName != nil {
- structMap["last_name"] = c.LastName
- }
- if c.MaskedCardNumber.IsValueSet() {
- structMap["masked_card_number"] = c.MaskedCardNumber.Value()
- }
- if c.CardType != nil {
- structMap["card_type"] = c.CardType
- }
- if c.ExpirationMonth != nil {
- structMap["expiration_month"] = c.ExpirationMonth
- }
- if c.ExpirationYear != nil {
- structMap["expiration_year"] = c.ExpirationYear
- }
- if c.CustomerId != nil {
- structMap["customer_id"] = c.CustomerId
- }
- if c.CurrentVault != nil {
- structMap["current_vault"] = c.CurrentVault
- }
- if c.VaultToken != nil {
- structMap["vault_token"] = c.VaultToken
- }
- if c.BillingAddress != nil {
- structMap["billing_address"] = c.BillingAddress
- }
- if c.BillingCity != nil {
- structMap["billing_city"] = c.BillingCity
- }
- if c.BillingState != nil {
- structMap["billing_state"] = c.BillingState
- }
- if c.BillingZip != nil {
- structMap["billing_zip"] = c.BillingZip
- }
- if c.BillingCountry != nil {
- structMap["billing_country"] = c.BillingCountry
- }
- if c.CustomerVaultToken.IsValueSet() {
- structMap["customer_vault_token"] = c.CustomerVaultToken.Value()
- }
- if c.BillingAddress2.IsValueSet() {
- structMap["billing_address_2"] = c.BillingAddress2.Value()
- }
- if c.PaymentType != nil {
- structMap["payment_type"] = c.PaymentType
- }
- if c.BankName != nil {
- structMap["bank_name"] = c.BankName
- }
- if c.MaskedBankRoutingNumber != nil {
- structMap["masked_bank_routing_number"] = c.MaskedBankRoutingNumber
- }
- if c.MaskedBankAccountNumber != nil {
- structMap["masked_bank_account_number"] = c.MaskedBankAccountNumber
- }
- if c.BankAccountType != nil {
- structMap["bank_account_type"] = c.BankAccountType
- }
- if c.BankAccountHolderType != nil {
- structMap["bank_account_holder_type"] = c.BankAccountHolderType
- }
- if c.Verified != nil {
- structMap["verified"] = c.Verified
- }
- if c.SiteGatewaySettingId != nil {
- structMap["site_gateway_setting_id"] = c.SiteGatewaySettingId
- }
- if c.GatewayHandle != nil {
- structMap["gateway_handle"] = c.GatewayHandle
- }
- if c.Disabled != nil {
- structMap["disabled"] = c.Disabled
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for CreatedPaymentProfile.
-// It customizes the JSON unmarshaling process for CreatedPaymentProfile objects.
-func (c *CreatedPaymentProfile) UnmarshalJSON(input []byte) error {
- temp := &struct {
- Id *int `json:"id,omitempty"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- MaskedCardNumber Optional[string] `json:"masked_card_number"`
- CardType *string `json:"card_type,omitempty"`
- ExpirationMonth *int `json:"expiration_month,omitempty"`
- ExpirationYear *int `json:"expiration_year,omitempty"`
- CustomerId *int `json:"customer_id,omitempty"`
- CurrentVault *CurrentVault `json:"current_vault,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- CustomerVaultToken Optional[string] `json:"customer_vault_token"`
- BillingAddress2 Optional[string] `json:"billing_address_2"`
- PaymentType *string `json:"payment_type,omitempty"`
- BankName *string `json:"bank_name,omitempty"`
- MaskedBankRoutingNumber *string `json:"masked_bank_routing_number,omitempty"`
- MaskedBankAccountNumber *string `json:"masked_bank_account_number,omitempty"`
- BankAccountType *string `json:"bank_account_type,omitempty"`
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
- Verified *bool `json:"verified,omitempty"`
- SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
- GatewayHandle *string `json:"gateway_handle,omitempty"`
- Disabled *bool `json:"disabled,omitempty"`
- }{}
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
-
- c.Id = temp.Id
- c.FirstName = temp.FirstName
- c.LastName = temp.LastName
- c.MaskedCardNumber = temp.MaskedCardNumber
- c.CardType = temp.CardType
- c.ExpirationMonth = temp.ExpirationMonth
- c.ExpirationYear = temp.ExpirationYear
- c.CustomerId = temp.CustomerId
- c.CurrentVault = temp.CurrentVault
- c.VaultToken = temp.VaultToken
- c.BillingAddress = temp.BillingAddress
- c.BillingCity = temp.BillingCity
- c.BillingState = temp.BillingState
- c.BillingZip = temp.BillingZip
- c.BillingCountry = temp.BillingCountry
- c.CustomerVaultToken = temp.CustomerVaultToken
- c.BillingAddress2 = temp.BillingAddress2
- c.PaymentType = temp.PaymentType
- c.BankName = temp.BankName
- c.MaskedBankRoutingNumber = temp.MaskedBankRoutingNumber
- c.MaskedBankAccountNumber = temp.MaskedBankAccountNumber
- c.BankAccountType = temp.BankAccountType
- c.BankAccountHolderType = temp.BankAccountHolderType
- c.Verified = temp.Verified
- c.SiteGatewaySettingId = temp.SiteGatewaySettingId
- c.GatewayHandle = temp.GatewayHandle
- c.Disabled = temp.Disabled
- return nil
-}
diff --git a/models/payment_profile.go b/models/credit_card_payment_profile.go
similarity index 55%
rename from models/payment_profile.go
rename to models/credit_card_payment_profile.go
index 035a9e92..a3698f17 100644
--- a/models/payment_profile.go
+++ b/models/credit_card_payment_profile.go
@@ -4,8 +4,8 @@ import (
"encoding/json"
)
-// PaymentProfile represents a PaymentProfile struct.
-type PaymentProfile struct {
+// CreditCardPaymentProfile represents a CreditCardPaymentProfile struct.
+type CreditCardPaymentProfile struct {
// The Chargify-assigned ID of the stored card. This value can be used as an input to payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the same customer.
Id *int `json:"id,omitempty"`
// The first name of the card holder.
@@ -13,7 +13,7 @@ type PaymentProfile struct {
// The last name of the card holder.
LastName *string `json:"last_name,omitempty"`
// A string representation of the credit card number with all but the last 4 digits masked with X’s (i.e. ‘XXXX-XXXX-XXXX-1234’).
- MaskedCardNumber *string `json:"masked_card_number,omitempty"`
+ MaskedCardNumber string `json:"masked_card_number"`
// The type of card used.
CardType *CardType `json:"card_type,omitempty"`
// An integer representing the expiration month of the card(1 – 12).
@@ -42,101 +42,99 @@ type PaymentProfile struct {
BillingAddress2 Optional[string] `json:"billing_address_2"`
PaymentType *PaymentType `json:"payment_type,omitempty"`
Disabled *bool `json:"disabled,omitempty"`
- // Token received after sending billing informations using chargify.js.
+ // Token received after sending billing information using chargify.js. This token will only be received if passed as a sole attribute of credit_card_attributes (i.e. tok_9g6hw85pnpt6knmskpwp4ttt)
ChargifyToken *string `json:"chargify_token,omitempty"`
SiteGatewaySettingId Optional[int] `json:"site_gateway_setting_id"`
// An identifier of connected gateway.
GatewayHandle Optional[string] `json:"gateway_handle"`
}
-// MarshalJSON implements the json.Marshaler interface for PaymentProfile.
-// It customizes the JSON marshaling process for PaymentProfile objects.
-func (p *PaymentProfile) MarshalJSON() (
+// MarshalJSON implements the json.Marshaler interface for CreditCardPaymentProfile.
+// It customizes the JSON marshaling process for CreditCardPaymentProfile objects.
+func (c *CreditCardPaymentProfile) MarshalJSON() (
[]byte,
error) {
- return json.Marshal(p.toMap())
+ return json.Marshal(c.toMap())
}
-// toMap converts the PaymentProfile object to a map representation for JSON marshaling.
-func (p *PaymentProfile) toMap() map[string]any {
+// toMap converts the CreditCardPaymentProfile object to a map representation for JSON marshaling.
+func (c *CreditCardPaymentProfile) toMap() map[string]any {
structMap := make(map[string]any)
- if p.Id != nil {
- structMap["id"] = p.Id
+ if c.Id != nil {
+ structMap["id"] = c.Id
}
- if p.FirstName != nil {
- structMap["first_name"] = p.FirstName
+ if c.FirstName != nil {
+ structMap["first_name"] = c.FirstName
}
- if p.LastName != nil {
- structMap["last_name"] = p.LastName
+ if c.LastName != nil {
+ structMap["last_name"] = c.LastName
}
- if p.MaskedCardNumber != nil {
- structMap["masked_card_number"] = p.MaskedCardNumber
+ structMap["masked_card_number"] = c.MaskedCardNumber
+ if c.CardType != nil {
+ structMap["card_type"] = c.CardType
}
- if p.CardType != nil {
- structMap["card_type"] = p.CardType
+ if c.ExpirationMonth != nil {
+ structMap["expiration_month"] = c.ExpirationMonth
}
- if p.ExpirationMonth != nil {
- structMap["expiration_month"] = p.ExpirationMonth
+ if c.ExpirationYear != nil {
+ structMap["expiration_year"] = c.ExpirationYear
}
- if p.ExpirationYear != nil {
- structMap["expiration_year"] = p.ExpirationYear
+ if c.CustomerId != nil {
+ structMap["customer_id"] = c.CustomerId
}
- if p.CustomerId != nil {
- structMap["customer_id"] = p.CustomerId
+ if c.CurrentVault != nil {
+ structMap["current_vault"] = c.CurrentVault
}
- if p.CurrentVault != nil {
- structMap["current_vault"] = p.CurrentVault
+ if c.VaultToken.IsValueSet() {
+ structMap["vault_token"] = c.VaultToken.Value()
}
- if p.VaultToken.IsValueSet() {
- structMap["vault_token"] = p.VaultToken.Value()
+ if c.BillingAddress.IsValueSet() {
+ structMap["billing_address"] = c.BillingAddress.Value()
}
- if p.BillingAddress.IsValueSet() {
- structMap["billing_address"] = p.BillingAddress.Value()
+ if c.BillingCity.IsValueSet() {
+ structMap["billing_city"] = c.BillingCity.Value()
}
- if p.BillingCity.IsValueSet() {
- structMap["billing_city"] = p.BillingCity.Value()
+ if c.BillingState.IsValueSet() {
+ structMap["billing_state"] = c.BillingState.Value()
}
- if p.BillingState.IsValueSet() {
- structMap["billing_state"] = p.BillingState.Value()
+ if c.BillingZip.IsValueSet() {
+ structMap["billing_zip"] = c.BillingZip.Value()
}
- if p.BillingZip.IsValueSet() {
- structMap["billing_zip"] = p.BillingZip.Value()
+ if c.BillingCountry.IsValueSet() {
+ structMap["billing_country"] = c.BillingCountry.Value()
}
- if p.BillingCountry.IsValueSet() {
- structMap["billing_country"] = p.BillingCountry.Value()
+ if c.CustomerVaultToken.IsValueSet() {
+ structMap["customer_vault_token"] = c.CustomerVaultToken.Value()
}
- if p.CustomerVaultToken.IsValueSet() {
- structMap["customer_vault_token"] = p.CustomerVaultToken.Value()
+ if c.BillingAddress2.IsValueSet() {
+ structMap["billing_address_2"] = c.BillingAddress2.Value()
}
- if p.BillingAddress2.IsValueSet() {
- structMap["billing_address_2"] = p.BillingAddress2.Value()
+ if c.PaymentType != nil {
+ structMap["payment_type"] = c.PaymentType
}
- if p.PaymentType != nil {
- structMap["payment_type"] = p.PaymentType
+ if c.Disabled != nil {
+ structMap["disabled"] = c.Disabled
}
- if p.Disabled != nil {
- structMap["disabled"] = p.Disabled
+ if c.ChargifyToken != nil {
+ structMap["chargify_token"] = c.ChargifyToken
}
- if p.ChargifyToken != nil {
- structMap["chargify_token"] = p.ChargifyToken
+ if c.SiteGatewaySettingId.IsValueSet() {
+ structMap["site_gateway_setting_id"] = c.SiteGatewaySettingId.Value()
}
- if p.SiteGatewaySettingId.IsValueSet() {
- structMap["site_gateway_setting_id"] = p.SiteGatewaySettingId.Value()
- }
- if p.GatewayHandle.IsValueSet() {
- structMap["gateway_handle"] = p.GatewayHandle.Value()
+ if c.GatewayHandle.IsValueSet() {
+ structMap["gateway_handle"] = c.GatewayHandle.Value()
}
return structMap
}
-// UnmarshalJSON implements the json.Unmarshaler interface for PaymentProfile.
-// It customizes the JSON unmarshaling process for PaymentProfile objects.
-func (p *PaymentProfile) UnmarshalJSON(input []byte) error {
+// UnmarshalJSON implements the json.Unmarshaler interface for CreditCardPaymentProfile.
+// It customizes the JSON unmarshaling process for CreditCardPaymentProfile objects.
+func (c *CreditCardPaymentProfile) UnmarshalJSON(input []byte) error {
temp := &struct {
Id *int `json:"id,omitempty"`
FirstName *string `json:"first_name,omitempty"`
LastName *string `json:"last_name,omitempty"`
- MaskedCardNumber *string `json:"masked_card_number,omitempty"`
+ MaskedCardNumber string `json:"masked_card_number"`
CardType *CardType `json:"card_type,omitempty"`
ExpirationMonth *int `json:"expiration_month,omitempty"`
ExpirationYear *int `json:"expiration_year,omitempty"`
@@ -161,27 +159,27 @@ func (p *PaymentProfile) UnmarshalJSON(input []byte) error {
return err
}
- p.Id = temp.Id
- p.FirstName = temp.FirstName
- p.LastName = temp.LastName
- p.MaskedCardNumber = temp.MaskedCardNumber
- p.CardType = temp.CardType
- p.ExpirationMonth = temp.ExpirationMonth
- p.ExpirationYear = temp.ExpirationYear
- p.CustomerId = temp.CustomerId
- p.CurrentVault = temp.CurrentVault
- p.VaultToken = temp.VaultToken
- p.BillingAddress = temp.BillingAddress
- p.BillingCity = temp.BillingCity
- p.BillingState = temp.BillingState
- p.BillingZip = temp.BillingZip
- p.BillingCountry = temp.BillingCountry
- p.CustomerVaultToken = temp.CustomerVaultToken
- p.BillingAddress2 = temp.BillingAddress2
- p.PaymentType = temp.PaymentType
- p.Disabled = temp.Disabled
- p.ChargifyToken = temp.ChargifyToken
- p.SiteGatewaySettingId = temp.SiteGatewaySettingId
- p.GatewayHandle = temp.GatewayHandle
+ c.Id = temp.Id
+ c.FirstName = temp.FirstName
+ c.LastName = temp.LastName
+ c.MaskedCardNumber = temp.MaskedCardNumber
+ c.CardType = temp.CardType
+ c.ExpirationMonth = temp.ExpirationMonth
+ c.ExpirationYear = temp.ExpirationYear
+ c.CustomerId = temp.CustomerId
+ c.CurrentVault = temp.CurrentVault
+ c.VaultToken = temp.VaultToken
+ c.BillingAddress = temp.BillingAddress
+ c.BillingCity = temp.BillingCity
+ c.BillingState = temp.BillingState
+ c.BillingZip = temp.BillingZip
+ c.BillingCountry = temp.BillingCountry
+ c.CustomerVaultToken = temp.CustomerVaultToken
+ c.BillingAddress2 = temp.BillingAddress2
+ c.PaymentType = temp.PaymentType
+ c.Disabled = temp.Disabled
+ c.ChargifyToken = temp.ChargifyToken
+ c.SiteGatewaySettingId = temp.SiteGatewaySettingId
+ c.GatewayHandle = temp.GatewayHandle
return nil
}
diff --git a/models/enums.go b/models/enums.go
index c05c6165..0650460e 100644
--- a/models/enums.go
+++ b/models/enums.go
@@ -208,19 +208,42 @@ const (
type CardType string
const (
- CardType_BOGUS CardType = "bogus"
CardType_VISA CardType = "visa"
CardType_MASTER CardType = "master"
+ CardType_ELO CardType = "elo"
+ CardType_CABAL CardType = "cabal"
+ CardType_ALELO CardType = "alelo"
CardType_DISCOVER CardType = "discover"
CardType_AMERICANEXPRESS CardType = "american_express"
+ CardType_NARANJA CardType = "naranja"
CardType_DINERSCLUB CardType = "diners_club"
CardType_JCB CardType = "jcb"
- CardType_ENUMSWITCH CardType = "switch"
- CardType_SOLO CardType = "solo"
CardType_DANKORT CardType = "dankort"
CardType_MAESTRO CardType = "maestro"
- CardType_LASER CardType = "laser"
+ CardType_MAESTRONOLUHN CardType = "maestro_no_luhn"
CardType_FORBRUGSFORENINGEN CardType = "forbrugsforeningen"
+ CardType_SODEXO CardType = "sodexo"
+ CardType_ALIA CardType = "alia"
+ CardType_VR CardType = "vr"
+ CardType_UNIONPAY CardType = "unionpay"
+ CardType_CARNET CardType = "carnet"
+ CardType_CARTESBANCAIRES CardType = "cartes_bancaires"
+ CardType_OLIMPICA CardType = "olimpica"
+ CardType_CREDITEL CardType = "creditel"
+ CardType_CONFIABLE CardType = "confiable"
+ CardType_SYNCHRONY CardType = "synchrony"
+ CardType_ROUTEX CardType = "routex"
+ CardType_MADA CardType = "mada"
+ CardType_BPPLUS CardType = "bp_plus"
+ CardType_PASSCARD CardType = "passcard"
+ CardType_EDENRED CardType = "edenred"
+ CardType_ANDA CardType = "anda"
+ CardType_TARJETAD CardType = "tarjeta-d"
+ CardType_HIPERCARD CardType = "hipercard"
+ CardType_BOGUS CardType = "bogus"
+ CardType_ENUMSWITCH CardType = "switch"
+ CardType_SOLO CardType = "solo"
+ CardType_LASER CardType = "laser"
)
// CurrentVault is a string enum.
@@ -278,6 +301,24 @@ const (
BankAccountVault_GOCARDLESS BankAccountVault = "gocardless"
)
+// BankAccountType is a string enum.
+// Defaults to checking
+type BankAccountType string
+
+const (
+ BankAccountType_CHECKING BankAccountType = "checking"
+ BankAccountType_SAVINGS BankAccountType = "savings"
+)
+
+// BankAccountHolderType is a string enum.
+// Defaults to personal
+type BankAccountHolderType string
+
+const (
+ BankAccountHolderType_PERSONAL BankAccountHolderType = "personal"
+ BankAccountHolderType_BUSINESS BankAccountHolderType = "business"
+)
+
// PricePointType is a string enum.
// Price point type. We expose the following types:
// 1. **default**: a price point that is marked as a default price for a certain product.
@@ -403,22 +444,6 @@ const (
ListEventsDateField_CREATEDAT ListEventsDateField = "created_at"
)
-// BankAccountType is a string enum.
-type BankAccountType string
-
-const (
- BankAccountType_CHECKING BankAccountType = "checking"
- BankAccountType_SAVINGS BankAccountType = "savings"
-)
-
-// HolderType is a string enum.
-type HolderType string
-
-const (
- HolderType_PERSONAL HolderType = "personal"
- HolderType_BUSINESS HolderType = "business"
-)
-
// PricingScheme is a string enum.
// The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes.
type PricingScheme string
diff --git a/models/get_one_time_token_payment_profile.go b/models/get_one_time_token_payment_profile.go
index e3351e2d..b488ab7a 100644
--- a/models/get_one_time_token_payment_profile.go
+++ b/models/get_one_time_token_payment_profile.go
@@ -10,7 +10,8 @@ type GetOneTimeTokenPaymentProfile struct {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
MaskedCardNumber string `json:"masked_card_number"`
- CardType string `json:"card_type"`
+ // The type of card used.
+ CardType CardType `json:"card_type"`
ExpirationMonth float64 `json:"expiration_month"`
ExpirationYear float64 `json:"expiration_year"`
CustomerId Optional[string] `json:"customer_id"`
@@ -83,7 +84,7 @@ func (g *GetOneTimeTokenPaymentProfile) UnmarshalJSON(input []byte) error {
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
MaskedCardNumber string `json:"masked_card_number"`
- CardType string `json:"card_type"`
+ CardType CardType `json:"card_type"`
ExpirationMonth float64 `json:"expiration_month"`
ExpirationYear float64 `json:"expiration_year"`
CustomerId Optional[string] `json:"customer_id"`
diff --git a/models/list_payment_profile_item.go b/models/list_payment_profile_item.go
deleted file mode 100644
index f8d23c1a..00000000
--- a/models/list_payment_profile_item.go
+++ /dev/null
@@ -1,163 +0,0 @@
-package models
-
-import (
- "encoding/json"
-)
-
-// ListPaymentProfileItem represents a ListPaymentProfileItem struct.
-type ListPaymentProfileItem struct {
- Id *int `json:"id,omitempty"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- CustomerId *int `json:"customer_id,omitempty"`
- // The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing.
- CurrentVault *CurrentVault `json:"current_vault,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- CustomerVaultToken Optional[string] `json:"customer_vault_token"`
- BillingAddress2 *string `json:"billing_address_2,omitempty"`
- BankName *string `json:"bank_name,omitempty"`
- MaskedBankRoutingNumber *string `json:"masked_bank_routing_number,omitempty"`
- MaskedBankAccountNumber *string `json:"masked_bank_account_number,omitempty"`
- BankAccountType *string `json:"bank_account_type,omitempty"`
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
- PaymentType *string `json:"payment_type,omitempty"`
- SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
- GatewayHandle *string `json:"gateway_handle,omitempty"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for ListPaymentProfileItem.
-// It customizes the JSON marshaling process for ListPaymentProfileItem objects.
-func (l *ListPaymentProfileItem) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(l.toMap())
-}
-
-// toMap converts the ListPaymentProfileItem object to a map representation for JSON marshaling.
-func (l *ListPaymentProfileItem) toMap() map[string]any {
- structMap := make(map[string]any)
- if l.Id != nil {
- structMap["id"] = l.Id
- }
- if l.FirstName != nil {
- structMap["first_name"] = l.FirstName
- }
- if l.LastName != nil {
- structMap["last_name"] = l.LastName
- }
- if l.CustomerId != nil {
- structMap["customer_id"] = l.CustomerId
- }
- if l.CurrentVault != nil {
- structMap["current_vault"] = l.CurrentVault
- }
- if l.VaultToken != nil {
- structMap["vault_token"] = l.VaultToken
- }
- if l.BillingAddress != nil {
- structMap["billing_address"] = l.BillingAddress
- }
- if l.BillingCity != nil {
- structMap["billing_city"] = l.BillingCity
- }
- if l.BillingState != nil {
- structMap["billing_state"] = l.BillingState
- }
- if l.BillingZip != nil {
- structMap["billing_zip"] = l.BillingZip
- }
- if l.BillingCountry != nil {
- structMap["billing_country"] = l.BillingCountry
- }
- if l.CustomerVaultToken.IsValueSet() {
- structMap["customer_vault_token"] = l.CustomerVaultToken.Value()
- }
- if l.BillingAddress2 != nil {
- structMap["billing_address_2"] = l.BillingAddress2
- }
- if l.BankName != nil {
- structMap["bank_name"] = l.BankName
- }
- if l.MaskedBankRoutingNumber != nil {
- structMap["masked_bank_routing_number"] = l.MaskedBankRoutingNumber
- }
- if l.MaskedBankAccountNumber != nil {
- structMap["masked_bank_account_number"] = l.MaskedBankAccountNumber
- }
- if l.BankAccountType != nil {
- structMap["bank_account_type"] = l.BankAccountType
- }
- if l.BankAccountHolderType != nil {
- structMap["bank_account_holder_type"] = l.BankAccountHolderType
- }
- if l.PaymentType != nil {
- structMap["payment_type"] = l.PaymentType
- }
- if l.SiteGatewaySettingId != nil {
- structMap["site_gateway_setting_id"] = l.SiteGatewaySettingId
- }
- if l.GatewayHandle != nil {
- structMap["gateway_handle"] = l.GatewayHandle
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for ListPaymentProfileItem.
-// It customizes the JSON unmarshaling process for ListPaymentProfileItem objects.
-func (l *ListPaymentProfileItem) UnmarshalJSON(input []byte) error {
- temp := &struct {
- Id *int `json:"id,omitempty"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- CustomerId *int `json:"customer_id,omitempty"`
- CurrentVault *CurrentVault `json:"current_vault,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- CustomerVaultToken Optional[string] `json:"customer_vault_token"`
- BillingAddress2 *string `json:"billing_address_2,omitempty"`
- BankName *string `json:"bank_name,omitempty"`
- MaskedBankRoutingNumber *string `json:"masked_bank_routing_number,omitempty"`
- MaskedBankAccountNumber *string `json:"masked_bank_account_number,omitempty"`
- BankAccountType *string `json:"bank_account_type,omitempty"`
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
- PaymentType *string `json:"payment_type,omitempty"`
- SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
- GatewayHandle *string `json:"gateway_handle,omitempty"`
- }{}
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
-
- l.Id = temp.Id
- l.FirstName = temp.FirstName
- l.LastName = temp.LastName
- l.CustomerId = temp.CustomerId
- l.CurrentVault = temp.CurrentVault
- l.VaultToken = temp.VaultToken
- l.BillingAddress = temp.BillingAddress
- l.BillingCity = temp.BillingCity
- l.BillingState = temp.BillingState
- l.BillingZip = temp.BillingZip
- l.BillingCountry = temp.BillingCountry
- l.CustomerVaultToken = temp.CustomerVaultToken
- l.BillingAddress2 = temp.BillingAddress2
- l.BankName = temp.BankName
- l.MaskedBankRoutingNumber = temp.MaskedBankRoutingNumber
- l.MaskedBankAccountNumber = temp.MaskedBankAccountNumber
- l.BankAccountType = temp.BankAccountType
- l.BankAccountHolderType = temp.BankAccountHolderType
- l.PaymentType = temp.PaymentType
- l.SiteGatewaySettingId = temp.SiteGatewaySettingId
- l.GatewayHandle = temp.GatewayHandle
- return nil
-}
diff --git a/models/list_payment_profiles_response.go b/models/list_payment_profiles_response.go
deleted file mode 100644
index 8840583f..00000000
--- a/models/list_payment_profiles_response.go
+++ /dev/null
@@ -1,42 +0,0 @@
-package models
-
-import (
- "encoding/json"
-)
-
-// ListPaymentProfilesResponse represents a ListPaymentProfilesResponse struct.
-type ListPaymentProfilesResponse struct {
- PaymentProfile *ListPaymentProfileItem `json:"payment_profile,omitempty"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for ListPaymentProfilesResponse.
-// It customizes the JSON marshaling process for ListPaymentProfilesResponse objects.
-func (l *ListPaymentProfilesResponse) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(l.toMap())
-}
-
-// toMap converts the ListPaymentProfilesResponse object to a map representation for JSON marshaling.
-func (l *ListPaymentProfilesResponse) toMap() map[string]any {
- structMap := make(map[string]any)
- if l.PaymentProfile != nil {
- structMap["payment_profile"] = l.PaymentProfile
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for ListPaymentProfilesResponse.
-// It customizes the JSON unmarshaling process for ListPaymentProfilesResponse objects.
-func (l *ListPaymentProfilesResponse) UnmarshalJSON(input []byte) error {
- temp := &struct {
- PaymentProfile *ListPaymentProfileItem `json:"payment_profile,omitempty"`
- }{}
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
-
- l.PaymentProfile = temp.PaymentProfile
- return nil
-}
diff --git a/models/payment_profile_response.go b/models/payment_profile_response.go
index 75510907..910e903d 100644
--- a/models/payment_profile_response.go
+++ b/models/payment_profile_response.go
@@ -6,7 +6,7 @@ import (
// PaymentProfileResponse represents a PaymentProfileResponse struct.
type PaymentProfileResponse struct {
- PaymentProfile PaymentProfile `json:"payment_profile"`
+ PaymentProfile interface{} `json:"payment_profile"`
}
// MarshalJSON implements the json.Marshaler interface for PaymentProfileResponse.
@@ -28,7 +28,7 @@ func (p *PaymentProfileResponse) toMap() map[string]any {
// It customizes the JSON unmarshaling process for PaymentProfileResponse objects.
func (p *PaymentProfileResponse) UnmarshalJSON(input []byte) error {
temp := &struct {
- PaymentProfile PaymentProfile `json:"payment_profile"`
+ PaymentProfile interface{} `json:"payment_profile"`
}{}
err := json.Unmarshal(input, &temp)
if err != nil {
diff --git a/models/price_point.go b/models/price_point.go
index e84cfbec..7b602a2f 100644
--- a/models/price_point.go
+++ b/models/price_point.go
@@ -13,6 +13,8 @@ type PricePoint struct {
Prices []Price `json:"prices,omitempty"`
// Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site.
UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
+ // Whether or not the price point includes tax
+ TaxIncluded *bool `json:"tax_included,omitempty"`
// The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this price point would renew every 30 days. This property is only available for sites with Multifrequency enabled.
Interval *int `json:"interval,omitempty"`
// A string representing the interval unit for this price point, either month or day. This property is only available for sites with Multifrequency enabled.
@@ -53,6 +55,9 @@ func (p *PricePoint) toMap() map[string]any {
if p.UseSiteExchangeRate != nil {
structMap["use_site_exchange_rate"] = p.UseSiteExchangeRate
}
+ if p.TaxIncluded != nil {
+ structMap["tax_included"] = p.TaxIncluded
+ }
if p.Interval != nil {
structMap["interval"] = p.Interval
}
@@ -86,6 +91,7 @@ func (p *PricePoint) UnmarshalJSON(input []byte) error {
PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
Prices []Price `json:"prices,omitempty"`
UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
+ TaxIncluded *bool `json:"tax_included,omitempty"`
Interval *int `json:"interval,omitempty"`
IntervalUnit *IntervalUnit `json:"interval_unit,omitempty"`
OveragePricing *OveragePricing `json:"overage_pricing,omitempty"`
@@ -104,6 +110,7 @@ func (p *PricePoint) UnmarshalJSON(input []byte) error {
p.PricingScheme = temp.PricingScheme
p.Prices = temp.Prices
p.UseSiteExchangeRate = temp.UseSiteExchangeRate
+ p.TaxIncluded = temp.TaxIncluded
p.Interval = temp.Interval
p.IntervalUnit = temp.IntervalUnit
p.OveragePricing = temp.OveragePricing
diff --git a/models/product_price_point.go b/models/product_price_point.go
index 6dde60fa..c5f7400b 100644
--- a/models/product_price_point.go
+++ b/models/product_price_point.go
@@ -51,6 +51,8 @@ type ProductPricePoint struct {
TaxIncluded *bool `json:"tax_included,omitempty"`
// The subscription id this price point belongs to
SubscriptionId Optional[int] `json:"subscription_id"`
+ // An array of currency pricing data is available when multiple currencies are defined for the site. It varies based on the use_site_exchange_rate setting for the price point. This parameter is present only in the response of read endpoints, after including the appropriate query parameter.
+ CurrencyPrices []CurrencyPrice `json:"currency_prices,omitempty"`
}
// MarshalJSON implements the json.Marshaler interface for ProductPricePoint.
@@ -138,6 +140,9 @@ func (p *ProductPricePoint) toMap() map[string]any {
if p.SubscriptionId.IsValueSet() {
structMap["subscription_id"] = p.SubscriptionId.Value()
}
+ if p.CurrencyPrices != nil {
+ structMap["currency_prices"] = p.CurrencyPrices
+ }
return structMap
}
@@ -168,6 +173,7 @@ func (p *ProductPricePoint) UnmarshalJSON(input []byte) error {
Type *PricePointType `json:"type,omitempty"`
TaxIncluded *bool `json:"tax_included,omitempty"`
SubscriptionId Optional[int] `json:"subscription_id"`
+ CurrencyPrices []CurrencyPrice `json:"currency_prices,omitempty"`
}{}
err := json.Unmarshal(input, &temp)
if err != nil {
@@ -216,5 +222,6 @@ func (p *ProductPricePoint) UnmarshalJSON(input []byte) error {
p.Type = temp.Type
p.TaxIncluded = temp.TaxIncluded
p.SubscriptionId = temp.SubscriptionId
+ p.CurrencyPrices = temp.CurrencyPrices
return nil
}
diff --git a/models/read_payment_profile_response.go b/models/read_payment_profile_response.go
deleted file mode 100644
index 0cee256e..00000000
--- a/models/read_payment_profile_response.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package models
-
-import (
- "encoding/json"
-)
-
-// ReadPaymentProfileResponse represents a ReadPaymentProfileResponse struct.
-type ReadPaymentProfileResponse struct {
- PaymentProfile interface{} `json:"payment_profile"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for ReadPaymentProfileResponse.
-// It customizes the JSON marshaling process for ReadPaymentProfileResponse objects.
-func (r *ReadPaymentProfileResponse) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(r.toMap())
-}
-
-// toMap converts the ReadPaymentProfileResponse object to a map representation for JSON marshaling.
-func (r *ReadPaymentProfileResponse) toMap() map[string]any {
- structMap := make(map[string]any)
- structMap["payment_profile"] = r.PaymentProfile
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for ReadPaymentProfileResponse.
-// It customizes the JSON unmarshaling process for ReadPaymentProfileResponse objects.
-func (r *ReadPaymentProfileResponse) UnmarshalJSON(input []byte) error {
- temp := &struct {
- PaymentProfile interface{} `json:"payment_profile"`
- }{}
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
-
- r.PaymentProfile = temp.PaymentProfile
- return nil
-}
diff --git a/models/subscription.go b/models/subscription.go
index 38e27763..06b3595a 100644
--- a/models/subscription.go
+++ b/models/subscription.go
@@ -81,9 +81,9 @@ type Subscription struct {
PaymentCollectionMethod *PaymentCollectionMethod `json:"payment_collection_method,omitempty"`
Customer *Customer `json:"customer,omitempty"`
Product *Product `json:"product,omitempty"`
- CreditCard *PaymentProfile `json:"credit_card,omitempty"`
+ CreditCard *CreditCardPaymentProfile `json:"credit_card,omitempty"`
Group Optional[NestedSubscriptionGroup] `json:"group"`
- BankAccount *SubscriptionBankAccount `json:"bank_account,omitempty"`
+ BankAccount *BankAccountPaymentProfile `json:"bank_account,omitempty"`
// The payment profile type for the active profile on file.
PaymentType Optional[string] `json:"payment_type"`
// The subscription's unique code that can be given to referrals.
@@ -417,9 +417,9 @@ func (s *Subscription) UnmarshalJSON(input []byte) error {
PaymentCollectionMethod *PaymentCollectionMethod `json:"payment_collection_method,omitempty"`
Customer *Customer `json:"customer,omitempty"`
Product *Product `json:"product,omitempty"`
- CreditCard *PaymentProfile `json:"credit_card,omitempty"`
+ CreditCard *CreditCardPaymentProfile `json:"credit_card,omitempty"`
Group Optional[NestedSubscriptionGroup] `json:"group"`
- BankAccount *SubscriptionBankAccount `json:"bank_account,omitempty"`
+ BankAccount *BankAccountPaymentProfile `json:"bank_account,omitempty"`
PaymentType Optional[string] `json:"payment_type"`
ReferralCode Optional[string] `json:"referral_code"`
NextProductId Optional[int] `json:"next_product_id"`
diff --git a/models/subscription_bank_account.go b/models/subscription_bank_account.go
deleted file mode 100644
index 5ccf885d..00000000
--- a/models/subscription_bank_account.go
+++ /dev/null
@@ -1,181 +0,0 @@
-package models
-
-import (
- "encoding/json"
-)
-
-// SubscriptionBankAccount represents a SubscriptionBankAccount struct.
-type SubscriptionBankAccount struct {
- // Defaults to personal
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
- // Defaults to checking
- BankAccountType *string `json:"bank_account_type,omitempty"`
- // The bank where the account resides
- BankName *string `json:"bank_name,omitempty"`
- // The current billing street address for the bank account
- BillingAddress *string `json:"billing_address,omitempty"`
- // The current billing street address, second line, for the bank account
- BillingAddress2 *string `json:"billing_address_2,omitempty"`
- // The current billing address city for the bank account
- BillingCity *string `json:"billing_city,omitempty"`
- // The current billing address state for the bank account
- BillingState *string `json:"billing_state,omitempty"`
- // The current billing address zip code for the bank account
- BillingZip *string `json:"billing_zip,omitempty"`
- // The current billing address country for the bank account
- BillingCountry *string `json:"billing_country,omitempty"`
- // The vault that stores the payment profile with the provided vault_token.
- CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
- // The Chargify-assigned id for the customer record to which the bank account belongs
- CustomerId *int `json:"customer_id,omitempty"`
- // (only for Authorize.Net CIM storage): the customerProfileId for the owner of the customerPaymentProfileId provided as the vault_token
- CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
- // The first name of the bank account holder
- FirstName *string `json:"first_name,omitempty"`
- // The last name of the bank account holder
- LastName *string `json:"last_name,omitempty"`
- // The Chargify-assigned ID of the stored bank account. This value can be used as an input to payment_profile_id when creating a subscription, in order to re-use a stored payment profile for the same customer
- Id *int `json:"id,omitempty"`
- // A string representation of the stored bank account number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’)
- MaskedBankAccountNumber *string `json:"masked_bank_account_number,omitempty"`
- // A string representation of the stored bank routing number with all but the last 4 digits marked with X’s (i.e. ‘XXXXXXX1111’). payment_type will be bank_account
- MaskedBankRoutingNumber *string `json:"masked_bank_routing_number,omitempty"`
- // The “token” provided by your vault storage for an already stored payment profile
- VaultToken *string `json:"vault_token,omitempty"`
- // Token received after sending billing informations using chargify.js. This token will only be received if passed as a sole attribute of credit_card_attributes (i.e. tok_9g6hw85pnpt6knmskpwp4ttt)
- ChargifyToken *string `json:"chargify_token,omitempty"`
- SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
- GatewayHandle *string `json:"gateway_handle,omitempty"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for SubscriptionBankAccount.
-// It customizes the JSON marshaling process for SubscriptionBankAccount objects.
-func (s *SubscriptionBankAccount) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(s.toMap())
-}
-
-// toMap converts the SubscriptionBankAccount object to a map representation for JSON marshaling.
-func (s *SubscriptionBankAccount) toMap() map[string]any {
- structMap := make(map[string]any)
- if s.BankAccountHolderType != nil {
- structMap["bank_account_holder_type"] = s.BankAccountHolderType
- }
- if s.BankAccountType != nil {
- structMap["bank_account_type"] = s.BankAccountType
- }
- if s.BankName != nil {
- structMap["bank_name"] = s.BankName
- }
- if s.BillingAddress != nil {
- structMap["billing_address"] = s.BillingAddress
- }
- if s.BillingAddress2 != nil {
- structMap["billing_address_2"] = s.BillingAddress2
- }
- if s.BillingCity != nil {
- structMap["billing_city"] = s.BillingCity
- }
- if s.BillingState != nil {
- structMap["billing_state"] = s.BillingState
- }
- if s.BillingZip != nil {
- structMap["billing_zip"] = s.BillingZip
- }
- if s.BillingCountry != nil {
- structMap["billing_country"] = s.BillingCountry
- }
- if s.CurrentVault != nil {
- structMap["current_vault"] = s.CurrentVault
- }
- if s.CustomerId != nil {
- structMap["customer_id"] = s.CustomerId
- }
- if s.CustomerVaultToken != nil {
- structMap["customer_vault_token"] = s.CustomerVaultToken
- }
- if s.FirstName != nil {
- structMap["first_name"] = s.FirstName
- }
- if s.LastName != nil {
- structMap["last_name"] = s.LastName
- }
- if s.Id != nil {
- structMap["id"] = s.Id
- }
- if s.MaskedBankAccountNumber != nil {
- structMap["masked_bank_account_number"] = s.MaskedBankAccountNumber
- }
- if s.MaskedBankRoutingNumber != nil {
- structMap["masked_bank_routing_number"] = s.MaskedBankRoutingNumber
- }
- if s.VaultToken != nil {
- structMap["vault_token"] = s.VaultToken
- }
- if s.ChargifyToken != nil {
- structMap["chargify_token"] = s.ChargifyToken
- }
- if s.SiteGatewaySettingId != nil {
- structMap["site_gateway_setting_id"] = s.SiteGatewaySettingId
- }
- if s.GatewayHandle != nil {
- structMap["gateway_handle"] = s.GatewayHandle
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for SubscriptionBankAccount.
-// It customizes the JSON unmarshaling process for SubscriptionBankAccount objects.
-func (s *SubscriptionBankAccount) UnmarshalJSON(input []byte) error {
- temp := &struct {
- BankAccountHolderType *string `json:"bank_account_holder_type,omitempty"`
- BankAccountType *string `json:"bank_account_type,omitempty"`
- BankName *string `json:"bank_name,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingAddress2 *string `json:"billing_address_2,omitempty"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
- CustomerId *int `json:"customer_id,omitempty"`
- CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- Id *int `json:"id,omitempty"`
- MaskedBankAccountNumber *string `json:"masked_bank_account_number,omitempty"`
- MaskedBankRoutingNumber *string `json:"masked_bank_routing_number,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
- ChargifyToken *string `json:"chargify_token,omitempty"`
- SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
- GatewayHandle *string `json:"gateway_handle,omitempty"`
- }{}
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
-
- s.BankAccountHolderType = temp.BankAccountHolderType
- s.BankAccountType = temp.BankAccountType
- s.BankName = temp.BankName
- s.BillingAddress = temp.BillingAddress
- s.BillingAddress2 = temp.BillingAddress2
- s.BillingCity = temp.BillingCity
- s.BillingState = temp.BillingState
- s.BillingZip = temp.BillingZip
- s.BillingCountry = temp.BillingCountry
- s.CurrentVault = temp.CurrentVault
- s.CustomerId = temp.CustomerId
- s.CustomerVaultToken = temp.CustomerVaultToken
- s.FirstName = temp.FirstName
- s.LastName = temp.LastName
- s.Id = temp.Id
- s.MaskedBankAccountNumber = temp.MaskedBankAccountNumber
- s.MaskedBankRoutingNumber = temp.MaskedBankRoutingNumber
- s.VaultToken = temp.VaultToken
- s.ChargifyToken = temp.ChargifyToken
- s.SiteGatewaySettingId = temp.SiteGatewaySettingId
- s.GatewayHandle = temp.GatewayHandle
- return nil
-}
diff --git a/models/subscription_group_bank_account.go b/models/subscription_group_bank_account.go
index ff45692b..422590bd 100644
--- a/models/subscription_group_bank_account.go
+++ b/models/subscription_group_bank_account.go
@@ -7,27 +7,29 @@ import (
// SubscriptionGroupBankAccount represents a SubscriptionGroupBankAccount struct.
type SubscriptionGroupBankAccount struct {
// (Required when creating a subscription with ACH or GoCardless) The name of the bank where the customer’s account resides
- BankName *string `json:"bank_name,omitempty"`
+ BankName *string `json:"bank_name,omitempty"`
// (Required when creating a subscription with ACH. Required when creating a subscription with GoCardless and bank_iban is blank) The customerʼs bank account number
- BankAccountNumber *string `json:"bank_account_number,omitempty"`
+ BankAccountNumber *string `json:"bank_account_number,omitempty"`
// (Required when creating a subscription with ACH. Optional when creating a subscription with GoCardless). The routing number of the bank. It becomes bank_code while passing via GoCardless API
- BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
+ BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
// (Optional when creating a subscription with GoCardless). International Bank Account Number. Alternatively, local bank details can be provided
- BankIban *string `json:"bank_iban,omitempty"`
+ BankIban *string `json:"bank_iban,omitempty"`
// (Optional when creating a subscription with GoCardless) Branch code. Alternatively, an IBAN can be provided
- BankBranchCode *string `json:"bank_branch_code,omitempty"`
- BankAccountType *BankAccountType `json:"bank_account_type,omitempty"`
- BankAccountHolderType *HolderType `json:"bank_account_holder_type,omitempty"`
- PaymentType *string `json:"payment_type,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- ChargifyToken *string `json:"chargify_token,omitempty"`
+ BankBranchCode *string `json:"bank_branch_code,omitempty"`
+ // Defaults to checking
+ BankAccountType *BankAccountType `json:"bank_account_type,omitempty"`
+ // Defaults to personal
+ BankAccountHolderType *BankAccountHolderType `json:"bank_account_holder_type,omitempty"`
+ PaymentType *PaymentType `json:"payment_type,omitempty"`
+ BillingAddress *string `json:"billing_address,omitempty"`
+ BillingCity *string `json:"billing_city,omitempty"`
+ BillingState *string `json:"billing_state,omitempty"`
+ BillingZip *string `json:"billing_zip,omitempty"`
+ BillingCountry *string `json:"billing_country,omitempty"`
+ ChargifyToken *string `json:"chargify_token,omitempty"`
// The vault that stores the payment profile with the provided vault_token.
- CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
- GatewayHandle *string `json:"gateway_handle,omitempty"`
+ CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
+ GatewayHandle *string `json:"gateway_handle,omitempty"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupBankAccount.
@@ -96,22 +98,22 @@ func (s *SubscriptionGroupBankAccount) toMap() map[string]any {
// It customizes the JSON unmarshaling process for SubscriptionGroupBankAccount objects.
func (s *SubscriptionGroupBankAccount) UnmarshalJSON(input []byte) error {
temp := &struct {
- BankName *string `json:"bank_name,omitempty"`
- BankAccountNumber *string `json:"bank_account_number,omitempty"`
- BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
- BankIban *string `json:"bank_iban,omitempty"`
- BankBranchCode *string `json:"bank_branch_code,omitempty"`
- BankAccountType *BankAccountType `json:"bank_account_type,omitempty"`
- BankAccountHolderType *HolderType `json:"bank_account_holder_type,omitempty"`
- PaymentType *string `json:"payment_type,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- ChargifyToken *string `json:"chargify_token,omitempty"`
- CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
- GatewayHandle *string `json:"gateway_handle,omitempty"`
+ BankName *string `json:"bank_name,omitempty"`
+ BankAccountNumber *string `json:"bank_account_number,omitempty"`
+ BankRoutingNumber *string `json:"bank_routing_number,omitempty"`
+ BankIban *string `json:"bank_iban,omitempty"`
+ BankBranchCode *string `json:"bank_branch_code,omitempty"`
+ BankAccountType *BankAccountType `json:"bank_account_type,omitempty"`
+ BankAccountHolderType *BankAccountHolderType `json:"bank_account_holder_type,omitempty"`
+ PaymentType *PaymentType `json:"payment_type,omitempty"`
+ BillingAddress *string `json:"billing_address,omitempty"`
+ BillingCity *string `json:"billing_city,omitempty"`
+ BillingState *string `json:"billing_state,omitempty"`
+ BillingZip *string `json:"billing_zip,omitempty"`
+ BillingCountry *string `json:"billing_country,omitempty"`
+ ChargifyToken *string `json:"chargify_token,omitempty"`
+ CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
+ GatewayHandle *string `json:"gateway_handle,omitempty"`
}{}
err := json.Unmarshal(input, &temp)
if err != nil {
diff --git a/models/subscription_group_credit_card.go b/models/subscription_group_credit_card.go
index 69a67d50..30b7fe49 100644
--- a/models/subscription_group_credit_card.go
+++ b/models/subscription_group_credit_card.go
@@ -23,7 +23,8 @@ type SubscriptionGroupCreditCard struct {
BillingZip *string `json:"billing_zip,omitempty"`
BillingCountry *string `json:"billing_country,omitempty"`
LastFour *string `json:"last_four,omitempty"`
- CardType *string `json:"card_type,omitempty"`
+ // The type of card used.
+ CardType *CardType `json:"card_type,omitempty"`
CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
Cvv *string `json:"cvv,omitempty"`
PaymentType *string `json:"payment_type,omitempty"`
@@ -123,7 +124,7 @@ func (s *SubscriptionGroupCreditCard) UnmarshalJSON(input []byte) error {
BillingZip *string `json:"billing_zip,omitempty"`
BillingCountry *string `json:"billing_country,omitempty"`
LastFour *string `json:"last_four,omitempty"`
- CardType *string `json:"card_type,omitempty"`
+ CardType *CardType `json:"card_type,omitempty"`
CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
Cvv *string `json:"cvv,omitempty"`
PaymentType *string `json:"payment_type,omitempty"`
diff --git a/models/update_component_price_point.go b/models/update_component_price_point.go
index 98a56695..9a08b1c2 100644
--- a/models/update_component_price_point.go
+++ b/models/update_component_price_point.go
@@ -6,12 +6,19 @@ import (
// UpdateComponentPricePoint represents a UpdateComponentPricePoint struct.
type UpdateComponentPricePoint struct {
- Name *string `json:"name,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Handle *string `json:"handle,omitempty"`
+ // The identifier for the pricing scheme. See [Product Components](https://help.chargify.com/products/product-components.html) for an overview of pricing schemes.
+ PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
+ // Whether to use the site level exchange rate or define your own prices for each currency if you have multiple currencies defined on the site.
+ UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
+ // Whether or not the price point includes tax
+ TaxIncluded *bool `json:"tax_included,omitempty"`
// The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component price point would renew every 30 days. This property is only available for sites with Multifrequency enabled.
- Interval *int `json:"interval,omitempty"`
+ Interval *int `json:"interval,omitempty"`
// A string representing the interval unit for this component price point, either month or day. This property is only available for sites with Multifrequency enabled.
- IntervalUnit *IntervalUnit `json:"interval_unit,omitempty"`
- Prices []UpdatePrice `json:"prices,omitempty"`
+ IntervalUnit *IntervalUnit `json:"interval_unit,omitempty"`
+ Prices []UpdatePrice `json:"prices,omitempty"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateComponentPricePoint.
@@ -28,6 +35,18 @@ func (u *UpdateComponentPricePoint) toMap() map[string]any {
if u.Name != nil {
structMap["name"] = u.Name
}
+ if u.Handle != nil {
+ structMap["handle"] = u.Handle
+ }
+ if u.PricingScheme != nil {
+ structMap["pricing_scheme"] = u.PricingScheme
+ }
+ if u.UseSiteExchangeRate != nil {
+ structMap["use_site_exchange_rate"] = u.UseSiteExchangeRate
+ }
+ if u.TaxIncluded != nil {
+ structMap["tax_included"] = u.TaxIncluded
+ }
if u.Interval != nil {
structMap["interval"] = u.Interval
}
@@ -44,10 +63,14 @@ func (u *UpdateComponentPricePoint) toMap() map[string]any {
// It customizes the JSON unmarshaling process for UpdateComponentPricePoint objects.
func (u *UpdateComponentPricePoint) UnmarshalJSON(input []byte) error {
temp := &struct {
- Name *string `json:"name,omitempty"`
- Interval *int `json:"interval,omitempty"`
- IntervalUnit *IntervalUnit `json:"interval_unit,omitempty"`
- Prices []UpdatePrice `json:"prices,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Handle *string `json:"handle,omitempty"`
+ PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
+ UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
+ TaxIncluded *bool `json:"tax_included,omitempty"`
+ Interval *int `json:"interval,omitempty"`
+ IntervalUnit *IntervalUnit `json:"interval_unit,omitempty"`
+ Prices []UpdatePrice `json:"prices,omitempty"`
}{}
err := json.Unmarshal(input, &temp)
if err != nil {
@@ -55,6 +78,10 @@ func (u *UpdateComponentPricePoint) UnmarshalJSON(input []byte) error {
}
u.Name = temp.Name
+ u.Handle = temp.Handle
+ u.PricingScheme = temp.PricingScheme
+ u.UseSiteExchangeRate = temp.UseSiteExchangeRate
+ u.TaxIncluded = temp.TaxIncluded
u.Interval = temp.Interval
u.IntervalUnit = temp.IntervalUnit
u.Prices = temp.Prices
diff --git a/models/update_payment_profile_response.go b/models/update_payment_profile_response.go
deleted file mode 100644
index 8f15ecc6..00000000
--- a/models/update_payment_profile_response.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package models
-
-import (
- "encoding/json"
-)
-
-// UpdatePaymentProfileResponse represents a UpdatePaymentProfileResponse struct.
-type UpdatePaymentProfileResponse struct {
- PaymentProfile UpdatedPaymentProfile `json:"payment_profile"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for UpdatePaymentProfileResponse.
-// It customizes the JSON marshaling process for UpdatePaymentProfileResponse objects.
-func (u *UpdatePaymentProfileResponse) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(u.toMap())
-}
-
-// toMap converts the UpdatePaymentProfileResponse object to a map representation for JSON marshaling.
-func (u *UpdatePaymentProfileResponse) toMap() map[string]any {
- structMap := make(map[string]any)
- structMap["payment_profile"] = u.PaymentProfile
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for UpdatePaymentProfileResponse.
-// It customizes the JSON unmarshaling process for UpdatePaymentProfileResponse objects.
-func (u *UpdatePaymentProfileResponse) UnmarshalJSON(input []byte) error {
- temp := &struct {
- PaymentProfile UpdatedPaymentProfile `json:"payment_profile"`
- }{}
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
-
- u.PaymentProfile = temp.PaymentProfile
- return nil
-}
diff --git a/models/update_price.go b/models/update_price.go
index 8303108e..a69dfb36 100644
--- a/models/update_price.go
+++ b/models/update_price.go
@@ -6,11 +6,12 @@ import (
// UpdatePrice represents a UpdatePrice struct.
type UpdatePrice struct {
- Id *int `json:"id,omitempty"`
- EndingQuantity *int `json:"ending_quantity,omitempty"`
- UnitPrice *int `json:"unit_price,omitempty"`
- Destroy *string `json:"_destroy,omitempty"`
- StartingQuantity *int `json:"starting_quantity,omitempty"`
+ Id *int `json:"id,omitempty"`
+ EndingQuantity *interface{} `json:"ending_quantity,omitempty"`
+ // The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065
+ UnitPrice *interface{} `json:"unit_price,omitempty"`
+ Destroy *bool `json:"_destroy,omitempty"`
+ StartingQuantity *interface{} `json:"starting_quantity,omitempty"`
}
// MarshalJSON implements the json.Marshaler interface for UpdatePrice.
@@ -46,11 +47,11 @@ func (u *UpdatePrice) toMap() map[string]any {
// It customizes the JSON unmarshaling process for UpdatePrice objects.
func (u *UpdatePrice) UnmarshalJSON(input []byte) error {
temp := &struct {
- Id *int `json:"id,omitempty"`
- EndingQuantity *int `json:"ending_quantity,omitempty"`
- UnitPrice *int `json:"unit_price,omitempty"`
- Destroy *string `json:"_destroy,omitempty"`
- StartingQuantity *int `json:"starting_quantity,omitempty"`
+ Id *int `json:"id,omitempty"`
+ EndingQuantity *interface{} `json:"ending_quantity,omitempty"`
+ UnitPrice *interface{} `json:"unit_price,omitempty"`
+ Destroy *bool `json:"_destroy,omitempty"`
+ StartingQuantity *interface{} `json:"starting_quantity,omitempty"`
}{}
err := json.Unmarshal(input, &temp)
if err != nil {
diff --git a/models/updated_payment_profile.go b/models/updated_payment_profile.go
deleted file mode 100644
index 9930f64f..00000000
--- a/models/updated_payment_profile.go
+++ /dev/null
@@ -1,157 +0,0 @@
-package models
-
-import (
- "encoding/json"
-)
-
-// UpdatedPaymentProfile represents a UpdatedPaymentProfile struct.
-type UpdatedPaymentProfile struct {
- Id *int `json:"id,omitempty"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- CardType *string `json:"card_type,omitempty"`
- ExpirationMonth *int `json:"expiration_month,omitempty"`
- ExpirationYear *int `json:"expiration_year,omitempty"`
- CustomerId *int `json:"customer_id,omitempty"`
- // The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing.
- CurrentVault *CurrentVault `json:"current_vault,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingAddress2 *string `json:"billing_address_2,omitempty"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- PaymentType *string `json:"payment_type,omitempty"`
- SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
- GatewayHandle Optional[string] `json:"gateway_handle"`
- MaskedCardNumber *string `json:"masked_card_number,omitempty"`
- CustomerVaultToken Optional[string] `json:"customer_vault_token"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for UpdatedPaymentProfile.
-// It customizes the JSON marshaling process for UpdatedPaymentProfile objects.
-func (u *UpdatedPaymentProfile) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(u.toMap())
-}
-
-// toMap converts the UpdatedPaymentProfile object to a map representation for JSON marshaling.
-func (u *UpdatedPaymentProfile) toMap() map[string]any {
- structMap := make(map[string]any)
- if u.Id != nil {
- structMap["id"] = u.Id
- }
- if u.FirstName != nil {
- structMap["first_name"] = u.FirstName
- }
- if u.LastName != nil {
- structMap["last_name"] = u.LastName
- }
- if u.CardType != nil {
- structMap["card_type"] = u.CardType
- }
- if u.ExpirationMonth != nil {
- structMap["expiration_month"] = u.ExpirationMonth
- }
- if u.ExpirationYear != nil {
- structMap["expiration_year"] = u.ExpirationYear
- }
- if u.CustomerId != nil {
- structMap["customer_id"] = u.CustomerId
- }
- if u.CurrentVault != nil {
- structMap["current_vault"] = u.CurrentVault
- }
- if u.VaultToken != nil {
- structMap["vault_token"] = u.VaultToken
- }
- if u.BillingAddress != nil {
- structMap["billing_address"] = u.BillingAddress
- }
- if u.BillingAddress2 != nil {
- structMap["billing_address_2"] = u.BillingAddress2
- }
- if u.BillingCity != nil {
- structMap["billing_city"] = u.BillingCity
- }
- if u.BillingState != nil {
- structMap["billing_state"] = u.BillingState
- }
- if u.BillingZip != nil {
- structMap["billing_zip"] = u.BillingZip
- }
- if u.BillingCountry != nil {
- structMap["billing_country"] = u.BillingCountry
- }
- if u.PaymentType != nil {
- structMap["payment_type"] = u.PaymentType
- }
- if u.SiteGatewaySettingId != nil {
- structMap["site_gateway_setting_id"] = u.SiteGatewaySettingId
- }
- if u.GatewayHandle.IsValueSet() {
- structMap["gateway_handle"] = u.GatewayHandle.Value()
- }
- if u.MaskedCardNumber != nil {
- structMap["masked_card_number"] = u.MaskedCardNumber
- }
- if u.CustomerVaultToken.IsValueSet() {
- structMap["customer_vault_token"] = u.CustomerVaultToken.Value()
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for UpdatedPaymentProfile.
-// It customizes the JSON unmarshaling process for UpdatedPaymentProfile objects.
-func (u *UpdatedPaymentProfile) UnmarshalJSON(input []byte) error {
- temp := &struct {
- Id *int `json:"id,omitempty"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- CardType *string `json:"card_type,omitempty"`
- ExpirationMonth *int `json:"expiration_month,omitempty"`
- ExpirationYear *int `json:"expiration_year,omitempty"`
- CustomerId *int `json:"customer_id,omitempty"`
- CurrentVault *CurrentVault `json:"current_vault,omitempty"`
- VaultToken *string `json:"vault_token,omitempty"`
- BillingAddress *string `json:"billing_address,omitempty"`
- BillingAddress2 *string `json:"billing_address_2,omitempty"`
- BillingCity *string `json:"billing_city,omitempty"`
- BillingState *string `json:"billing_state,omitempty"`
- BillingZip *string `json:"billing_zip,omitempty"`
- BillingCountry *string `json:"billing_country,omitempty"`
- PaymentType *string `json:"payment_type,omitempty"`
- SiteGatewaySettingId *int `json:"site_gateway_setting_id,omitempty"`
- GatewayHandle Optional[string] `json:"gateway_handle"`
- MaskedCardNumber *string `json:"masked_card_number,omitempty"`
- CustomerVaultToken Optional[string] `json:"customer_vault_token"`
- }{}
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
-
- u.Id = temp.Id
- u.FirstName = temp.FirstName
- u.LastName = temp.LastName
- u.CardType = temp.CardType
- u.ExpirationMonth = temp.ExpirationMonth
- u.ExpirationYear = temp.ExpirationYear
- u.CustomerId = temp.CustomerId
- u.CurrentVault = temp.CurrentVault
- u.VaultToken = temp.VaultToken
- u.BillingAddress = temp.BillingAddress
- u.BillingAddress2 = temp.BillingAddress2
- u.BillingCity = temp.BillingCity
- u.BillingState = temp.BillingState
- u.BillingZip = temp.BillingZip
- u.BillingCountry = temp.BillingCountry
- u.PaymentType = temp.PaymentType
- u.SiteGatewaySettingId = temp.SiteGatewaySettingId
- u.GatewayHandle = temp.GatewayHandle
- u.MaskedCardNumber = temp.MaskedCardNumber
- u.CustomerVaultToken = temp.CustomerVaultToken
- return nil
-}
diff --git a/models/usage.go b/models/usage.go
index a7ccbe08..73a2fef3 100644
--- a/models/usage.go
+++ b/models/usage.go
@@ -8,7 +8,7 @@ import (
// Usage represents a Usage struct.
type Usage struct {
- Id *int `json:"id,omitempty"`
+ Id *int64 `json:"id,omitempty"`
Memo *string `json:"memo,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
PricePointId *int `json:"price_point_id,omitempty"`
@@ -64,7 +64,7 @@ func (u *Usage) toMap() map[string]any {
// It customizes the JSON unmarshaling process for Usage objects.
func (u *Usage) UnmarshalJSON(input []byte) error {
temp := &struct {
- Id *int `json:"id,omitempty"`
+ Id *int64 `json:"id,omitempty"`
Memo *string `json:"memo,omitempty"`
CreatedAt *string `json:"created_at,omitempty"`
PricePointId *int `json:"price_point_id,omitempty"`
diff --git a/offers_controller.go b/offers_controller.go
index 2745b799..a346cf71 100644
--- a/offers_controller.go
+++ b/offers_controller.go
@@ -58,7 +58,7 @@ func (o *OffersController) CreateOffer(
}
if resp.StatusCode == 422 {
- err = errors.NewErrorMapResponse(422, "Unprocessable Entity (WebDAV)")
+ err = errors.NewErrorArrayMapResponse(422, "Unprocessable Entity (WebDAV)")
}
return models.NewApiResponse(result, resp), err
}
diff --git a/payment_profiles_controller.go b/payment_profiles_controller.go
index 5a3370bf..352d9317 100644
--- a/payment_profiles_controller.go
+++ b/payment_profiles_controller.go
@@ -22,7 +22,7 @@ func NewPaymentProfilesController(baseController baseController) *PaymentProfile
}
// CreatePaymentProfile takes context, body as parameters and
-// returns an models.ApiResponse with models.CreatePaymentProfileResponse data and
+// returns an models.ApiResponse with models.PaymentProfileResponse data and
// an error if there was an issue with the request or response.
// Use this endpoint to create a payment profile for a customer.
// Payment Profiles house the credit card, ACH (Authorize.Net or Stripe only,) or PayPal (Braintree only,) data for a customer. The payment information is attached to the customer within Chargify, as opposed to the Subscription itself.
@@ -211,7 +211,7 @@ func NewPaymentProfilesController(baseController baseController) *PaymentProfile
func (p *PaymentProfilesController) CreatePaymentProfile(
ctx context.Context,
body *models.CreatePaymentProfileRequest) (
- models.ApiResponse[models.CreatePaymentProfileResponse],
+ models.ApiResponse[models.PaymentProfileResponse],
error) {
req := p.prepareRequest(ctx, "POST", "/payment_profiles.json")
req.Authenticate(true)
@@ -219,7 +219,7 @@ func (p *PaymentProfilesController) CreatePaymentProfile(
if body != nil {
req.Json(*body)
}
- var result models.CreatePaymentProfileResponse
+ var result models.PaymentProfileResponse
decoder, resp, err := req.CallAsJson()
if err != nil {
return models.NewApiResponse(result, resp), err
@@ -229,7 +229,7 @@ func (p *PaymentProfilesController) CreatePaymentProfile(
return models.NewApiResponse(result, resp), err
}
- result, err = utilities.DecodeResults[models.CreatePaymentProfileResponse](decoder)
+ result, err = utilities.DecodeResults[models.PaymentProfileResponse](decoder)
if err != nil {
return models.NewApiResponse(result, resp), err
}
@@ -244,7 +244,7 @@ func (p *PaymentProfilesController) CreatePaymentProfile(
}
// ListPaymentProfiles takes context, page, perPage, customerId as parameters and
-// returns an models.ApiResponse with []models.ListPaymentProfilesResponse data and
+// returns an models.ApiResponse with []models.PaymentProfileResponse data and
// an error if there was an issue with the request or response.
// This method will return all of the active `payment_profiles` for a Site, or for one Customer within a site. If no payment profiles are found, this endpoint will return an empty array, not a 404.
func (p *PaymentProfilesController) ListPaymentProfiles(
@@ -252,7 +252,7 @@ func (p *PaymentProfilesController) ListPaymentProfiles(
page *int,
perPage *int,
customerId *int) (
- models.ApiResponse[[]models.ListPaymentProfilesResponse],
+ models.ApiResponse[[]models.PaymentProfileResponse],
error) {
req := p.prepareRequest(ctx, "GET", "/payment_profiles.json")
req.Authenticate(true)
@@ -265,7 +265,7 @@ func (p *PaymentProfilesController) ListPaymentProfiles(
if customerId != nil {
req.QueryParam("customer_id", *customerId)
}
- var result []models.ListPaymentProfilesResponse
+ var result []models.PaymentProfileResponse
decoder, resp, err := req.CallAsJson()
if err != nil {
return models.NewApiResponse(result, resp), err
@@ -275,7 +275,7 @@ func (p *PaymentProfilesController) ListPaymentProfiles(
return models.NewApiResponse(result, resp), err
}
- result, err = utilities.DecodeResults[[]models.ListPaymentProfilesResponse](decoder)
+ result, err = utilities.DecodeResults[[]models.PaymentProfileResponse](decoder)
if err != nil {
return models.NewApiResponse(result, resp), err
}
@@ -284,7 +284,7 @@ func (p *PaymentProfilesController) ListPaymentProfiles(
}
// ReadPaymentProfile takes context, paymentProfileId as parameters and
-// returns an models.ApiResponse with models.ReadPaymentProfileResponse data and
+// returns an models.ApiResponse with models.PaymentProfileResponse data and
// an error if there was an issue with the request or response.
// Using the GET method you can retrieve a Payment Profile identified by its unique ID.
// Please note that a different JSON object will be returned if the card method on file is a bank account.
@@ -319,8 +319,8 @@ func (p *PaymentProfilesController) ListPaymentProfiles(
// ```
func (p *PaymentProfilesController) ReadPaymentProfile(
ctx context.Context,
- paymentProfileId string) (
- models.ApiResponse[models.ReadPaymentProfileResponse],
+ paymentProfileId int) (
+ models.ApiResponse[models.PaymentProfileResponse],
error) {
req := p.prepareRequest(
ctx,
@@ -329,7 +329,7 @@ func (p *PaymentProfilesController) ReadPaymentProfile(
)
req.Authenticate(true)
- var result models.ReadPaymentProfileResponse
+ var result models.PaymentProfileResponse
decoder, resp, err := req.CallAsJson()
if err != nil {
return models.NewApiResponse(result, resp), err
@@ -339,16 +339,19 @@ func (p *PaymentProfilesController) ReadPaymentProfile(
return models.NewApiResponse(result, resp), err
}
- result, err = utilities.DecodeResults[models.ReadPaymentProfileResponse](decoder)
+ result, err = utilities.DecodeResults[models.PaymentProfileResponse](decoder)
if err != nil {
return models.NewApiResponse(result, resp), err
}
+ if resp.StatusCode == 404 {
+ err = errors.NewApiError(404, "Not Found")
+ }
return models.NewApiResponse(result, resp), err
}
// UpdatePaymentProfile takes context, paymentProfileId, body as parameters and
-// returns an models.ApiResponse with models.UpdatePaymentProfileResponse data and
+// returns an models.ApiResponse with models.PaymentProfileResponse data and
// an error if there was an issue with the request or response.
// ## Partial Card Updates
// In the event that you are using the Authorize.net, Stripe, Cybersource, Forte or Braintree Blue payment gateways, you can update just the billing and contact information for a payment method. Note the lack of credit-card related data contained in the JSON payload.
@@ -376,9 +379,9 @@ func (p *PaymentProfilesController) ReadPaymentProfile(
// - If you are using Authorize.net or Stripe, you may elect to manually trigger a retry for a past due subscription after a partial update.
func (p *PaymentProfilesController) UpdatePaymentProfile(
ctx context.Context,
- paymentProfileId string,
+ paymentProfileId int,
body *models.UpdatePaymentProfileRequest) (
- models.ApiResponse[models.UpdatePaymentProfileResponse],
+ models.ApiResponse[models.PaymentProfileResponse],
error) {
req := p.prepareRequest(
ctx,
@@ -391,7 +394,7 @@ func (p *PaymentProfilesController) UpdatePaymentProfile(
req.Json(*body)
}
- var result models.UpdatePaymentProfileResponse
+ var result models.PaymentProfileResponse
decoder, resp, err := req.CallAsJson()
if err != nil {
return models.NewApiResponse(result, resp), err
@@ -401,11 +404,17 @@ func (p *PaymentProfilesController) UpdatePaymentProfile(
return models.NewApiResponse(result, resp), err
}
- result, err = utilities.DecodeResults[models.UpdatePaymentProfileResponse](decoder)
+ result, err = utilities.DecodeResults[models.PaymentProfileResponse](decoder)
if err != nil {
return models.NewApiResponse(result, resp), err
}
+ if resp.StatusCode == 404 {
+ err = errors.NewApiError(404, "Not Found")
+ }
+ if resp.StatusCode == 422 {
+ err = errors.NewErrorStringMapResponse(422, "Unprocessable Entity (WebDAV)")
+ }
return models.NewApiResponse(result, resp), err
}
@@ -416,7 +425,7 @@ func (p *PaymentProfilesController) UpdatePaymentProfile(
// If the payment profile is in use by one or more subscriptions or groups, a 422 and error message will be returned.
func (p *PaymentProfilesController) DeleteUnusedPaymentProfile(
ctx context.Context,
- paymentProfileId string) (
+ paymentProfileId int) (
*http.Response,
error) {
req := p.prepareRequest(
@@ -434,6 +443,9 @@ func (p *PaymentProfilesController) DeleteUnusedPaymentProfile(
if err != nil {
return context.Response, err
}
+ if context.Response.StatusCode == 404 {
+ err = errors.NewApiError(404, "Not Found")
+ }
if context.Response.StatusCode == 422 {
err = errors.NewErrorListResponse(422, "Unprocessable Entity (WebDAV)")
}
@@ -449,7 +461,7 @@ func (p *PaymentProfilesController) DeleteUnusedPaymentProfile(
func (p *PaymentProfilesController) DeleteSubscriptionsPaymentProfile(
ctx context.Context,
subscriptionId int,
- paymentProfileId string) (
+ paymentProfileId int) (
*http.Response,
error) {
req := p.prepareRequest(
@@ -523,7 +535,7 @@ func (p *PaymentProfilesController) VerifyBankAccount(
func (p *PaymentProfilesController) DeleteSubscriptionGroupPaymentProfile(
ctx context.Context,
uid string,
- paymentProfileId string) (
+ paymentProfileId int) (
*http.Response,
error) {
req := p.prepareRequest(
@@ -577,6 +589,9 @@ func (p *PaymentProfilesController) UpdateSubscriptionDefaultPaymentProfile(
return models.NewApiResponse(result, resp), err
}
+ if resp.StatusCode == 404 {
+ err = errors.NewApiError(404, "Not Found")
+ }
if resp.StatusCode == 422 {
err = errors.NewErrorListResponse(422, "Unprocessable Entity (WebDAV)")
}
@@ -592,7 +607,7 @@ func (p *PaymentProfilesController) UpdateSubscriptionDefaultPaymentProfile(
func (p *PaymentProfilesController) UpdateSubscriptionGroupDefaultPaymentProfile(
ctx context.Context,
uid string,
- paymentProfileId string) (
+ paymentProfileId int) (
models.ApiResponse[models.PaymentProfileResponse],
error) {
req := p.prepareRequest(
diff --git a/product_price_points_controller.go b/product_price_points_controller.go
index d094750e..049009ea 100644
--- a/product_price_points_controller.go
+++ b/product_price_points_controller.go
@@ -383,7 +383,7 @@ func (p *ProductPricePointsController) CreateProductCurrencyPrices(
}
if resp.StatusCode == 422 {
- err = errors.NewErrorMapResponse(422, "Unprocessable Entity (WebDAV)")
+ err = errors.NewErrorArrayMapResponse(422, "Unprocessable Entity (WebDAV)")
}
return models.NewApiResponse(result, resp), err
}
@@ -427,7 +427,7 @@ func (p *ProductPricePointsController) UpdateProductCurrencyPrices(
}
if resp.StatusCode == 422 {
- err = errors.NewErrorMapResponse(422, "Unprocessable Entity (WebDAV)")
+ err = errors.NewErrorArrayMapResponse(422, "Unprocessable Entity (WebDAV)")
}
return models.NewApiResponse(result, resp), err
}
diff --git a/proforma_invoices_controller.go b/proforma_invoices_controller.go
index 7262f3a8..78ded5c4 100644
--- a/proforma_invoices_controller.go
+++ b/proforma_invoices_controller.go
@@ -382,7 +382,7 @@ func (p *ProformaInvoicesController) CreateSignupProformaInvoice(
err = errors.NewProformaBadRequestErrorResponse(400, "Bad Request")
}
if resp.StatusCode == 422 {
- err = errors.NewErrorMapResponse(422, "Unprocessable Entity (WebDAV)")
+ err = errors.NewErrorArrayMapResponse(422, "Unprocessable Entity (WebDAV)")
}
return models.NewApiResponse(result, resp), err
}
@@ -432,7 +432,7 @@ func (p *ProformaInvoicesController) PreviewSignupProformaInvoice(
err = errors.NewProformaBadRequestErrorResponse(400, "Bad Request")
}
if resp.StatusCode == 422 {
- err = errors.NewErrorMapResponse(422, "Unprocessable Entity (WebDAV)")
+ err = errors.NewErrorArrayMapResponse(422, "Unprocessable Entity (WebDAV)")
}
return models.NewApiResponse(result, resp), err
}
diff --git a/subscriptions_controller.go b/subscriptions_controller.go
index 41a10ab7..1a4b8f7e 100644
--- a/subscriptions_controller.go
+++ b/subscriptions_controller.go
@@ -1062,7 +1062,7 @@ func (s *SubscriptionsController) ActivateSubscription(
}
if resp.StatusCode == 400 {
- err = errors.NewNestedErrorResponse(400, "Bad Request")
+ err = errors.NewErrorArrayMapResponse(400, "Bad Request")
}
return models.NewApiResponse(result, resp), err
}