From 740cd1e7d2ea4919b4d85e781ccec4f4d5ffe8eb Mon Sep 17 00:00:00 2001
From: maciej-nedza <76946708+maciej-nedza@users.noreply.github.com>
Date: Fri, 13 Dec 2024 16:22:00 +0100
Subject: [PATCH] [DE-1091] Release 6.0.0 (#37)
---
.github/workflows/build.yml | 1 -
README.md | 20 +-
client.go | 22 +-
component_price_points_controller.go | 18 +-
configuration.go | 44 +--
coupons_controller.go | 32 ++-
default_configuration.go | 5 +-
doc/client.md | 10 +-
doc/controllers/advance-invoice.md | 2 +-
doc/controllers/component-price-points.md | 136 +++++----
doc/controllers/components.md | 55 ++--
doc/controllers/coupons.md | 108 ++++---
doc/controllers/custom-fields.md | 24 +-
doc/controllers/customers.md | 38 +--
.../events-based-billing-segments.md | 12 +-
doc/controllers/events.md | 44 ++-
doc/controllers/insights.md | 2 +-
doc/controllers/invoices.md | 76 ++---
doc/controllers/offers.md | 26 +-
doc/controllers/payment-profiles.md | 34 +--
doc/controllers/product-families.md | 22 +-
doc/controllers/product-price-points.md | 53 ++--
doc/controllers/products.md | 2 +-
doc/controllers/proforma-invoices.md | 4 +-
doc/controllers/reason-codes.md | 19 +-
doc/controllers/subscription-components.md | 72 +++--
.../subscription-group-invoice-account.md | 18 +-
doc/controllers/subscription-group-status.md | 4 +-
doc/controllers/subscription-groups.md | 30 +-
.../subscription-invoice-account.md | 26 +-
doc/controllers/subscription-notes.md | 30 +-
doc/controllers/subscription-products.md | 4 +-
doc/controllers/subscription-status.md | 31 +-
doc/controllers/subscriptions.md | 79 ++---
doc/controllers/webhooks.md | 8 +-
doc/models/add-subscription-to-a-group.md | 2 +-
.../change-invoice-status-event-data.md | 2 +-
doc/models/change-invoice-status-event.md | 4 +-
doc/models/component-price-point.md | 6 +
doc/models/component.md | 2 +-
doc/models/compounding-strategy.md | 2 +
.../add-subscription-to-a-group-group.md | 14 -
.../containers/coupon-payload-percentage.md | 14 +
.../create-or-update-coupon-coupon.md | 14 -
...-or-update-percentage-coupon-percentage.md | 14 -
.../containers/event-event-specific-data.md | 3 +-
doc/models/coupon-currency-response.md | 6 +-
doc/models/coupon-currency.md | 6 +-
doc/models/coupon-payload.md | 38 +++
...-or-update-coupon.md => coupon-request.md} | 19 +-
doc/models/coupon.md | 11 +-
doc/models/create-component-price-point.md | 4 +-
doc/models/create-ebb-component.md | 10 +-
doc/models/create-invoice-coupon.md | 2 +-
doc/models/create-metered-component.md | 24 +-
doc/models/create-on-off-component.md | 11 +-
.../create-or-update-flat-amount-coupon.md | 40 ---
.../create-or-update-percentage-coupon.md | 40 ---
doc/models/create-prepaid-component.md | 20 +-
...ate-prepaid-usage-component-price-point.md | 6 +-
doc/models/create-subscription.md | 2 +-
doc/models/currency-price.md | 4 +-
doc/models/currency-prices-response.md | 2 +-
doc/models/ebb-component.md | 15 +-
doc/models/event-key.md | 92 ++++++
doc/models/event-response.md | 2 +-
doc/models/event-type.md | 46 ---
doc/models/event.md | 4 +-
doc/models/invoice-avatax-details.md | 29 ++
doc/models/invoice-debit.md | 32 +++
doc/models/invoice-line-item.md | 1 +
doc/models/invoice-status.md | 1 +
doc/models/invoice.md | 3 +
doc/models/issue-invoice-event-data.md | 4 +-
doc/models/issue-invoice-event.md | 4 +-
doc/models/metered-component.md | 13 +-
...-codes-json-response.md => ok-response.md} | 6 +-
doc/models/on-off-component.md | 25 +-
doc/models/paid-invoice.md | 2 +-
doc/models/prepaid-component-price-point.md | 49 ----
doc/models/prepaid-usage-component.md | 34 ++-
doc/models/quantity-based-component.md | 1 -
doc/models/subscription-group-member-error.md | 25 --
...> subscription-group-signup-event-data.md} | 14 +-
.../subscription-group-signup-success-data.md | 40 ---
.../subscription-group-signup-success.md | 42 ---
...n-group-update-error-response-exception.md | 12 +-
doc/models/subscription-group-update-error.md | 20 +-
.../subscription-response-error-exception.md | 27 ++
doc/models/update-currency-price.md | 4 +-
doc/models/update-currency-prices-request.md | 2 +-
doc/models/update-subscription.md | 2 +-
errors/errors.go | 20 ++
events_controller.go | 43 +--
go.mod | 2 +-
go.sum | 4 +-
models/account_balance.go | 18 +-
models/account_balances.go | 22 +-
models/ach_agreement.go | 20 +-
models/activate_event_based_component.go | 18 +-
models/activate_subscription_request.go | 14 +-
models/add_coupons_request.go | 14 +-
models/add_subscription_to_a_group.go | 16 +-
models/add_subscription_to_a_group_group.go | 96 -------
models/address_change.go | 16 +-
models/agreement_acceptance.go | 24 +-
models/allocate_components.go | 28 +-
models/allocation.go | 12 +-
models/allocation_expiration_date.go | 14 +-
models/allocation_preview.go | 12 +-
models/allocation_preview_item.go | 12 +-
models/allocation_preview_line_item.go | 12 +-
models/allocation_preview_response.go | 14 +-
models/allocation_response.go | 14 +-
models/allocation_settings.go | 18 +-
models/apple_pay_payment_profile.go | 44 +--
models/applied_credit_note_data.go | 16 +-
models/apply_credit_note_event.go | 12 +-
models/apply_credit_note_event_data.go | 12 +-
models/apply_debit_note_event.go | 12 +-
models/apply_debit_note_event_data.go | 24 +-
models/apply_payment_event.go | 22 +-
models/apply_payment_event_data.go | 12 +-
models/attribute_error.go | 14 +-
models/auto_resume.go | 14 +-
models/backport_invoice_event.go | 22 +-
models/bank_account_attributes.go | 12 +-
models/bank_account_payment_profile.go | 12 +-
models/bank_account_response.go | 12 +-
models/bank_account_verification.go | 16 +-
models/bank_account_verification_request.go | 12 +-
models/base_refund_error.go | 14 +-
models/base_string_error.go | 14 +-
models/batch_job.go | 22 +-
models/batch_job_response.go | 14 +-
models/billing_manifest.go | 30 +-
models/billing_manifest_item.go | 12 +-
models/billing_schedule.go | 14 +-
models/breakouts.go | 20 +-
.../bulk_components_price_point_assignment.go | 12 +-
...ulk_create_product_price_points_request.go | 12 +-
...lk_create_product_price_points_response.go | 14 +-
models/bulk_create_segments.go | 14 +-
models/bulk_update_segments.go | 12 +-
models/bulk_update_segments_item.go | 12 +-
models/calendar_billing.go | 12 +-
.../cancel_grouped_subscriptions_request.go | 14 +-
models/cancellation_options.go | 16 +-
models/cancellation_request.go | 14 +-
models/change_chargeback_status_event.go | 12 +-
models/change_chargeback_status_event_data.go | 14 +-
.../change_invoice_collection_method_event.go | 12 +-
...ge_invoice_collection_method_event_data.go | 16 +-
models/change_invoice_status_event.go | 12 +-
models/change_invoice_status_event_data.go | 12 +-
models/chargify_ebb.go | 24 +-
models/component.go | 14 +-
models/component_allocation_change.go | 12 +-
models/component_allocation_error_item.go | 20 +-
models/component_cost_data.go | 12 +-
models/component_cost_data_rate_tier.go | 22 +-
models/component_currency_price.go | 24 +-
models/component_currency_prices_response.go | 12 +-
models/component_custom_price.go | 12 +-
models/component_price.go | 28 +-
models/component_price_point.go | 130 ++++++---
models/component_price_point_assignment.go | 12 +-
models/component_price_point_error_item.go | 18 +-
models/component_price_point_item.go | 12 +-
models/component_price_point_response.go | 14 +-
models/component_price_points_response.go | 16 +-
models/component_response.go | 14 +-
models/consolidated_invoice.go | 14 +-
models/count_response.go | 14 +-
models/coupon.go | 27 +-
models/coupon_currency.go | 44 +--
models/coupon_currency_request.go | 12 +-
models/coupon_currency_response.go | 14 +-
models/coupon_payload.go | 156 ++++++++++
models/coupon_payload_percentage.go | 96 +++++++
models/coupon_request.go | 75 +++++
models/coupon_response.go | 14 +-
models/coupon_restriction.go | 22 +-
models/coupon_subcodes.go | 14 +-
models/coupon_subcodes_response.go | 18 +-
models/coupon_usage.go | 26 +-
models/create_allocation.go | 12 +-
models/create_allocation_request.go | 14 +-
models/create_component_price_point.go | 16 +-
.../create_component_price_point_request.go | 12 +-
.../create_component_price_points_request.go | 12 +-
models/create_credit_note_event.go | 22 +-
models/create_currency_price.go | 18 +-
models/create_currency_prices_request.go | 14 +-
models/create_customer.go | 50 ++--
models/create_customer_request.go | 14 +-
models/create_debit_note_event.go | 22 +-
models/create_ebb_component.go | 14 +-
models/create_invoice.go | 32 ++-
models/create_invoice_address.go | 30 +-
models/create_invoice_coupon.go | 13 +-
models/create_invoice_item.go | 12 +-
models/create_invoice_payment.go | 12 +-
models/create_invoice_payment_application.go | 16 +-
models/create_invoice_payment_request.go | 16 +-
models/create_invoice_request.go | 14 +-
models/create_metadata.go | 16 +-
models/create_metadata_request.go | 14 +-
models/create_metafield.go | 20 +-
models/create_metafields_request.go | 12 +-
models/create_metered_component.go | 14 +-
models/create_multi_invoice_payment.go | 12 +-
.../create_multi_invoice_payment_request.go | 12 +-
models/create_offer.go | 12 +-
models/create_offer_component.go | 18 +-
models/create_offer_request.go | 14 +-
models/create_on_off_component.go | 14 +-
models/create_or_update_coupon.go | 71 -----
models/create_or_update_coupon_coupon.go | 96 -------
models/create_or_update_endpoint.go | 16 +-
models/create_or_update_endpoint_request.go | 12 +-
models/create_or_update_flat_amount_coupon.go | 156 ----------
models/create_or_update_percentage_coupon.go | 156 ----------
..._or_update_percentage_coupon_percentage.go | 96 -------
models/create_or_update_product.go | 12 +-
models/create_or_update_product_request.go | 14 +-
models/create_or_update_segment_price.go | 12 +-
models/create_payment.go | 12 +-
models/create_payment_profile.go | 12 +-
models/create_payment_profile_request.go | 14 +-
models/create_prepaid_component.go | 14 +-
...ate_prepaid_usage_component_price_point.go | 18 +-
models/create_prepayment.go | 12 +-
models/create_prepayment_request.go | 14 +-
models/create_prepayment_response.go | 14 +-
models/create_product_currency_price.go | 18 +-
.../create_product_currency_prices_request.go | 12 +-
models/create_product_family.go | 18 +-
models/create_product_family_request.go | 14 +-
models/create_product_price_point.go | 12 +-
models/create_product_price_point_request.go | 12 +-
models/create_quantity_based_component.go | 12 +-
models/create_reason_code.go | 18 +-
models/create_reason_code_request.go | 14 +-
models/create_segment.go | 12 +-
models/create_segment_request.go | 14 +-
models/create_subscription.go | 24 +-
models/create_subscription_component.go | 12 +-
models/create_subscription_group.go | 16 +-
models/create_subscription_group_request.go | 12 +-
models/create_subscription_request.go | 14 +-
models/create_usage.go | 20 +-
models/create_usage_request.go | 14 +-
models/created_prepayment.go | 26 +-
models/credit_account_balance_changed.go | 22 +-
models/credit_card_attributes.go | 18 +-
models/credit_card_payment_profile.go | 56 ++--
models/credit_note.go | 12 +-
models/credit_note_application.go | 22 +-
models/credit_note_line_item.go | 48 ++--
models/credit_scheme_request.go | 14 +-
models/currency_price.go | 36 ++-
models/currency_prices_response.go | 14 +-
models/custom_field_value_change.go | 26 +-
models/customer.go | 72 ++---
models/customer_attributes.go | 52 ++--
models/customer_change.go | 12 +-
models/customer_changes_preview_response.go | 14 +-
models/customer_custom_fields_change.go | 16 +-
models/customer_error.go | 14 +-
models/customer_payer_change.go | 16 +-
models/customer_response.go | 14 +-
models/debit_note.go | 58 ++--
models/deduct_service_credit.go | 12 +-
models/deduct_service_credit_request.go | 14 +-
models/delayed_cancellation_response.go | 14 +-
models/delete_subscription_group_response.go | 16 +-
models/dunner_data.go | 24 +-
models/dunning_step_data.go | 28 +-
models/dunning_step_reached.go | 18 +-
models/ebb_component.go | 45 +--
models/ebb_event.go | 14 +-
models/enable_webhooks_request.go | 14 +-
models/enable_webhooks_response.go | 14 +-
models/endpoint.go | 22 +-
models/endpoint_response.go | 14 +-
models/enums.go | 271 ++++++++++++------
models/event.go | 50 +++-
models/event_based_billing_segment_error.go | 12 +-
models/event_event_specific_data.go | 36 +--
models/event_response.go | 14 +-
models/failed_payment_event.go | 12 +-
models/failed_payment_event_data.go | 12 +-
models/full_subscription_group_response.go | 12 +-
models/get_one_time_token_payment_profile.go | 54 ++--
models/get_one_time_token_request.go | 12 +-
models/group_billing.go | 18 +-
models/group_settings.go | 16 +-
models/group_target.go | 16 +-
models/historic_usage.go | 18 +-
models/invoice.go | 30 +-
models/invoice_address.go | 24 +-
models/invoice_avatax_details.go | 131 +++++++++
models/invoice_balance_item.go | 18 +-
models/invoice_credit.go | 26 +-
models/invoice_custom_field.go | 22 +-
models/invoice_customer.go | 26 +-
models/invoice_debit.go | 112 ++++++++
models/invoice_discount.go | 12 +-
models/invoice_discount_breakout.go | 18 +-
models/invoice_display_settings.go | 16 +-
models/invoice_issued.go | 12 +-
models/invoice_line_item.go | 110 +++----
.../invoice_line_item_component_cost_data.go | 14 +-
models/invoice_line_item_event_data.go | 12 +-
models/invoice_line_item_pricing_detail.go | 16 +-
models/invoice_payer.go | 24 +-
models/invoice_payer_change.go | 20 +-
models/invoice_payment.go | 36 +--
models/invoice_payment_application.go | 18 +-
models/invoice_payment_method.go | 28 +-
models/invoice_pre_payment.go | 18 +-
models/invoice_previous_balance.go | 16 +-
models/invoice_refund.go | 30 +-
models/invoice_response.go | 14 +-
models/invoice_seller.go | 20 +-
models/invoice_tax.go | 12 +-
models/invoice_tax_breakout.go | 20 +-
models/invoice_tax_component_breakout.go | 40 +--
models/issue_advance_invoice_request.go | 14 +-
models/issue_invoice_event.go | 22 +-
models/issue_invoice_event_data.go | 12 +-
models/issue_invoice_request.go | 14 +-
models/issue_service_credit.go | 12 +-
models/issue_service_credit_request.go | 14 +-
models/item_price_point_changed.go | 24 +-
models/item_price_point_data.go | 18 +-
models/list_components_filter.go | 16 +-
.../list_components_price_points_response.go | 14 +-
models/list_coupons_filter.go | 28 +-
models/list_credit_notes_response.go | 14 +-
models/list_invoice_events_response.go | 20 +-
models/list_invoices_response.go | 14 +-
models/list_metafields_response.go | 22 +-
models/list_mrr_filter.go | 14 +-
models/list_mrr_response.go | 14 +-
models/list_mrr_response_result.go | 26 +-
models/list_offers_response.go | 14 +-
models/list_prepayments_filter.go | 12 +-
models/list_price_points_filter.go | 28 +-
models/list_product_price_points_response.go | 14 +-
models/list_products_filter.go | 12 +-
models/list_proforma_invoices_meta.go | 20 +-
models/list_proforma_invoices_response.go | 12 +-
models/list_public_keys_meta.go | 20 +-
models/list_public_keys_response.go | 16 +-
models/list_sale_rep_item.go | 12 +-
models/list_segments_filter.go | 20 +-
models/list_segments_response.go | 14 +-
.../list_subcription_group_prepayment_item.go | 30 +-
models/list_subscription_components_filter.go | 16 +-
...subscription_components_for_site_filter.go | 18 +-
.../list_subscription_components_response.go | 12 +-
models/list_subscription_group_prepayment.go | 12 +-
..._subscription_group_prepayment_response.go | 12 +-
models/list_subscription_groups_item.go | 12 +-
models/list_subscription_groups_meta.go | 16 +-
models/list_subscription_groups_response.go | 12 +-
models/m_errors.go | 16 +-
models/metadata.go | 24 +-
models/metafield.go | 12 +-
models/metafield_scope.go | 26 +-
models/metered_component.go | 43 +--
models/metered_usage.go | 24 +-
models/movement.go | 30 +-
models/movement_line_item.go | 30 +-
models/mrr.go | 24 +-
models/mrr_movement.go | 20 +-
models/mrr_response.go | 14 +-
models/multi_invoice_payment.go | 12 +-
models/multi_invoice_payment_response.go | 14 +-
models/nested_subscription_group.go | 20 +-
models/net_terms.go | 22 +-
models/offer.go | 50 ++--
models/offer_discount.go | 18 +-
models/offer_item.go | 12 +-
models/offer_response.go | 14 +-
models/offer_signup_page.go | 24 +-
models/ok_response.go | 61 ++++
models/on_off_component.go | 41 ++-
models/organization_address.go | 28 +-
models/origin_invoice.go | 16 +-
models/overage_pricing.go | 16 +-
models/override_subscription.go | 22 +-
models/override_subscription_request.go | 14 +-
models/paginated_metadata.go | 22 +-
models/paid_invoice.go | 20 +-
models/pause_request.go | 14 +-
models/payer_attributes.go | 48 ++--
models/payer_error.go | 18 +-
models/payment_collection_method_changed.go | 16 +-
models/payment_for_allocation.go | 20 +-
models/payment_method_apple_pay.go | 12 +-
models/payment_method_bank_account.go | 12 +-
models/payment_method_credit_card.go | 12 +-
models/payment_method_external.go | 12 +-
models/payment_method_paypal.go | 12 +-
models/payment_profile_attributes.go | 12 +-
models/payment_profile_response.go | 14 +-
models/payment_related_events.go | 16 +-
models/paypal_payment_profile.go | 46 +--
models/pending_cancellation_change.go | 16 +-
models/portal_management_link.go | 24 +-
models/prepaid_component_price_point.go | 82 ------
models/prepaid_configuration.go | 22 +-
models/prepaid_configuration_response.go | 14 +-
models/prepaid_product_price_point_filter.go | 14 +-
.../prepaid_subscription_balance_changed.go | 20 +-
models/prepaid_usage.go | 12 +-
models/prepaid_usage_allocation_detail.go | 18 +-
models/prepaid_usage_component.go | 130 ++++-----
models/prepayment.go | 32 ++-
models/prepayment_account_balance_changed.go | 20 +-
models/prepayment_response.go | 14 +-
models/prepayments_response.go | 14 +-
models/preview_allocations_request.go | 20 +-
models/price.go | 12 +-
models/product.go | 12 +-
models/product_family.go | 26 +-
models/product_family_response.go | 14 +-
models/product_price_point.go | 12 +-
models/product_price_point_errors.go | 24 +-
models/product_price_point_response.go | 14 +-
models/product_response.go | 14 +-
models/proforma_error.go | 14 +-
models/proforma_invoice.go | 12 +-
models/proforma_invoice_credit.go | 20 +-
models/proforma_invoice_discount.go | 12 +-
models/proforma_invoice_issued.go | 12 +-
models/proforma_invoice_payment.go | 20 +-
models/proforma_invoice_tax.go | 12 +-
models/proration.go | 14 +-
models/public_key.go | 18 +-
models/public_signup_page.go | 20 +-
models/quantity_based_component.go | 19 +-
.../reactivate_subscription_group_request.go | 16 +-
.../reactivate_subscription_group_response.go | 30 +-
models/reactivate_subscription_request.go | 12 +-
models/reactivation_billing.go | 14 +-
models/reason_code.go | 26 +-
models/reason_code_response.go | 14 +-
models/reason_codes_json_response.go | 57 ----
models/record_payment_request.go | 14 +-
models/record_payment_response.go | 12 +-
models/referral_code.go | 20 +-
models/referral_validation_response.go | 14 +-
models/refund_consolidated_invoice.go | 12 +-
models/refund_invoice.go | 24 +-
models/refund_invoice_event.go | 12 +-
models/refund_invoice_event_data.go | 12 +-
models/refund_invoice_request.go | 12 +-
models/refund_prepayment.go | 12 +-
models/refund_prepayment_base_refund_error.go | 14 +-
models/refund_prepayment_request.go | 14 +-
models/refund_success.go | 18 +-
models/remove_payment_event.go | 12 +-
models/remove_payment_event_data.go | 26 +-
models/renewal_preview.go | 12 +-
models/renewal_preview_component.go | 12 +-
models/renewal_preview_line_item.go | 12 +-
models/renewal_preview_request.go | 12 +-
models/renewal_preview_response.go | 14 +-
models/replay_webhooks_request.go | 14 +-
models/replay_webhooks_response.go | 14 +-
models/resent_invitation.go | 24 +-
models/resume_options.go | 16 +-
models/revoked_invitation.go | 18 +-
models/sale_rep.go | 22 +-
models/sale_rep_item_mrr.go | 18 +-
models/sale_rep_settings.go | 26 +-
models/sale_rep_subscription.go | 32 ++-
models/segment.go | 12 +-
models/segment_price.go | 28 +-
models/segment_response.go | 14 +-
models/send_invoice_request.go | 18 +-
models/service_credit.go | 22 +-
models/service_credit_response.go | 14 +-
models/signup_proforma_preview.go | 16 +-
models/signup_proforma_preview_response.go | 14 +-
models/site.go | 44 +--
models/site_response.go | 14 +-
models/site_statistics.go | 34 ++-
models/site_summary.go | 22 +-
models/subscription.go | 12 +-
models/subscription_component.go | 12 +-
...ription_component_allocation_error_item.go | 16 +-
models/subscription_component_response.go | 12 +-
models/subscription_component_subscription.go | 16 +-
models/subscription_custom_price.go | 12 +-
models/subscription_filter.go | 12 +-
models/subscription_group.go | 12 +-
models/subscription_group_balances.go | 20 +-
models/subscription_group_bank_account.go | 12 +-
...bscription_group_component_custom_price.go | 12 +-
models/subscription_group_credit_card.go | 12 +-
models/subscription_group_customer.go | 22 +-
models/subscription_group_item.go | 32 ++-
models/subscription_group_member_error.go | 69 -----
.../subscription_group_members_array_error.go | 14 +-
models/subscription_group_payment_profile.go | 20 +-
models/subscription_group_prepayment.go | 12 +-
.../subscription_group_prepayment_request.go | 12 +-
.../subscription_group_prepayment_response.go | 22 +-
models/subscription_group_response.go | 14 +-
models/subscription_group_signup.go | 12 +-
models/subscription_group_signup_component.go | 12 +-
models/subscription_group_signup_error.go | 12 +-
...> subscription_group_signup_event_data.go} | 48 ++--
.../subscription_group_signup_failure_data.go | 12 +-
models/subscription_group_signup_item.go | 12 +-
models/subscription_group_signup_request.go | 12 +-
models/subscription_group_signup_response.go | 12 +-
models/subscription_group_signup_success.go | 79 -----
.../subscription_group_signup_success_data.go | 134 ---------
models/subscription_group_single_error.go | 14 +-
.../subscription_group_subscription_error.go | 28 +-
models/subscription_group_update_error.go | 16 +-
models/subscription_included_coupon.go | 26 +-
models/subscription_migration_preview.go | 20 +-
.../subscription_migration_preview_options.go | 32 ++-
.../subscription_migration_preview_request.go | 12 +-
...subscription_migration_preview_response.go | 12 +-
models/subscription_mrr.go | 12 +-
models/subscription_mrr_breakout.go | 16 +-
models/subscription_mrr_response.go | 14 +-
models/subscription_note.go | 24 +-
models/subscription_note_response.go | 14 +-
models/subscription_preview.go | 16 +-
models/subscription_preview_response.go | 14 +-
models/subscription_product_change.go | 16 +-
models/subscription_product_migration.go | 30 +-
.../subscription_product_migration_request.go | 12 +-
models/subscription_response.go | 14 +-
models/subscription_state_change.go | 16 +-
models/tax_configuration.go | 12 +-
models/too_many_management_link_requests.go | 16 +-
models/update_allocation_expiration_date.go | 12 +-
models/update_component.go | 12 +-
models/update_component_price_point.go | 12 +-
.../update_component_price_point_request.go | 12 +-
models/update_component_request.go | 14 +-
models/update_coupon_currency.go | 16 +-
models/update_currency_price.go | 20 +-
models/update_currency_prices_request.go | 14 +-
models/update_customer.go | 52 ++--
models/update_customer_request.go | 14 +-
models/update_metadata.go | 18 +-
models/update_metadata_request.go | 14 +-
models/update_metafield.go | 22 +-
models/update_metafields_request.go | 12 +-
models/update_payment_profile.go | 38 +--
models/update_payment_profile_request.go | 14 +-
models/update_price.go | 12 +-
models/update_product_price_point.go | 16 +-
models/update_product_price_point_request.go | 12 +-
models/update_reason_code.go | 18 +-
models/update_reason_code_request.go | 14 +-
models/update_segment.go | 12 +-
models/update_segment_request.go | 14 +-
models/update_subscription.go | 24 +-
models/update_subscription_component.go | 16 +-
models/update_subscription_group.go | 14 +-
models/update_subscription_group_request.go | 12 +-
models/update_subscription_note.go | 16 +-
models/update_subscription_note_request.go | 12 +-
models/update_subscription_request.go | 14 +-
models/upsert_prepaid_configuration.go | 20 +-
.../upsert_prepaid_configuration_request.go | 12 +-
models/usage.go | 30 +-
models/usage_response.go | 14 +-
models/utilities.go | 35 ++-
models/void_invoice.go | 14 +-
models/void_invoice_event.go | 22 +-
models/void_invoice_event_data.go | 24 +-
models/void_invoice_request.go | 14 +-
models/void_remainder_event.go | 12 +-
models/void_remainder_event_data.go | 20 +-
models/webhook.go | 36 +--
models/webhook_response.go | 14 +-
offers_controller.go | 3 +
product_families_controller.go | 33 +--
product_price_points_controller.go | 7 +-
reason_codes_controller.go | 12 +-
subscription_components_controller.go | 16 +-
subscription_notes_controller.go | 11 +
subscription_status_controller.go | 4 +
subscriptions_controller.go | 30 +-
test/component_allocations_test.go | 8 +-
test/go.mod | 2 +-
test/go.sum | 4 +-
test/site_test.go | 2 +-
test/subscription_test.go | 34 +--
test/suite.go | 19 +-
603 files changed, 7410 insertions(+), 5707 deletions(-)
delete mode 100644 doc/models/containers/add-subscription-to-a-group-group.md
create mode 100644 doc/models/containers/coupon-payload-percentage.md
delete mode 100644 doc/models/containers/create-or-update-coupon-coupon.md
delete mode 100644 doc/models/containers/create-or-update-percentage-coupon-percentage.md
create mode 100644 doc/models/coupon-payload.md
rename doc/models/{create-or-update-coupon.md => coupon-request.md} (57%)
delete mode 100644 doc/models/create-or-update-flat-amount-coupon.md
delete mode 100644 doc/models/create-or-update-percentage-coupon.md
create mode 100644 doc/models/event-key.md
delete mode 100644 doc/models/event-type.md
create mode 100644 doc/models/invoice-avatax-details.md
create mode 100644 doc/models/invoice-debit.md
rename doc/models/{reason-codes-json-response.md => ok-response.md} (70%)
delete mode 100644 doc/models/prepaid-component-price-point.md
delete mode 100644 doc/models/subscription-group-member-error.md
rename doc/models/{subscription-group-signup-failure.md => subscription-group-signup-event-data.md} (66%)
delete mode 100644 doc/models/subscription-group-signup-success-data.md
delete mode 100644 doc/models/subscription-group-signup-success.md
create mode 100644 doc/models/subscription-response-error-exception.md
delete mode 100644 models/add_subscription_to_a_group_group.go
create mode 100644 models/coupon_payload.go
create mode 100644 models/coupon_payload_percentage.go
create mode 100644 models/coupon_request.go
delete mode 100644 models/create_or_update_coupon.go
delete mode 100644 models/create_or_update_coupon_coupon.go
delete mode 100644 models/create_or_update_flat_amount_coupon.go
delete mode 100644 models/create_or_update_percentage_coupon.go
delete mode 100644 models/create_or_update_percentage_coupon_percentage.go
create mode 100644 models/invoice_avatax_details.go
create mode 100644 models/invoice_debit.go
create mode 100644 models/ok_response.go
delete mode 100644 models/prepaid_component_price_point.go
delete mode 100644 models/reason_codes_json_response.go
delete mode 100644 models/subscription_group_member_error.go
rename models/{subscription_group_signup_failure.go => subscription_group_signup_event_data.go} (50%)
delete mode 100644 models/subscription_group_signup_success.go
delete mode 100644 models/subscription_group_signup_success_data.go
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 615b7215..57a4b97c 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -9,7 +9,6 @@ on:
env:
TEST_API_KEY: ${{secrets.TEST_API_KEY}}
TEST_API_PASSWORD: ${{secrets.TEST_API_PASSWORD}}
- TEST_DOMAIN: ${{vars.TEST_DOMAIN}}
TEST_SUBDOMAIN: ${{vars.TEST_SUBDOMAIN}}
jobs:
diff --git a/README.md b/README.md
index 469fb4fb..01772ac5 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
## Introduction
Maxio Advanced Billing (formerly Chargify) provides an HTTP-based API that conforms to the principles of REST.
-One of the many reasons to use Advanced Billing is the immense feature set and surrounding community [client libraries](page:development-tools/client-libraries).
+One of the many reasons to use Advanced Billing is the immense feature set and surrounding community [client libraries](http://localhost:8080/go/development-tools/development-tools/client-libraries).
The Maxio API returns JSON responses as the primary and recommended format, but XML is also provided as a backwards compatible option for Merchants who require it.
### Steps to make your first Maxio Advanced Billing API call
@@ -38,10 +38,10 @@ The following section explains how to use the advancedbilling library in a new p
To use the package in your application, you can install the package from [pkg.go.dev](https://pkg.go.dev/) using the following command:
```bash
-$ go get github.com/maxio-com/ab-golang-sdk@v0.4.2
+$ go get github.com/maxio-com/ab-golang-sdk@v5.0.0
```
-You can also view the package at: https://pkg.go.dev/github.com/maxio-com/ab-golang-sdk@v0.4.2
+You can also view the package at: https://pkg.go.dev/github.com/maxio-com/ab-golang-sdk@v5.0.0
## Initialize the API Client
@@ -51,9 +51,8 @@ The following parameters are configurable for the API Client:
| Parameter | Type | Description |
| --- | --- | --- |
-| `subdomain` | `string` | The subdomain for your Advanced Billing site.
*Default*: `"subdomain"` |
-| `domain` | `string` | The Advanced Billing server domain.
*Default*: `"chargify.com"` |
-| `environment` | `Environment` | The API environment.
**Default: `Environment.PRODUCTION`** |
+| `site` | `string` | The subdomain for your Advanced Billing site.
*Default*: `"subdomain"` |
+| `environment` | `Environment` | The API environment.
**Default: `Environment.US`** |
| `httpConfiguration` | [`HttpConfiguration`](doc/http-configuration.md) | Configurable http client options like timeout and retries. |
| `basicAuthCredentials` | [`BasicAuthCredentials`](doc/auth/basic-authentication.md) | The Credentials Setter for Basic Authentication |
@@ -67,15 +66,14 @@ client := advancedbilling.NewClient(
advancedbilling.WithTimeout(120),
),
),
- advancedbilling.WithEnvironment(advancedbilling.PRODUCTION),
+ advancedbilling.WithEnvironment(advancedbilling.US),
advancedbilling.WithBasicAuthCredentials(
advancedbilling.NewBasicAuthCredentials(
"BasicAuthUserName",
"BasicAuthPassword",
),
),
- advancedbilling.WithSubdomain("subdomain"),
- advancedbilling.WithDomain("chargify.com"),
+ advancedbilling.WithSite("subdomain"),
),
)
```
@@ -88,8 +86,8 @@ The SDK can be configured to use a different environment for making API calls. A
| Name | Description |
| --- | --- |
-| production | **Default** Production server |
-| environment2 | Production server |
+| US | **Default** Default Advanced Billing environment hosted in US. Valid for the majority of our customers. |
+| EU | Advanced Billing environment hosted in EU. Use only when you requested EU hosting for your AB account. |
## Authorization
diff --git a/client.go b/client.go
index b19c20cb..d3ec43aa 100644
--- a/client.go
+++ b/client.go
@@ -98,11 +98,11 @@ func NewClient(configuration Configuration) ClientInterface {
configuration: configuration,
}
- client.userAgent = utilities.UpdateUserAgent("AB SDK Go:0.4.2 on OS {os-info}")
+ client.userAgent = utilities.UpdateUserAgent("AB SDK Go:5.0.0 on OS {os-info}")
client.callBuilderFactory = callBuilderHandler(
func(server string) string {
if server == "" {
- server = "default"
+ server = "production"
}
return getBaseUri(Server(server), client.configuration)
},
@@ -334,14 +334,20 @@ func (c *client) GetCallBuilder() https.CallBuilderFactory {
func getBaseUri(
server Server,
configuration Configuration) string {
- if configuration.Environment() == Environment(PRODUCTION) {
- if server == Server(ENUMDEFAULT) {
- return fmt.Sprintf("https://%v.%v", configuration.Subdomain(), configuration.Domain())
+ if configuration.Environment() == Environment(US) {
+ if server == Server(PRODUCTION) {
+ return fmt.Sprintf("https://%v.chargify.com", configuration.Site())
+ }
+ if server == Server(EBB) {
+ return fmt.Sprintf("https://events.chargify.com/%v", configuration.Site())
}
}
- if configuration.Environment() == Environment(ENVIRONMENT2) {
- if server == Server(ENUMDEFAULT) {
- return "https://events.chargify.com"
+ if configuration.Environment() == Environment(EU) {
+ if server == Server(PRODUCTION) {
+ return fmt.Sprintf("https://%v.ebilling.maxio.com", configuration.Site())
+ }
+ if server == Server(EBB) {
+ return fmt.Sprintf("https://events.chargify.com/%v", configuration.Site())
}
}
return "TODO: Select a valid server."
diff --git a/component_price_points_controller.go b/component_price_points_controller.go
index ff6e97a9..f7fc2eb4 100644
--- a/component_price_points_controller.go
+++ b/component_price_points_controller.go
@@ -71,6 +71,9 @@ func (c *ComponentPricePointsController) CreateComponentPricePoint(
fmt.Sprintf("/components/%v/price_points.json", componentId),
)
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorArrayMapResponse},
+ })
req.Header("Content-Type", "application/json")
if body != nil {
req.Json(body)
@@ -159,6 +162,9 @@ func (c *ComponentPricePointsController) BulkCreateComponentPricePoints(
fmt.Sprintf("/components/%v/price_points/bulk.json", componentId),
)
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
+ })
req.Header("Content-Type", "application/json")
if body != nil {
req.Json(body)
@@ -212,14 +218,15 @@ func (c *ComponentPricePointsController) UpdateComponentPricePoint(
return models.NewApiResponse(result, resp), err
}
-// ReadComponentPricePoint takes context, componentId, pricePointId as parameters and
+// ReadComponentPricePoint takes context, componentId, pricePointId, currencyPrices as parameters and
// returns an models.ApiResponse with models.ComponentPricePointResponse data and
// an error if there was an issue with the request or response.
// Use this endpoint to retrieve details for a specific component price point. You can achieve this by using either the component price point ID or handle.
func (c *ComponentPricePointsController) ReadComponentPricePoint(
ctx context.Context,
componentId models.ReadComponentPricePointComponentId,
- pricePointId models.ReadComponentPricePointPricePointId) (
+ pricePointId models.ReadComponentPricePointPricePointId,
+ currencyPrices *bool) (
models.ApiResponse[models.ComponentPricePointResponse],
error) {
req := c.prepareRequest(
@@ -228,6 +235,9 @@ func (c *ComponentPricePointsController) ReadComponentPricePoint(
fmt.Sprintf("/components/%v/price_points/%v.json", componentId, pricePointId),
)
req.Authenticate(NewAuth("BasicAuth"))
+ if currencyPrices != nil {
+ req.QueryParam("currency_prices", *currencyPrices)
+ }
var result models.ComponentPricePointResponse
decoder, resp, err := req.CallAsJson()
@@ -315,7 +325,7 @@ func (c *ComponentPricePointsController) CreateCurrencyPrices(
)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
- "422": {Message: "Unprocessable Entity (WebDAV)", Unmarshaller: errors.NewErrorArrayMapResponse},
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorArrayMapResponse},
})
req.Header("Content-Type", "application/json")
if body != nil {
@@ -350,7 +360,7 @@ func (c *ComponentPricePointsController) UpdateCurrencyPrices(
)
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
- "422": {Message: "Unprocessable Entity (WebDAV)", Unmarshaller: errors.NewErrorArrayMapResponse},
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorArrayMapResponse},
})
req.Header("Content-Type", "application/json")
if body != nil {
diff --git a/configuration.go b/configuration.go
index e6a002cd..2b1a12b0 100644
--- a/configuration.go
+++ b/configuration.go
@@ -15,8 +15,7 @@ type ConfigurationOptions func(*Configuration)
// Configuration holds configuration settings.
type Configuration struct {
environment Environment
- subdomain string
- domain string
+ site string
httpConfiguration HttpConfiguration
basicAuthCredentials BasicAuthCredentials
}
@@ -46,17 +45,10 @@ func WithEnvironment(environment Environment) ConfigurationOptions {
}
}
-// WithSubdomain is an option that sets the Subdomain in the Configuration.
-func WithSubdomain(subdomain string) ConfigurationOptions {
+// WithSite is an option that sets the Site in the Configuration.
+func WithSite(site string) ConfigurationOptions {
return func(c *Configuration) {
- c.subdomain = subdomain
- }
-}
-
-// WithDomain is an option that sets the Domain in the Configuration.
-func WithDomain(domain string) ConfigurationOptions {
- return func(c *Configuration) {
- c.domain = domain
+ c.site = site
}
}
@@ -79,14 +71,9 @@ func (c Configuration) Environment() Environment {
return c.environment
}
-// Subdomain returns the subdomain from the Configuration.
-func (c Configuration) Subdomain() string {
- return c.subdomain
-}
-
-// Domain returns the domain from the Configuration.
-func (c Configuration) Domain() string {
- return c.domain
+// Site returns the site from the Configuration.
+func (c Configuration) Site() string {
+ return c.site
}
// HttpConfiguration returns the httpConfiguration from the Configuration.
@@ -108,13 +95,9 @@ func CreateConfigurationFromEnvironment(options ...ConfigurationOptions) Configu
if environment != "" {
config.environment = Environment(environment)
}
- subdomain := os.Getenv("ADVANCEDBILLING_SUBDOMAIN")
- if subdomain != "" {
- config.subdomain = subdomain
- }
- domain := os.Getenv("ADVANCEDBILLING_DOMAIN")
- if domain != "" {
- config.domain = domain
+ site := os.Getenv("ADVANCEDBILLING_SITE")
+ if site != "" {
+ config.site = site
}
basicAuthUserName := os.Getenv("ADVANCEDBILLING_BASIC_AUTH_USER_NAME")
if basicAuthUserName != "" {
@@ -134,15 +117,16 @@ func CreateConfigurationFromEnvironment(options ...ConfigurationOptions) Configu
type Server string
const (
- ENUMDEFAULT Server = "default"
+ PRODUCTION Server = "production"
+ EBB Server = "ebb"
)
// Environment represents available environments.
type Environment string
const (
- PRODUCTION Environment = "production"
- ENVIRONMENT2 Environment = "environment2"
+ US Environment = "US"
+ EU Environment = "EU"
)
// CreateRetryConfiguration creates a new RetryConfiguration with the provided options.
diff --git a/coupons_controller.go b/coupons_controller.go
index 70f6cdd5..a8f09c41 100644
--- a/coupons_controller.go
+++ b/coupons_controller.go
@@ -35,13 +35,13 @@ func NewCouponsController(baseController baseController) *CouponsController {
// Additionally, for documentation on how to apply a coupon to a subscription within the Advanced Billing UI, please see our documentation [here](https://maxio.zendesk.com/hc/en-us/articles/24261259337101-Coupons-and-Subscriptions).
// ## Create Coupon
// This request will create a coupon, based on the provided information.
-// When creating a coupon, you must specify a product family using the `product_family_id`. If no `product_family_id` is passed, the first product family available is used. You will also need to formulate your URL to cite the Product Family ID in your request.
-// You can restrict a coupon to only apply to specific products / components by optionally passing in hashes of `restricted_products` and/or `restricted_components` in the format:
-// `{ "": boolean_value }`
+// You can create either a flat amount coupon, by specyfing `amount_in_cents`, or percentage coupon by specyfing `percentage`.
+// You can restrict a coupon to only apply to specific products / components by optionally passing in `restricted_products` and/or `restricted_components` objects in the format:
+// `{ "": boolean_value }`
func (c *CouponsController) CreateCoupon(
ctx context.Context,
productFamilyId int,
- body *models.CreateOrUpdateCoupon) (
+ body *models.CouponRequest) (
models.ApiResponse[models.CouponResponse],
error) {
req := c.prepareRequest(
@@ -123,7 +123,7 @@ func (c *CouponsController) ListCouponsForProductFamily(
return models.NewApiResponse(result, resp), err
}
-// FindCoupon takes context, productFamilyId, code as parameters and
+// FindCoupon takes context, productFamilyId, code, currencyPrices as parameters and
// returns an models.ApiResponse with models.CouponResponse data and
// an error if there was an issue with the request or response.
// You can search for a coupon via the API with the find method. By passing a code parameter, the find will attempt to locate a coupon that matches that code. If no coupon is found, a 404 is returned.
@@ -131,7 +131,8 @@ func (c *CouponsController) ListCouponsForProductFamily(
func (c *CouponsController) FindCoupon(
ctx context.Context,
productFamilyId *int,
- code *string) (
+ code *string,
+ currencyPrices *bool) (
models.ApiResponse[models.CouponResponse],
error) {
req := c.prepareRequest(ctx, "GET", "/coupons/find.json")
@@ -142,6 +143,9 @@ func (c *CouponsController) FindCoupon(
if code != nil {
req.QueryParam("code", *code)
}
+ if currencyPrices != nil {
+ req.QueryParam("currency_prices", *currencyPrices)
+ }
var result models.CouponResponse
decoder, resp, err := req.CallAsJson()
if err != nil {
@@ -152,7 +156,7 @@ func (c *CouponsController) FindCoupon(
return models.NewApiResponse(result, resp), err
}
-// ReadCoupon takes context, productFamilyId, couponId as parameters and
+// ReadCoupon takes context, productFamilyId, couponId, currencyPrices as parameters and
// returns an models.ApiResponse with models.CouponResponse data and
// an error if there was an issue with the request or response.
// You can retrieve the Coupon via the API with the Show method. You must identify the Coupon in this call by the ID parameter that Advanced Billing assigns.
@@ -162,7 +166,8 @@ func (c *CouponsController) FindCoupon(
func (c *CouponsController) ReadCoupon(
ctx context.Context,
productFamilyId int,
- couponId int) (
+ couponId int,
+ currencyPrices *bool) (
models.ApiResponse[models.CouponResponse],
error) {
req := c.prepareRequest(
@@ -171,6 +176,9 @@ func (c *CouponsController) ReadCoupon(
fmt.Sprintf("/product_families/%v/coupons/%v.json", productFamilyId, couponId),
)
req.Authenticate(NewAuth("BasicAuth"))
+ if currencyPrices != nil {
+ req.QueryParam("currency_prices", *currencyPrices)
+ }
var result models.CouponResponse
decoder, resp, err := req.CallAsJson()
@@ -193,7 +201,7 @@ func (c *CouponsController) UpdateCoupon(
ctx context.Context,
productFamilyId int,
couponId int,
- body *models.CreateOrUpdateCoupon) (
+ body *models.CouponRequest) (
models.ApiResponse[models.CouponResponse],
error) {
req := c.prepareRequest(
@@ -202,6 +210,9 @@ func (c *CouponsController) UpdateCoupon(
fmt.Sprintf("/product_families/%v/coupons/%v.json", productFamilyId, couponId),
)
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
+ })
req.Header("Content-Type", "application/json")
if body != nil {
req.Json(body)
@@ -380,6 +391,9 @@ func (c *CouponsController) CreateOrUpdateCouponCurrencyPrices(
fmt.Sprintf("/coupons/%v/currency_prices.json", couponId),
)
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorStringMapResponse},
+ })
req.Header("Content-Type", "application/json")
if body != nil {
req.Json(body)
diff --git a/default_configuration.go b/default_configuration.go
index 7cbe15fb..564b742c 100644
--- a/default_configuration.go
+++ b/default_configuration.go
@@ -36,9 +36,8 @@ func DefaultHttpConfiguration() HttpConfiguration {
// DefaultConfiguration returns the default Configuration.
func DefaultConfiguration() Configuration {
return newConfiguration(
- WithEnvironment(PRODUCTION),
- WithSubdomain("subdomain"),
- WithDomain("chargify.com"),
+ WithEnvironment(US),
+ WithSite("subdomain"),
WithHttpConfiguration(DefaultHttpConfiguration()),
)
}
diff --git a/doc/client.md b/doc/client.md
index 074ac197..fd7ebd3d 100644
--- a/doc/client.md
+++ b/doc/client.md
@@ -5,9 +5,8 @@ The following parameters are configurable for the API Client:
| Parameter | Type | Description |
| --- | --- | --- |
-| `subdomain` | `string` | The subdomain for your Advanced Billing site.
*Default*: `"subdomain"` |
-| `domain` | `string` | The Advanced Billing server domain.
*Default*: `"chargify.com"` |
-| `environment` | `Environment` | The API environment.
**Default: `Environment.PRODUCTION`** |
+| `site` | `string` | The subdomain for your Advanced Billing site.
*Default*: `"subdomain"` |
+| `environment` | `Environment` | The API environment.
**Default: `Environment.US`** |
| `httpConfiguration` | [`HttpConfiguration`](http-configuration.md) | Configurable http client options like timeout and retries. |
| `basicAuthCredentials` | [`BasicAuthCredentials`](auth/basic-authentication.md) | The Credentials Setter for Basic Authentication |
@@ -21,15 +20,14 @@ client := advancedbilling.NewClient(
advancedbilling.WithTimeout(120),
),
),
- advancedbilling.WithEnvironment(advancedbilling.PRODUCTION),
+ advancedbilling.WithEnvironment(advancedbilling.US),
advancedbilling.WithBasicAuthCredentials(
advancedbilling.NewBasicAuthCredentials(
"BasicAuthUserName",
"BasicAuthPassword",
),
),
- advancedbilling.WithSubdomain("subdomain"),
- advancedbilling.WithDomain("chargify.com"),
+ advancedbilling.WithSite("subdomain"),
),
)
```
diff --git a/doc/controllers/advance-invoice.md b/doc/controllers/advance-invoice.md
index f624a3aa..94f83669 100644
--- a/doc/controllers/advance-invoice.md
+++ b/doc/controllers/advance-invoice.md
@@ -50,7 +50,7 @@ ctx := context.Background()
subscriptionId := 222
body := models.IssueAdvanceInvoiceRequest{
- Force: models.ToPointer(true),
+ Force: models.ToPointer(true),
}
apiResponse, err := advanceInvoiceController.IssueAdvanceInvoice(ctx, subscriptionId, &body)
diff --git a/doc/controllers/component-price-points.md b/doc/controllers/component-price-points.md
index 5cc9cb82..27ed38ef 100644
--- a/doc/controllers/component-price-points.md
+++ b/doc/controllers/component-price-points.md
@@ -136,22 +136,22 @@ ctx := context.Background()
componentId := 222
body := models.CreateComponentPricePointRequest{
- PricePoint: models.CreateComponentPricePointRequestPricePointContainer.FromCreateComponentPricePoint(models.CreateComponentPricePoint{
- Name: "Wholesale",
- Handle: models.ToPointer("wholesale-handle"),
- PricingScheme: models.PricingScheme("stairstep"),
- Prices: []models.Price{
+ PricePoint: models.CreateComponentPricePointRequestPricePointContainer.FromCreateComponentPricePoint(models.CreateComponentPricePoint{
+ Name: "Wholesale",
+ Handle: models.ToPointer("wholesale-handle"),
+ PricingScheme: models.PricingScheme("stairstep"),
+ Prices: []models.Price{
models.Price{
- StartingQuantity: models.PriceStartingQuantityContainer.FromString("1"),
- EndingQuantity: models.NewOptional(models.ToPointer(models.PriceEndingQuantityContainer.FromString("100"))),
- UnitPrice: models.PriceUnitPriceContainer.FromString("5.00"),
+ StartingQuantity: models.PriceStartingQuantityContainer.FromString("1"),
+ EndingQuantity: models.NewOptional(models.ToPointer(models.PriceEndingQuantityContainer.FromString("100"))),
+ UnitPrice: models.PriceUnitPriceContainer.FromString("5.00"),
},
models.Price{
- StartingQuantity: models.PriceStartingQuantityContainer.FromString("101"),
- UnitPrice: models.PriceUnitPriceContainer.FromString("4.00"),
+ StartingQuantity: models.PriceStartingQuantityContainer.FromString("101"),
+ UnitPrice: models.PriceUnitPriceContainer.FromString("4.00"),
},
},
- UseSiteExchangeRate: models.ToPointer(false),
+ UseSiteExchangeRate: models.ToPointer(false),
}),
}
@@ -165,6 +165,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) |
+
# List Component Price Points
@@ -301,37 +307,37 @@ ctx := context.Background()
componentId := "component_id8"
body := models.CreateComponentPricePointsRequest{
- PricePoints: []models.CreateComponentPricePointsRequestPricePoints{
+ PricePoints: []models.CreateComponentPricePointsRequestPricePoints{
models.CreateComponentPricePointsRequestPricePointsContainer.FromCreateComponentPricePoint(models.CreateComponentPricePoint{
- Name: "Wholesale",
- Handle: models.ToPointer("wholesale"),
- PricingScheme: models.PricingScheme("per_unit"),
- Prices: []models.Price{
+ Name: "Wholesale",
+ Handle: models.ToPointer("wholesale"),
+ PricingScheme: models.PricingScheme("per_unit"),
+ Prices: []models.Price{
models.Price{
- StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
- UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(5)),
+ StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
+ UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(5)),
},
},
}),
models.CreateComponentPricePointsRequestPricePointsContainer.FromCreateComponentPricePoint(models.CreateComponentPricePoint{
- Name: "MSRP",
- Handle: models.ToPointer("msrp"),
- PricingScheme: models.PricingScheme("per_unit"),
- Prices: []models.Price{
+ Name: "MSRP",
+ Handle: models.ToPointer("msrp"),
+ PricingScheme: models.PricingScheme("per_unit"),
+ Prices: []models.Price{
models.Price{
- StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
- UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(4)),
+ StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
+ UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(4)),
},
},
}),
models.CreateComponentPricePointsRequestPricePointsContainer.FromCreateComponentPricePoint(models.CreateComponentPricePoint{
- Name: "Special Pricing",
- Handle: models.ToPointer("special"),
- PricingScheme: models.PricingScheme("per_unit"),
- Prices: []models.Price{
+ Name: "Special Pricing",
+ Handle: models.ToPointer("special"),
+ PricingScheme: models.PricingScheme("per_unit"),
+ Prices: []models.Price{
models.Price{
- StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
- UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(5)),
+ StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
+ UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(5)),
},
},
}),
@@ -397,6 +403,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
+
# Update Component Price Point
@@ -440,21 +452,21 @@ componentId := models.UpdateComponentPricePointComponentIdContainer.FromNumber(1
pricePointId := models.UpdateComponentPricePointPricePointIdContainer.FromNumber(188)
body := models.UpdateComponentPricePointRequest{
- PricePoint: models.ToPointer(models.UpdateComponentPricePoint{
- Name: models.ToPointer("Default"),
- Prices: []models.UpdatePrice{
+ PricePoint: models.ToPointer(models.UpdateComponentPricePoint{
+ Name: models.ToPointer("Default"),
+ Prices: []models.UpdatePrice{
models.UpdatePrice{
- Id: models.ToPointer(1),
- EndingQuantity: models.ToPointer(models.UpdatePriceEndingQuantityContainer.FromNumber(100)),
- UnitPrice: models.ToPointer(models.UpdatePriceUnitPriceContainer.FromPrecision(float64(5))),
+ Id: models.ToPointer(1),
+ EndingQuantity: models.ToPointer(models.UpdatePriceEndingQuantityContainer.FromNumber(100)),
+ UnitPrice: models.ToPointer(models.UpdatePriceUnitPriceContainer.FromPrecision(float64(5))),
},
models.UpdatePrice{
- Id: models.ToPointer(2),
- Destroy: models.ToPointer(true),
+ Id: models.ToPointer(2),
+ Destroy: models.ToPointer(true),
},
models.UpdatePrice{
- UnitPrice: models.ToPointer(models.UpdatePriceUnitPriceContainer.FromPrecision(float64(4))),
- StartingQuantity: models.ToPointer(models.UpdatePriceStartingQuantityContainer.FromNumber(101)),
+ UnitPrice: models.ToPointer(models.UpdatePriceUnitPriceContainer.FromPrecision(float64(4))),
+ StartingQuantity: models.ToPointer(models.UpdatePriceStartingQuantityContainer.FromNumber(101)),
},
},
}),
@@ -485,7 +497,8 @@ Use this endpoint to retrieve details for a specific component price point. You
ReadComponentPricePoint(
ctx context.Context,
componentId models.ReadComponentPricePointComponentId,
- pricePointId models.ReadComponentPricePointPricePointId) (
+ pricePointId models.ReadComponentPricePointPricePointId,
+ currencyPrices *bool) (
models.ApiResponse[models.ComponentPricePointResponse],
error)
```
@@ -496,6 +509,7 @@ ReadComponentPricePoint(
| --- | --- | --- | --- |
| `componentId` | [`models.ReadComponentPricePointComponentId`](../../doc/models/containers/read-component-price-point-component-id.md) | Template, Required | This is a container for one-of cases. |
| `pricePointId` | [`models.ReadComponentPricePointPricePointId`](../../doc/models/containers/read-component-price-point-price-point-id.md) | Template, Required | This is a container for one-of cases. |
+| `currencyPrices` | `*bool` | Query, Optional | Include an array of currency price data |
## Response Type
@@ -510,7 +524,9 @@ componentId := models.ReadComponentPricePointComponentIdContainer.FromNumber(144
pricePointId := models.ReadComponentPricePointPricePointIdContainer.FromNumber(188)
-apiResponse, err := componentPricePointsController.ReadComponentPricePoint(ctx, componentId, pricePointId)
+
+
+apiResponse, err := componentPricePointsController.ReadComponentPricePoint(ctx, componentId, pricePointId, nil)
if err != nil {
log.Fatalln(err)
} else {
@@ -719,16 +735,16 @@ ctx := context.Background()
pricePointId := 10
body := models.CreateCurrencyPricesRequest{
- CurrencyPrices: []models.CreateCurrencyPrice{
+ CurrencyPrices: []models.CreateCurrencyPrice{
models.CreateCurrencyPrice{
- Currency: models.ToPointer("EUR"),
- Price: models.ToPointer(float64(50)),
- PriceId: models.ToPointer(20),
+ Currency: models.ToPointer("EUR"),
+ Price: models.ToPointer(float64(50)),
+ PriceId: models.ToPointer(20),
},
models.CreateCurrencyPrice{
- Currency: models.ToPointer("EUR"),
- Price: models.ToPointer(float64(40)),
- PriceId: models.ToPointer(21),
+ Currency: models.ToPointer("EUR"),
+ Price: models.ToPointer(float64(40)),
+ PriceId: models.ToPointer(21),
},
},
}
@@ -801,14 +817,14 @@ ctx := context.Background()
pricePointId := 10
body := models.UpdateCurrencyPricesRequest{
- CurrencyPrices: []models.UpdateCurrencyPrice{
+ CurrencyPrices: []models.UpdateCurrencyPrice{
models.UpdateCurrencyPrice{
- Id: 100,
- Price: 51,
+ Id: 100,
+ Price: float64(51),
},
models.UpdateCurrencyPrice{
- Id: 101,
- Price: 41,
+ Id: 101,
+ Price: float64(41),
},
},
}
@@ -883,16 +899,16 @@ collectedInput := advancedbilling.ListAllComponentPricePointsInput{
Page: models.ToPointer(2),
PerPage: models.ToPointer(50),
Filter: models.ToPointer(models.ListPricePointsFilter{
- StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-17", func(err error) { log.Fatalln(err) })),
- EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-15", func(err error) { log.Fatalln(err) })),
- StartDatetime: models.ToPointer(parseTime(time.RFC3339, "12/19/2011 09:15:30", func(err error) { log.Fatalln(err) })),
- EndDatetime: models.ToPointer(parseTime(time.RFC3339, "06/07/2019 17:20:06", func(err error) { log.Fatalln(err) })),
- Type: []models.PricePointType{
+ StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-17", func(err error) { log.Fatalln(err) })),
+ EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-15", func(err error) { log.Fatalln(err) })),
+ StartDatetime: models.ToPointer(parseTime(time.RFC3339, "12/19/2011 09:15:30", func(err error) { log.Fatalln(err) })),
+ EndDatetime: models.ToPointer(parseTime(time.RFC3339, "06/07/2019 17:20:06", func(err error) { log.Fatalln(err) })),
+ Type: []models.PricePointType{
models.PricePointType("catalog"),
models.PricePointType("default"),
models.PricePointType("custom"),
},
- Ids: []int{
+ Ids: []int{
1,
2,
3,
diff --git a/doc/controllers/components.md b/doc/controllers/components.md
index b5f97461..dc1151fa 100644
--- a/doc/controllers/components.md
+++ b/doc/controllers/components.md
@@ -62,15 +62,15 @@ ctx := context.Background()
productFamilyId := "product_family_id4"
body := models.CreateMeteredComponent{
- MeteredComponent: models.MeteredComponent{
+ MeteredComponent: models.MeteredComponent{
Name: "Text messages",
UnitName: "text message",
Taxable: models.ToPointer(false),
PricingScheme: models.PricingScheme("per_unit"),
Prices: []models.Price{
models.Price{
- StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
- UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(1)),
+ StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
+ UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(1)),
},
},
},
@@ -309,16 +309,11 @@ ctx := context.Background()
productFamilyId := "product_family_id4"
body := models.CreateOnOffComponent{
- OnOffComponent: models.OnOffComponent{
+ OnOffComponent: models.OnOffComponent{
Name: "Annual Support Services",
Description: models.ToPointer("Prepay for support services"),
Taxable: models.ToPointer(true),
- Prices: []models.Price{
- models.Price{
- StartingQuantity: models.PriceStartingQuantityContainer.FromString("0"),
- UnitPrice: models.PriceUnitPriceContainer.FromString("100.00"),
- },
- },
+ UnitPrice: models.OnOffComponentUnitPriceContainer.FromString("100.00"),
DisplayOnHostedPage: models.ToPointer(true),
PublicSignupPageIds: []int{
320495,
@@ -420,23 +415,23 @@ productFamilyId := "product_family_id4"
body := models.CreatePrepaidComponent{
PrepaidUsageComponent: models.PrepaidUsageComponent{
Name: "Minutes",
- UnitName: models.ToPointer("minutes"),
- PricingScheme: models.ToPointer(models.PricingScheme("per_unit")),
+ UnitName: "minutes",
+ PricingScheme: models.PricingScheme("per_unit"),
UnitPrice: models.ToPointer(models.PrepaidUsageComponentUnitPriceContainer.FromPrecision(float64(2))),
- OveragePricing: models.ToPointer(models.OveragePricing{
- PricingScheme: models.PricingScheme("stairstep"),
- Prices: []models.Price{
+ OveragePricing: models.OveragePricing{
+ PricingScheme: models.PricingScheme("stairstep"),
+ Prices: []models.Price{
models.Price{
- StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
- EndingQuantity: models.NewOptional(models.ToPointer(models.PriceEndingQuantityContainer.FromNumber(100))),
- UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(3)),
+ StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
+ EndingQuantity: models.NewOptional(models.ToPointer(models.PriceEndingQuantityContainer.FromNumber(100))),
+ UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(3)),
},
models.Price{
- StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(101),
- UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(5)),
+ StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(101),
+ UnitPrice: models.PriceUnitPriceContainer.FromPrecision(float64(5)),
},
},
- }),
+ },
RolloverPrepaidRemainder: models.ToPointer(true),
RenewPrepaidAllocation: models.ToPointer(true),
ExpirationInterval: models.ToPointer(float64(15)),
@@ -562,7 +557,7 @@ ctx := context.Background()
productFamilyId := "product_family_id4"
body := models.CreateEBBComponent{
- EventBasedComponent: models.EBBComponent{
+ EventBasedComponent: models.EBBComponent{
Name: "Component Name",
UnitName: "string",
Description: models.ToPointer("string"),
@@ -571,8 +566,8 @@ body := models.CreateEBBComponent{
PricingScheme: models.PricingScheme("per_unit"),
Prices: []models.Price{
models.Price{
- StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
- UnitPrice: models.PriceUnitPriceContainer.FromString("0.49"),
+ StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
+ UnitPrice: models.PriceUnitPriceContainer.FromString("0.49"),
},
},
EventBasedBillingMetricId: 123,
@@ -820,8 +815,8 @@ productFamilyId := 140
componentId := "component_id8"
body := models.UpdateComponentRequest{
- Component: models.UpdateComponent{
- ItemCategory: models.NewOptional(models.ToPointer(models.ItemCategory("Business Software"))),
+ Component: models.UpdateComponent{
+ ItemCategory: models.NewOptional(models.ToPointer(models.ItemCategory("Business Software"))),
},
}
@@ -988,7 +983,7 @@ collectedInput := advancedbilling.ListComponentsInput{
Page: models.ToPointer(2),
PerPage: models.ToPointer(50),
Filter: models.ToPointer(models.ListComponentsFilter{
- Ids: []int{
+ Ids: []int{
1,
2,
3,
@@ -1137,8 +1132,8 @@ ctx := context.Background()
componentId := "component_id8"
body := models.UpdateComponentRequest{
- Component: models.UpdateComponent{
- ItemCategory: models.NewOptional(models.ToPointer(models.ItemCategory("Business Software"))),
+ Component: models.UpdateComponent{
+ ItemCategory: models.NewOptional(models.ToPointer(models.ItemCategory("Business Software"))),
},
}
@@ -1230,7 +1225,7 @@ collectedInput := advancedbilling.ListComponentsForProductFamilyInput{
Page: models.ToPointer(2),
PerPage: models.ToPointer(50),
Filter: models.ToPointer(models.ListComponentsFilter{
- Ids: []int{
+ Ids: []int{
1,
2,
3,
diff --git a/doc/controllers/coupons.md b/doc/controllers/coupons.md
index db83b735..01db9267 100644
--- a/doc/controllers/coupons.md
+++ b/doc/controllers/coupons.md
@@ -38,16 +38,16 @@ Additionally, for documentation on how to apply a coupon to a subscription withi
This request will create a coupon, based on the provided information.
-When creating a coupon, you must specify a product family using the `product_family_id`. If no `product_family_id` is passed, the first product family available is used. You will also need to formulate your URL to cite the Product Family ID in your request.
+You can create either a flat amount coupon, by specyfing `amount_in_cents`, or percentage coupon by specyfing `percentage`.
-You can restrict a coupon to only apply to specific products / components by optionally passing in hashes of `restricted_products` and/or `restricted_components` in the format:
-`{ "": boolean_value }`
+You can restrict a coupon to only apply to specific products / components by optionally passing in `restricted_products` and/or `restricted_components` objects in the format:
+`{ "": boolean_value }`
```go
CreateCoupon(
ctx context.Context,
productFamilyId int,
- body *models.CreateOrUpdateCoupon) (
+ body *models.CouponRequest) (
models.ApiResponse[models.CouponResponse],
error)
```
@@ -57,7 +57,7 @@ CreateCoupon(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `productFamilyId` | `int` | Template, Required | The Advanced Billing id of the product family to which the coupon belongs |
-| `body` | [`*models.CreateOrUpdateCoupon`](../../doc/models/create-or-update-coupon.md) | Body, Optional | - |
+| `body` | [`*models.CouponRequest`](../../doc/models/coupon-request.md) | Body, Optional | - |
## Response Type
@@ -70,21 +70,21 @@ ctx := context.Background()
productFamilyId := 140
-body := models.CreateOrUpdateCoupon{
- Coupon: models.ToPointer(models.CreateOrUpdateCouponCouponContainer.FromCreateOrUpdatePercentageCoupon(models.CreateOrUpdatePercentageCoupon{
- Name: "15% off",
- Code: "15OFF",
+body := models.CouponRequest{
+ Coupon: models.ToPointer(models.CouponPayload{
+ Name: models.ToPointer("15% off"),
+ Code: models.ToPointer("15OFF"),
Description: models.ToPointer("15% off for life"),
- Percentage: models.CreateOrUpdatePercentageCouponPercentageContainer.FromPrecision(float64(15)),
+ Percentage: models.ToPointer(models.CouponPayloadPercentageContainer.FromPrecision(float64(15))),
AllowNegativeBalance: models.ToPointer(false),
Recurring: models.ToPointer(false),
- EndDate: models.ToPointer(parseTime(time.RFC3339, "2012-08-29T12:00:00-04:00", func(err error) { log.Fatalln(err) })),
+ EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2012-08-29", func(err error) { log.Fatalln(err) })),
ProductFamilyId: models.ToPointer("2"),
Stackable: models.ToPointer(true),
CompoundingStrategy: models.ToPointer(models.CompoundingStrategy("compound")),
ExcludeMidPeriodAllocations: models.ToPointer(true),
ApplyOnCancelAtEndOfPeriod: models.ToPointer(true),
- })),
+ }),
RestrictedProducts: map[string]bool{
"1": true,
},
@@ -149,16 +149,16 @@ collectedInput := advancedbilling.ListCouponsForProductFamilyInput{
Page: models.ToPointer(2),
PerPage: models.ToPointer(50),
Filter: models.ToPointer(models.ListCouponsFilter{
- StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-17", func(err error) { log.Fatalln(err) })),
- EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-15", func(err error) { log.Fatalln(err) })),
- StartDatetime: models.ToPointer(parseTime(time.RFC3339, "12/19/2011 09:15:30", func(err error) { log.Fatalln(err) })),
- EndDatetime: models.ToPointer(parseTime(time.RFC3339, "06/07/2019 17:20:06", func(err error) { log.Fatalln(err) })),
- Ids: []int{
+ StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-17", func(err error) { log.Fatalln(err) })),
+ EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-15", func(err error) { log.Fatalln(err) })),
+ StartDatetime: models.ToPointer(parseTime(time.RFC3339, "12/19/2011 09:15:30", func(err error) { log.Fatalln(err) })),
+ EndDatetime: models.ToPointer(parseTime(time.RFC3339, "06/07/2019 17:20:06", func(err error) { log.Fatalln(err) })),
+ Ids: []int{
1,
2,
3,
},
- Codes: []string{
+ Codes: []string{
"free",
"free_trial",
},
@@ -278,7 +278,8 @@ If you have more than one product family and if the coupon you are trying to fin
FindCoupon(
ctx context.Context,
productFamilyId *int,
- code *string) (
+ code *string,
+ currencyPrices *bool) (
models.ApiResponse[models.CouponResponse],
error)
```
@@ -289,6 +290,7 @@ FindCoupon(
| --- | --- | --- | --- |
| `productFamilyId` | `*int` | Query, Optional | The Advanced Billing id of the product family to which the coupon belongs |
| `code` | `*string` | Query, Optional | The code of the coupon |
+| `currencyPrices` | `*bool` | Query, Optional | When fetching coupons, if you have defined multiple currencies at the site level, you can optionally pass the `?currency_prices=true` query param to include an array of currency price data in the response. |
## Response Type
@@ -303,7 +305,9 @@ ctx := context.Background()
-apiResponse, err := couponsController.FindCoupon(ctx, nil, nil)
+currencyPrices := true
+
+apiResponse, err := couponsController.FindCoupon(ctx, nil, nil, ¤cyPrices)
if err != nil {
log.Fatalln(err)
} else {
@@ -327,7 +331,8 @@ If the coupon is set to `use_site_exchange_rate: true`, it will return pricing b
ReadCoupon(
ctx context.Context,
productFamilyId int,
- couponId int) (
+ couponId int,
+ currencyPrices *bool) (
models.ApiResponse[models.CouponResponse],
error)
```
@@ -338,6 +343,7 @@ ReadCoupon(
| --- | --- | --- | --- |
| `productFamilyId` | `int` | Template, Required | The Advanced Billing id of the product family to which the coupon belongs |
| `couponId` | `int` | Template, Required | The Advanced Billing id of the coupon |
+| `currencyPrices` | `*bool` | Query, Optional | When fetching coupons, if you have defined multiple currencies at the site level, you can optionally pass the `?currency_prices=true` query param to include an array of currency price data in the response. |
## Response Type
@@ -352,7 +358,9 @@ productFamilyId := 140
couponId := 162
-apiResponse, err := couponsController.ReadCoupon(ctx, productFamilyId, couponId)
+currencyPrices := true
+
+apiResponse, err := couponsController.ReadCoupon(ctx, productFamilyId, couponId, ¤cyPrices)
if err != nil {
log.Fatalln(err)
} else {
@@ -406,7 +414,7 @@ UpdateCoupon(
ctx context.Context,
productFamilyId int,
couponId int,
- body *models.CreateOrUpdateCoupon) (
+ body *models.CouponRequest) (
models.ApiResponse[models.CouponResponse],
error)
```
@@ -417,7 +425,7 @@ UpdateCoupon(
| --- | --- | --- | --- |
| `productFamilyId` | `int` | Template, Required | The Advanced Billing id of the product family to which the coupon belongs |
| `couponId` | `int` | Template, Required | The Advanced Billing id of the coupon |
-| `body` | [`*models.CreateOrUpdateCoupon`](../../doc/models/create-or-update-coupon.md) | Body, Optional | - |
+| `body` | [`*models.CouponRequest`](../../doc/models/coupon-request.md) | Body, Optional | - |
## Response Type
@@ -432,19 +440,19 @@ productFamilyId := 140
couponId := 162
-body := models.CreateOrUpdateCoupon{
- Coupon: models.ToPointer(models.CreateOrUpdateCouponCouponContainer.FromCreateOrUpdatePercentageCoupon(models.CreateOrUpdatePercentageCoupon{
- Name: "15% off",
- Code: "15OFF",
+body := models.CouponRequest{
+ Coupon: models.ToPointer(models.CouponPayload{
+ Name: models.ToPointer("15% off"),
+ Code: models.ToPointer("15OFF"),
Description: models.ToPointer("15% off for life"),
- Percentage: models.CreateOrUpdatePercentageCouponPercentageContainer.FromPrecision(float64(15)),
+ Percentage: models.ToPointer(models.CouponPayloadPercentageContainer.FromPrecision(float64(15))),
AllowNegativeBalance: models.ToPointer(false),
Recurring: models.ToPointer(false),
- EndDate: models.ToPointer(parseTime(time.RFC3339, "2012-08-29T12:00:00-04:00", func(err error) { log.Fatalln(err) })),
+ EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2012-08-29", func(err error) { log.Fatalln(err) })),
ProductFamilyId: models.ToPointer("2"),
Stackable: models.ToPointer(true),
CompoundingStrategy: models.ToPointer(models.CompoundingStrategy("compound")),
- })),
+ }),
RestrictedProducts: map[string]bool{
"1": true,
},
@@ -493,6 +501,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
+
# Archive Coupon
@@ -605,16 +619,16 @@ collectedInput := advancedbilling.ListCouponsInput{
Page: models.ToPointer(2),
PerPage: models.ToPointer(50),
Filter: models.ToPointer(models.ListCouponsFilter{
- StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-17", func(err error) { log.Fatalln(err) })),
- EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-15", func(err error) { log.Fatalln(err) })),
- StartDatetime: models.ToPointer(parseTime(time.RFC3339, "12/19/2011 09:15:30", func(err error) { log.Fatalln(err) })),
- EndDatetime: models.ToPointer(parseTime(time.RFC3339, "06/07/2019 17:20:06", func(err error) { log.Fatalln(err) })),
- Ids: []int{
+ StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-17", func(err error) { log.Fatalln(err) })),
+ EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-15", func(err error) { log.Fatalln(err) })),
+ StartDatetime: models.ToPointer(parseTime(time.RFC3339, "12/19/2011 09:15:30", func(err error) { log.Fatalln(err) })),
+ EndDatetime: models.ToPointer(parseTime(time.RFC3339, "06/07/2019 17:20:06", func(err error) { log.Fatalln(err) })),
+ Ids: []int{
1,
2,
3,
},
- Codes: []string{
+ Codes: []string{
"free",
"free_trial",
},
@@ -892,14 +906,14 @@ ctx := context.Background()
couponId := 162
body := models.CouponCurrencyRequest{
- CurrencyPrices: []models.UpdateCouponCurrency{
+ CurrencyPrices: []models.UpdateCouponCurrency{
models.UpdateCouponCurrency{
- Currency: "EUR",
- Price: 10,
+ Currency: "EUR",
+ Price: 10,
},
models.UpdateCouponCurrency{
- Currency: "GBP",
- Price: 9,
+ Currency: "GBP",
+ Price: 9,
},
},
}
@@ -914,6 +928,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorStringMapResponseException`](../../doc/models/error-string-map-response-exception.md) |
+
# Create Coupon Subcodes
@@ -986,7 +1006,7 @@ ctx := context.Background()
couponId := 162
body := models.CouponSubcodes{
- Codes: []string{
+ Codes: []string{
"BALTIMOREFALL",
"ORLANDOFALL",
"DETROITFALL",
@@ -1133,7 +1153,7 @@ ctx := context.Background()
couponId := 162
body := models.CouponSubcodes{
- Codes: []string{
+ Codes: []string{
"AAAA",
"BBBB",
"CCCC",
diff --git a/doc/controllers/custom-fields.md b/doc/controllers/custom-fields.md
index 7926f928..261d999c 100644
--- a/doc/controllers/custom-fields.md
+++ b/doc/controllers/custom-fields.md
@@ -76,14 +76,14 @@ ctx := context.Background()
resourceType := models.ResourceType("subscriptions")
body := models.CreateMetafieldsRequest{
- Metafields: models.CreateMetafieldsRequestMetafieldsContainer.FromCreateMetafield(models.CreateMetafield{
- Name: models.ToPointer("Dropdown field"),
- Scope: models.ToPointer(models.MetafieldScope{
- PublicShow: models.ToPointer(models.IncludeOption("1")),
- PublicEdit: models.ToPointer(models.IncludeOption("1")),
+ Metafields: models.CreateMetafieldsRequestMetafieldsContainer.FromCreateMetafield(models.CreateMetafield{
+ Name: models.ToPointer("Dropdown field"),
+ Scope: models.ToPointer(models.MetafieldScope{
+ PublicShow: models.ToPointer(models.IncludeOption("1")),
+ PublicEdit: models.ToPointer(models.IncludeOption("1")),
}),
- InputType: models.ToPointer(models.MetafieldInput("dropdown")),
- Enum: []string{
+ InputType: models.ToPointer(models.MetafieldInput("dropdown")),
+ Enum: []string{
"option 1",
"option 2",
},
@@ -371,14 +371,14 @@ resourceType := models.ResourceType("subscriptions")
resourceId := 60
body := models.CreateMetadataRequest{
- Metadata: []models.CreateMetadata{
+ Metadata: []models.CreateMetadata{
models.CreateMetadata{
- Name: models.ToPointer("Color"),
- Value: models.ToPointer("Blue"),
+ Name: models.ToPointer("Color"),
+ Value: models.ToPointer("Blue"),
},
models.CreateMetadata{
- Name: models.ToPointer("Something"),
- Value: models.ToPointer("Useful"),
+ Name: models.ToPointer("Something"),
+ Value: models.ToPointer("Useful"),
},
},
}
diff --git a/doc/controllers/customers.md b/doc/controllers/customers.md
index a9dd774b..82e38d9f 100644
--- a/doc/controllers/customers.md
+++ b/doc/controllers/customers.md
@@ -70,21 +70,21 @@ CreateCustomer(
ctx := context.Background()
body := models.CreateCustomerRequest{
- Customer: models.CreateCustomer{
- FirstName: "Martha",
- LastName: "Washington",
- Email: "martha@example.com",
- CcEmails: models.ToPointer("george@example.com"),
- Organization: models.ToPointer("ABC, Inc."),
- Reference: models.ToPointer("1234567890"),
- Address: models.ToPointer("123 Main Street"),
- Address2: models.ToPointer("Unit 10"),
- City: models.ToPointer("Anytown"),
- State: models.ToPointer("MA"),
- Zip: models.ToPointer("02120"),
- Country: models.ToPointer("US"),
- Phone: models.ToPointer("555-555-1212"),
- Locale: models.ToPointer("es-MX"),
+ Customer: models.CreateCustomer{
+ FirstName: "Martha",
+ LastName: "Washington",
+ Email: "martha@example.com",
+ CcEmails: models.ToPointer("george@example.com"),
+ Organization: models.ToPointer("ABC, Inc."),
+ Reference: models.ToPointer("1234567890"),
+ Address: models.ToPointer("123 Main Street"),
+ Address2: models.ToPointer("Unit 10"),
+ City: models.ToPointer("Anytown"),
+ State: models.ToPointer("MA"),
+ Zip: models.ToPointer("02120"),
+ Country: models.ToPointer("US"),
+ Phone: models.ToPointer("555-555-1212"),
+ Locale: models.ToPointer("es-MX"),
},
}
@@ -362,10 +362,10 @@ ctx := context.Background()
id := 112
body := models.UpdateCustomerRequest{
- Customer: models.UpdateCustomer{
- FirstName: models.ToPointer("Martha"),
- LastName: models.ToPointer("Washington"),
- Email: models.ToPointer("martha.washington@example.com"),
+ Customer: models.UpdateCustomer{
+ FirstName: models.ToPointer("Martha"),
+ LastName: models.ToPointer("Washington"),
+ Email: models.ToPointer("martha.washington@example.com"),
},
}
diff --git a/doc/controllers/events-based-billing-segments.md b/doc/controllers/events-based-billing-segments.md
index ebff33bd..f38c19a3 100644
--- a/doc/controllers/events-based-billing-segments.md
+++ b/doc/controllers/events-based-billing-segments.md
@@ -56,19 +56,19 @@ componentId := "component_id8"
pricePointId := "price_point_id8"
body := models.CreateSegmentRequest{
- Segment: models.CreateSegment{
+ Segment: models.CreateSegment{
SegmentProperty1Value: models.ToPointer(models.CreateSegmentSegmentProperty1ValueContainer.FromString("France")),
SegmentProperty2Value: models.ToPointer(models.CreateSegmentSegmentProperty2ValueContainer.FromString("Spain")),
PricingScheme: models.PricingScheme("volume"),
Prices: []models.CreateOrUpdateSegmentPrice{
models.CreateOrUpdateSegmentPrice{
- StartingQuantity: models.ToPointer(1),
- EndingQuantity: models.ToPointer(10000),
- UnitPrice: models.CreateOrUpdateSegmentPriceUnitPriceContainer.FromPrecision(float64(0.19)),
+ StartingQuantity: models.ToPointer(1),
+ EndingQuantity: models.ToPointer(10000),
+ UnitPrice: models.CreateOrUpdateSegmentPriceUnitPriceContainer.FromPrecision(float64(0.19)),
},
models.CreateOrUpdateSegmentPrice{
- StartingQuantity: models.ToPointer(10001),
- UnitPrice: models.CreateOrUpdateSegmentPriceUnitPriceContainer.FromPrecision(float64(0.09)),
+ StartingQuantity: models.ToPointer(10001),
+ UnitPrice: models.CreateOrUpdateSegmentPriceUnitPriceContainer.FromPrecision(float64(0.09)),
},
},
},
diff --git a/doc/controllers/events.md b/doc/controllers/events.md
index e3e953c5..8caf0691 100644
--- a/doc/controllers/events.md
+++ b/doc/controllers/events.md
@@ -38,11 +38,17 @@ The following keys are no longer supported.
+ `zferral_revenue_post_failure` - (Specific to the deprecated Zferral integration)
+ `zferral_revenue_post_success` - (Specific to the deprecated Zferral integration)
+## Event Key
+
+The event type is identified by the key property. You can check supported keys [here](../../doc/models/event-key.md).
+
## Event Specific Data
-Event Specific Data
+Different event types may include additional data in `event_specific_data` property.
+While some events share the same schema for `event_specific_data`, others may not include it at all.
+For precise mappings from key to event_specific_data, refer to [Event](../../doc/models/event.md).
-Each event type has its own `event_specific_data` specified.
+### Example
Here’s an example event for the `subscription_product_change` event:
@@ -97,7 +103,7 @@ ListEvents(
| `sinceId` | `*int64` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `*int64` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `direction` | [`*models.Direction`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events.
**Default**: `"desc"` |
-| `filter` | [`[]models.EventType`](../../doc/models/event-type.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. |
+| `filter` | [`[]models.EventKey`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. |
| `dateField` | [`*models.ListEventsDateField`](../../doc/models/list-events-date-field.md) | Query, Optional | The type of filter you would like to apply to your search. |
| `startDate` | `*string` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. |
| `endDate` | `*string` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. |
@@ -117,9 +123,9 @@ collectedInput := advancedbilling.ListEventsInput{
Page: models.ToPointer(2),
PerPage: models.ToPointer(50),
Direction: models.ToPointer(models.Direction("desc")),
- Filter: []models.EventType{
- models.EventType("custom_field_value_change"),
- models.EventType("payment_success"),
+ Filter: []models.EventKey{
+ models.EventKey("custom_field_value_change"),
+ models.EventKey("payment_success"),
},
DateField: models.ToPointer(models.ListEventsDateField("created_at")),
}
@@ -201,7 +207,15 @@ if err != nil {
The following request will return a list of events for a subscription.
-Each event type has its own `event_specific_data` specified.
+## Event Key
+
+The event type is identified by the key property. You can check supported keys [here](../../doc/models/event-key.md).
+
+## Event Specific Data
+
+Different event types may include additional data in `event_specific_data` property.
+While some events share the same schema for `event_specific_data`, others may not include it at all.
+For precise mappings from key to event_specific_data, refer to [Event](../../doc/models/event.md).
```go
ListSubscriptionEvents(
@@ -221,7 +235,7 @@ ListSubscriptionEvents(
| `sinceId` | `*int64` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `*int64` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `direction` | [`*models.Direction`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events.
**Default**: `"desc"` |
-| `filter` | [`[]models.EventType`](../../doc/models/event-type.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. |
+| `filter` | [`[]models.EventKey`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. |
## Response Type
@@ -237,9 +251,9 @@ collectedInput := advancedbilling.ListSubscriptionEventsInput{
Page: models.ToPointer(2),
PerPage: models.ToPointer(50),
Direction: models.ToPointer(models.Direction("desc")),
- Filter: []models.EventType{
- models.EventType("custom_field_value_change"),
- models.EventType("payment_success"),
+ Filter: []models.EventKey{
+ models.EventKey("custom_field_value_change"),
+ models.EventKey("payment_success"),
},
}
@@ -318,7 +332,7 @@ ReadEventsCount(
| `sinceId` | `*int64` | Query, Optional | Returns events with an id greater than or equal to the one specified |
| `maxId` | `*int64` | Query, Optional | Returns events with an id less than or equal to the one specified |
| `direction` | [`*models.Direction`](../../doc/models/direction.md) | Query, Optional | The sort direction of the returned events.
**Default**: `"desc"` |
-| `filter` | [`[]models.EventType`](../../doc/models/event-type.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. |
+| `filter` | [`[]models.EventKey`](../../doc/models/event-key.md) | Query, Optional | You can pass multiple event keys after comma.
Use in query `filter=signup_success,payment_success`. |
## Response Type
@@ -333,9 +347,9 @@ collectedInput := advancedbilling.ReadEventsCountInput{
Page: models.ToPointer(2),
PerPage: models.ToPointer(50),
Direction: models.ToPointer(models.Direction("desc")),
- Filter: []models.EventType{
- models.EventType("custom_field_value_change"),
- models.EventType("payment_success"),
+ Filter: []models.EventKey{
+ models.EventKey("custom_field_value_change"),
+ models.EventKey("payment_success"),
},
}
diff --git a/doc/controllers/insights.md b/doc/controllers/insights.md
index d2504130..80703d4b 100644
--- a/doc/controllers/insights.md
+++ b/doc/controllers/insights.md
@@ -298,7 +298,7 @@ ctx := context.Background()
collectedInput := advancedbilling.ListMrrPerSubscriptionInput{
Filter: models.ToPointer(models.ListMrrFilter{
- SubscriptionIds: []int{
+ SubscriptionIds: []int{
1,
2,
3,
diff --git a/doc/controllers/invoices.md b/doc/controllers/invoices.md
index 787a368c..859ba853 100644
--- a/doc/controllers/invoices.md
+++ b/doc/controllers/invoices.md
@@ -67,13 +67,13 @@ ctx := context.Background()
uid := "uid0"
body := models.RefundInvoiceRequest{
- Refund: models.RefundInvoiceRequestRefundContainer.FromRefundInvoice(models.RefundInvoice{
- Amount: "100.00",
- Memo: "Refund for Basic Plan renewal",
- PaymentId: 12345,
- External: models.ToPointer(false),
- ApplyCredit: models.ToPointer(false),
- VoidInvoice: models.ToPointer(true),
+ Refund: models.RefundInvoiceRequestRefundContainer.FromRefundInvoice(models.RefundInvoice{
+ Amount: "100.00",
+ Memo: "Refund for Basic Plan renewal",
+ PaymentId: 12345,
+ External: models.ToPointer(false),
+ ApplyCredit: models.ToPointer(false),
+ VoidInvoice: models.ToPointer(true),
}),
}
@@ -1146,11 +1146,11 @@ ctx := context.Background()
uid := "uid0"
body := models.CreateInvoicePaymentRequest{
- Payment: models.CreateInvoicePayment{
- Amount: models.ToPointer(models.CreateInvoicePaymentAmountContainer.FromPrecision(float64(124.33))),
- Memo: models.ToPointer("for John Smith"),
- Method: models.ToPointer(models.InvoicePaymentMethodType("check")),
- Details: models.ToPointer("#0102"),
+ Payment: models.CreateInvoicePayment{
+ Amount: models.ToPointer(models.CreateInvoicePaymentAmountContainer.FromPrecision(float64(124.33))),
+ Memo: models.ToPointer("for John Smith"),
+ Method: models.ToPointer(models.InvoicePaymentMethodType("check")),
+ Details: models.ToPointer("#0102"),
},
}
@@ -1224,19 +1224,19 @@ RecordPaymentForMultipleInvoices(
ctx := context.Background()
body := models.CreateMultiInvoicePaymentRequest{
- Payment: models.CreateMultiInvoicePayment{
- Memo: models.ToPointer("to pay the bills"),
- Details: models.ToPointer("check number 8675309"),
- Method: models.ToPointer(models.InvoicePaymentMethodType("check")),
- Amount: models.CreateMultiInvoicePaymentAmountContainer.FromString("100.00"),
- Applications: []models.CreateInvoicePaymentApplication{
+ Payment: models.CreateMultiInvoicePayment{
+ Memo: models.ToPointer("to pay the bills"),
+ Details: models.ToPointer("check number 8675309"),
+ Method: models.ToPointer(models.InvoicePaymentMethodType("check")),
+ Amount: models.CreateMultiInvoicePaymentAmountContainer.FromString("100.00"),
+ Applications: []models.CreateInvoicePaymentApplication{
models.CreateInvoicePaymentApplication{
- InvoiceUid: "inv_8gk5bwkct3gqt",
- Amount: "50.00",
+ InvoiceUid: "inv_8gk5bwkct3gqt",
+ Amount: "50.00",
},
models.CreateInvoicePaymentApplication{
- InvoiceUid: "inv_7bc6bwkct3lyt",
- Amount: "50.00",
+ InvoiceUid: "inv_7bc6bwkct3lyt",
+ Amount: "50.00",
},
},
},
@@ -2028,11 +2028,11 @@ ctx := context.Background()
subscriptionId := 222
body := models.RecordPaymentRequest{
- Payment: models.CreatePayment{
- Amount: "10.0",
- Memo: "to pay the bills",
- PaymentDetails: "check number 8675309",
- PaymentMethod: models.InvoicePaymentMethodType("check"),
+ Payment: models.CreatePayment{
+ Amount: "10.0",
+ Memo: "to pay the bills",
+ PaymentDetails: "check number 8675309",
+ PaymentMethod: models.InvoicePaymentMethodType("check"),
},
}
@@ -2165,8 +2165,8 @@ ctx := context.Background()
uid := "uid0"
body := models.VoidInvoiceRequest{
- Void: models.VoidInvoice{
- Reason: "Duplicate invoice",
+ Void: models.VoidInvoice{
+ Reason: "Duplicate invoice",
},
}
@@ -2707,12 +2707,12 @@ ctx := context.Background()
subscriptionId := 222
body := models.CreateInvoiceRequest{
- Invoice: models.CreateInvoice{
- LineItems: []models.CreateInvoiceItem{
+ Invoice: models.CreateInvoice{
+ LineItems: []models.CreateInvoiceItem{
models.CreateInvoiceItem{
- Title: models.ToPointer("A Product"),
- Quantity: models.ToPointer(models.CreateInvoiceItemQuantityContainer.FromPrecision(float64(12))),
- UnitPrice: models.ToPointer(models.CreateInvoiceItemUnitPriceContainer.FromString("150.00")),
+ Title: models.ToPointer("A Product"),
+ Quantity: models.ToPointer(models.CreateInvoiceItemQuantityContainer.FromPrecision(float64(12))),
+ UnitPrice: models.ToPointer(models.CreateInvoiceItemUnitPriceContainer.FromString("150.00")),
},
},
},
@@ -2868,13 +2868,13 @@ ctx := context.Background()
uid := "uid0"
body := models.SendInvoiceRequest{
- RecipientEmails: []string{
+ RecipientEmails: []string{
"user0@example.com",
},
- CcRecipientEmails: []string{
+ CcRecipientEmails: []string{
"user1@example.com",
},
- BccRecipientEmails: []string{
+ BccRecipientEmails: []string{
"user2@example.com",
},
}
@@ -3275,7 +3275,7 @@ ctx := context.Background()
uid := "uid0"
body := models.IssueInvoiceRequest{
- OnFailedPayment: models.ToPointer(models.FailedPaymentAction("leave_open_invoice")),
+ OnFailedPayment: models.ToPointer(models.FailedPaymentAction("leave_open_invoice")),
}
apiResponse, err := invoicesController.IssueInvoice(ctx, uid, &body)
diff --git a/doc/controllers/offers.md b/doc/controllers/offers.md
index 02fd5661..4463564a 100644
--- a/doc/controllers/offers.md
+++ b/doc/controllers/offers.md
@@ -57,19 +57,19 @@ CreateOffer(
ctx := context.Background()
body := models.CreateOfferRequest{
- Offer: models.CreateOffer{
- Name: "Solo",
- Handle: "han_shot_first",
- Description: models.ToPointer("A Star Wars Story"),
- ProductId: 31,
- ProductPricePointId: models.ToPointer(102),
- Components: []models.CreateOfferComponent{
+ Offer: models.CreateOffer{
+ Name: "Solo",
+ Handle: "han_shot_first",
+ Description: models.ToPointer("A Star Wars Story"),
+ ProductId: 31,
+ ProductPricePointId: models.ToPointer(102),
+ Components: []models.CreateOfferComponent{
models.CreateOfferComponent{
- ComponentId: models.ToPointer(24),
- StartingQuantity: models.ToPointer(1),
+ ComponentId: models.ToPointer(24),
+ StartingQuantity: models.ToPointer(1),
},
},
- Coupons: []string{
+ Coupons: []string{
"DEF456",
},
},
@@ -234,6 +234,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
+
# Read Offer
diff --git a/doc/controllers/payment-profiles.md b/doc/controllers/payment-profiles.md
index 17d7d510..eaf3bc39 100644
--- a/doc/controllers/payment-profiles.md
+++ b/doc/controllers/payment-profiles.md
@@ -323,7 +323,7 @@ CreatePaymentProfile(
ctx := context.Background()
body := models.CreatePaymentProfileRequest{
- PaymentProfile: models.CreatePaymentProfile{
+ PaymentProfile: models.CreatePaymentProfile{
PaymentType: models.ToPointer(models.PaymentType("bank_account")),
CustomerId: models.ToPointer(123),
BankName: models.ToPointer("Best Bank"),
@@ -659,20 +659,20 @@ ctx := context.Background()
paymentProfileId := 198
body := models.UpdatePaymentProfileRequest{
- PaymentProfile: models.UpdatePaymentProfile{
- FirstName: models.ToPointer("Graham"),
- LastName: models.ToPointer("Test"),
- FullNumber: models.ToPointer("4111111111111111"),
- CardType: models.ToPointer(models.CardType("master")),
- ExpirationMonth: models.ToPointer("04"),
- ExpirationYear: models.ToPointer("2030"),
- CurrentVault: models.ToPointer(models.AllVaults("bogus")),
- BillingAddress: models.ToPointer("456 Juniper Court"),
- BillingCity: models.ToPointer("Boulder"),
- BillingState: models.ToPointer("CO"),
- BillingZip: models.ToPointer("80302"),
- BillingCountry: models.ToPointer("US"),
- BillingAddress2: models.NewOptional(models.ToPointer("billing_address_22")),
+ PaymentProfile: models.UpdatePaymentProfile{
+ FirstName: models.ToPointer("Graham"),
+ LastName: models.ToPointer("Test"),
+ FullNumber: models.ToPointer("4111111111111111"),
+ CardType: models.ToPointer(models.CardType("master")),
+ ExpirationMonth: models.ToPointer("04"),
+ ExpirationYear: models.ToPointer("2030"),
+ CurrentVault: models.ToPointer(models.AllVaults("bogus")),
+ BillingAddress: models.ToPointer("456 Juniper Court"),
+ BillingCity: models.ToPointer("Boulder"),
+ BillingState: models.ToPointer("CO"),
+ BillingZip: models.ToPointer("80302"),
+ BillingCountry: models.ToPointer("US"),
+ BillingAddress2: models.NewOptional(models.ToPointer("billing_address_22")),
},
}
@@ -849,8 +849,8 @@ bankAccountId := 252
body := models.BankAccountVerificationRequest{
BankAccountVerification: models.BankAccountVerification{
- Deposit1InCents: models.ToPointer(int64(32)),
- Deposit2InCents: models.ToPointer(int64(45)),
+ Deposit1InCents: models.ToPointer(int64(32)),
+ Deposit2InCents: models.ToPointer(int64(45)),
},
}
diff --git a/doc/controllers/product-families.md b/doc/controllers/product-families.md
index df375c56..9df0d6f0 100644
--- a/doc/controllers/product-families.md
+++ b/doc/controllers/product-families.md
@@ -37,10 +37,10 @@ ListProductsForProductFamily(
| `perPage` | `*int` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
Use in query `per_page=200`.
**Default**: `20`
**Constraints**: `<= 200` |
| `dateField` | [`*models.BasicDateField`](../../doc/models/basic-date-field.md) | Query, Optional | The type of filter you would like to apply to your search.
Use in query: `date_field=created_at`. |
| `filter` | [`*models.ListProductsFilter`](../../doc/models/list-products-filter.md) | Query, Optional | Filter to use for List Products operations |
-| `startDate` | `*string` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. |
-| `endDate` | `*string` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. |
-| `startDatetime` | `*string` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. |
-| `endDatetime` | `*string` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. |
+| `startDate` | `*time.Time` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. |
+| `endDate` | `*time.Time` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. |
+| `startDatetime` | `*time.Time` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. |
+| `endDatetime` | `*time.Time` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. |
| `includeArchived` | `*bool` | Query, Optional | Include archived products |
| `include` | [`*models.ListProductsInclude`](../../doc/models/list-products-include.md) | Query, Optional | Allows including additional data in the response. Use in query `include=prepaid_product_price_point`. |
@@ -214,9 +214,9 @@ CreateProductFamily(
ctx := context.Background()
body := models.CreateProductFamilyRequest{
- ProductFamily: models.CreateProductFamily{
- Name: "Acme Projects",
- Description: models.NewOptional(models.ToPointer("Amazing project management tool")),
+ ProductFamily: models.CreateProductFamily{
+ Name: "Acme Projects",
+ Description: models.NewOptional(models.ToPointer("Amazing project management tool")),
},
}
@@ -268,10 +268,10 @@ ListProductFamilies(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
| `dateField` | [`*models.BasicDateField`](../../doc/models/basic-date-field.md) | Query, Optional | The type of filter you would like to apply to your search.
Use in query: `date_field=created_at`. |
-| `startDate` | `*string` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. |
-| `endDate` | `*string` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. |
-| `startDatetime` | `*string` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. |
-| `endDatetime` | `*string` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. |
+| `startDate` | `*time.Time` | Query, Optional | The start date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. |
+| `endDate` | `*time.Time` | Query, Optional | The end date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. |
+| `startDatetime` | `*time.Time` | Query, Optional | The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. |
+| `endDatetime` | `*time.Time` | Query, Optional | The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. |
## Response Type
diff --git a/doc/controllers/product-price-points.md b/doc/controllers/product-price-points.md
index 09a8b0b7..f530c52d 100644
--- a/doc/controllers/product-price-points.md
+++ b/doc/controllers/product-price-points.md
@@ -55,7 +55,7 @@ ctx := context.Background()
productId := models.CreateProductPricePointProductIdContainer.FromNumber(124)
body := models.CreateProductPricePointRequest{
- PricePoint: models.CreateProductPricePoint{
+ PricePoint: models.CreateProductPricePoint{
Name: "Educational",
Handle: models.ToPointer("educational"),
PriceInCents: int64(1000),
@@ -137,6 +137,7 @@ ListProductPricePoints(
| `perPage` | `*int` | Query, Optional | This parameter indicates how many records to fetch in each request. Default value is 10. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
**Default**: `10`
**Constraints**: `<= 200` |
| `currencyPrices` | `*bool` | Query, Optional | When fetching a product's price points, if you have defined multiple currencies at the site level, you can optionally pass the ?currency_prices=true query param to include an array of currency price data in the response. If the product price point is set to use_site_exchange_rate: true, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. |
| `filterType` | [`[]models.PricePointType`](../../doc/models/price-point-type.md) | Query, Optional | Use in query: `filter[type]=catalog,default`. |
+| `archived` | `*bool` | Query, Optional | Set to include archived price points in the response. |
## Response Type
@@ -231,9 +232,9 @@ productId := models.UpdateProductPricePointProductIdContainer.FromNumber(124)
pricePointId := models.UpdateProductPricePointPricePointIdContainer.FromNumber(188)
body := models.UpdateProductPricePointRequest{
- PricePoint: models.UpdateProductPricePoint{
- Handle: models.ToPointer("educational"),
- PriceInCents: models.ToPointer(int64(1250)),
+ PricePoint: models.UpdateProductPricePoint{
+ Handle: models.ToPointer("educational"),
+ PriceInCents: models.ToPointer(int64(1250)),
},
}
@@ -629,7 +630,7 @@ ctx := context.Background()
productId := 202
body := models.BulkCreateProductPricePointsRequest{
- PricePoints: []models.CreateProductPricePoint{
+ PricePoints: []models.CreateProductPricePoint{
models.CreateProductPricePoint{
Name: "Educational",
Handle: models.ToPointer("educational"),
@@ -745,21 +746,21 @@ ctx := context.Background()
productPricePointId := 234
body := models.CreateProductCurrencyPricesRequest{
- CurrencyPrices: []models.CreateProductCurrencyPrice{
+ CurrencyPrices: []models.CreateProductCurrencyPrice{
models.CreateProductCurrencyPrice{
- Currency: "EUR",
- Price: 60,
- Role: models.CurrencyPriceRole("baseline"),
+ Currency: "EUR",
+ Price: 60,
+ Role: models.CurrencyPriceRole("baseline"),
},
models.CreateProductCurrencyPrice{
- Currency: "EUR",
- Price: 30,
- Role: models.CurrencyPriceRole("trial"),
+ Currency: "EUR",
+ Price: 30,
+ Role: models.CurrencyPriceRole("trial"),
},
models.CreateProductCurrencyPrice{
- Currency: "EUR",
- Price: 100,
- Role: models.CurrencyPriceRole("initial"),
+ Currency: "EUR",
+ Price: 100,
+ Role: models.CurrencyPriceRole("initial"),
},
},
}
@@ -834,14 +835,14 @@ ctx := context.Background()
productPricePointId := 234
body := models.UpdateCurrencyPricesRequest{
- CurrencyPrices: []models.UpdateCurrencyPrice{
+ CurrencyPrices: []models.UpdateCurrencyPrice{
models.UpdateCurrencyPrice{
- Id: 200,
- Price: 15,
+ Id: 200,
+ Price: float64(15),
},
models.UpdateCurrencyPrice{
- Id: 201,
- Price: 5,
+ Id: 201,
+ Price: float64(5),
},
},
}
@@ -913,16 +914,16 @@ ctx := context.Background()
collectedInput := advancedbilling.ListAllProductPricePointsInput{
Filter: models.ToPointer(models.ListPricePointsFilter{
- StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-17", func(err error) { log.Fatalln(err) })),
- EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-15", func(err error) { log.Fatalln(err) })),
- StartDatetime: models.ToPointer(parseTime(time.RFC3339, "12/19/2011 09:15:30", func(err error) { log.Fatalln(err) })),
- EndDatetime: models.ToPointer(parseTime(time.RFC3339, "06/07/2019 17:20:06", func(err error) { log.Fatalln(err) })),
- Type: []models.PricePointType{
+ StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-17", func(err error) { log.Fatalln(err) })),
+ EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2011-12-15", func(err error) { log.Fatalln(err) })),
+ StartDatetime: models.ToPointer(parseTime(time.RFC3339, "12/19/2011 09:15:30", func(err error) { log.Fatalln(err) })),
+ EndDatetime: models.ToPointer(parseTime(time.RFC3339, "06/07/2019 17:20:06", func(err error) { log.Fatalln(err) })),
+ Type: []models.PricePointType{
models.PricePointType("catalog"),
models.PricePointType("default"),
models.PricePointType("custom"),
},
- Ids: []int{
+ Ids: []int{
1,
2,
3,
diff --git a/doc/controllers/products.md b/doc/controllers/products.md
index 31a85ec0..27ae6541 100644
--- a/doc/controllers/products.md
+++ b/doc/controllers/products.md
@@ -53,7 +53,7 @@ ctx := context.Background()
productFamilyId := "product_family_id4"
body := models.CreateOrUpdateProductRequest{
- Product: models.CreateOrUpdateProduct{
+ Product: models.CreateOrUpdateProduct{
Name: "Gold Plan",
Handle: models.ToPointer("gold"),
Description: "This is our gold plan.",
diff --git a/doc/controllers/proforma-invoices.md b/doc/controllers/proforma-invoices.md
index 065d561a..49e9f9c1 100644
--- a/doc/controllers/proforma-invoices.md
+++ b/doc/controllers/proforma-invoices.md
@@ -444,7 +444,7 @@ CreateSignupProformaInvoice(
ctx := context.Background()
body := models.CreateSubscriptionRequest{
- Subscription: models.CreateSubscription{
+ Subscription: models.CreateSubscription{
ProductHandle: models.ToPointer("gold-product"),
CustomerAttributes: models.ToPointer(models.CustomerAttributes{
FirstName: models.ToPointer("Myra"),
@@ -510,7 +510,7 @@ ctx := context.Background()
body := models.CreateSubscriptionRequest{
- Subscription: models.CreateSubscription{
+ Subscription: models.CreateSubscription{
ProductHandle: models.ToPointer("gold-plan"),
CustomerAttributes: models.ToPointer(models.CustomerAttributes{
FirstName: models.ToPointer("first"),
diff --git a/doc/controllers/reason-codes.md b/doc/controllers/reason-codes.md
index a546fa4d..fb7ee19d 100644
--- a/doc/controllers/reason-codes.md
+++ b/doc/controllers/reason-codes.md
@@ -59,10 +59,10 @@ CreateReasonCode(
ctx := context.Background()
body := models.CreateReasonCodeRequest{
- ReasonCode: models.CreateReasonCode{
- Code: "NOTHANKYOU",
- Description: "No thank you!",
- Position: models.ToPointer(5),
+ ReasonCode: models.CreateReasonCode{
+ Code: "NOTHANKYOU",
+ Description: "No thank you!",
+ Position: models.ToPointer(5),
},
}
@@ -166,6 +166,12 @@ if err != nil {
]
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
+
# Read Reason Code
@@ -261,6 +267,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) |
# Delete Reason Code
@@ -271,7 +278,7 @@ This method gives a merchant the option to delete one reason code from the Churn
DeleteReasonCode(
ctx context.Context,
reasonCodeId int) (
- models.ApiResponse[models.ReasonCodesJsonResponse],
+ models.ApiResponse[models.OkResponse],
error)
```
@@ -283,7 +290,7 @@ DeleteReasonCode(
## Response Type
-[`models.ReasonCodesJsonResponse`](../../doc/models/reason-codes-json-response.md)
+[`models.OkResponse`](../../doc/models/ok-response.md)
## Example Usage
diff --git a/doc/controllers/subscription-components.md b/doc/controllers/subscription-components.md
index cecb9bd1..9363df98 100644
--- a/doc/controllers/subscription-components.md
+++ b/doc/controllers/subscription-components.md
@@ -145,7 +145,7 @@ collectedInput := advancedbilling.ListSubscriptionComponentsInput{
SubscriptionId: 222,
DateField: models.ToPointer(models.SubscriptionListDateField("updated_at")),
Filter: models.ToPointer(models.ListSubscriptionComponentsFilter{
- Currencies: []string{
+ Currencies: []string{
"EUR",
"USD",
},
@@ -242,18 +242,18 @@ ctx := context.Background()
subscriptionId := 222
body := models.BulkComponentsPricePointAssignment{
- Components: []models.ComponentPricePointAssignment{
+ Components: []models.ComponentPricePointAssignment{
models.ComponentPricePointAssignment{
- ComponentId: models.ToPointer(997),
- PricePoint: models.ToPointer(models.ComponentPricePointAssignmentPricePointContainer.FromNumber(1022)),
+ ComponentId: models.ToPointer(997),
+ PricePoint: models.ToPointer(models.ComponentPricePointAssignmentPricePointContainer.FromNumber(1022)),
},
models.ComponentPricePointAssignment{
- ComponentId: models.ToPointer(998),
- PricePoint: models.ToPointer(models.ComponentPricePointAssignmentPricePointContainer.FromString("wholesale-handle")),
+ ComponentId: models.ToPointer(998),
+ PricePoint: models.ToPointer(models.ComponentPricePointAssignmentPricePointContainer.FromString("wholesale-handle")),
},
models.ComponentPricePointAssignment{
- ComponentId: models.ToPointer(999),
- PricePoint: models.ToPointer(models.ComponentPricePointAssignmentPricePointContainer.FromString("_default")),
+ ComponentId: models.ToPointer(999),
+ PricePoint: models.ToPointer(models.ComponentPricePointAssignmentPricePointContainer.FromString("_default")),
},
},
}
@@ -518,7 +518,7 @@ subscriptionId := 222
componentId := 222
body := models.CreateAllocationRequest{
- Allocation: models.CreateAllocation{
+ Allocation: models.CreateAllocation{
Quantity: float64(5),
Memo: models.ToPointer("Recoding component purchase of Acme Support"),
},
@@ -1022,8 +1022,8 @@ componentId := 222
allocationId := 24
body := models.UpdateAllocationExpirationDate{
- Allocation: models.ToPointer(models.AllocationExpirationDate{
- ExpiresAt: models.ToPointer(parseTime(time.RFC3339, "2021-05-05T16:00:00", func(err error) { log.Fatalln(err) })),
+ Allocation: models.ToPointer(models.AllocationExpirationDate{
+ ExpiresAt: models.ToPointer(parseTime(time.RFC3339, "2021-05-05T16:00:00", func(err error) { log.Fatalln(err) })),
}),
}
@@ -1091,7 +1091,7 @@ componentId := 222
allocationId := 24
body := models.CreditSchemeRequest{
- CreditScheme: models.CreditScheme("none"),
+ CreditScheme: models.CreditScheme("none"),
}
resp, err := subscriptionComponentsController.DeletePrepaidUsageAllocation(ctx, subscriptionId, componentId, allocationId, &body)
@@ -1201,10 +1201,10 @@ subscriptionId := 222
componentId := models.CreateUsageComponentIdContainer.FromNumber(144)
body := models.CreateUsageRequest{
- Usage: models.CreateUsage{
- Quantity: models.ToPointer(float64(1000)),
- PricePointId: models.ToPointer("149416"),
- Memo: models.ToPointer("My memo"),
+ Usage: models.CreateUsage{
+ Quantity: models.ToPointer(float64(1000)),
+ PricePointId: models.ToPointer("149416"),
+ Memo: models.ToPointer("My memo"),
},
}
@@ -1381,19 +1381,19 @@ subscriptionId := 222
componentId := 222
body := models.ActivateEventBasedComponent{
- PricePointId: models.ToPointer(1),
- BillingSchedule: models.ToPointer(models.BillingSchedule{
- InitialBillingAt: models.ToPointer(parseTime(models.DEFAULT_DATE, "2022-01-01", func(err error) { log.Fatalln(err) })),
+ PricePointId: models.ToPointer(1),
+ BillingSchedule: models.ToPointer(models.BillingSchedule{
+ InitialBillingAt: models.ToPointer(parseTime(models.DEFAULT_DATE, "2022-01-01", func(err error) { log.Fatalln(err) })),
}),
- CustomPrice: models.ToPointer(models.ComponentCustomPrice{
- TaxIncluded: models.ToPointer(false),
- PricingScheme: models.ToPointer(models.PricingScheme("per_unit")),
- Interval: models.ToPointer(30),
- IntervalUnit: models.NewOptional(models.ToPointer(models.IntervalUnit("day"))),
- Prices: []models.Price{
+ CustomPrice: models.ToPointer(models.ComponentCustomPrice{
+ TaxIncluded: models.ToPointer(false),
+ PricingScheme: models.ToPointer(models.PricingScheme("per_unit")),
+ Interval: models.ToPointer(30),
+ IntervalUnit: models.NewOptional(models.ToPointer(models.IntervalUnit("day"))),
+ Prices: []models.Price{
models.Price{
- StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
- UnitPrice: models.PriceUnitPriceContainer.FromString("5.0"),
+ StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
+ UnitPrice: models.PriceUnitPriceContainer.FromString("5.0"),
},
},
}),
@@ -1475,7 +1475,6 @@ https://events.chargify.com/my-site-subdomain/events/my-stream-api-handle
```go
RecordEvent(
ctx context.Context,
- subdomain string,
apiHandle string,
storeUid *string,
body *models.EBBEvent) (
@@ -1487,7 +1486,6 @@ RecordEvent(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
-| `subdomain` | `string` | Template, Required | Your site's subdomain |
| `apiHandle` | `string` | Template, Required | Identifies the Stream for which the event should be published. |
| `storeUid` | `*string` | Query, Optional | If you've attached your own Keen project as an Advanced Billing event data-store, use this parameter to indicate the data-store. |
| `body` | [`*models.EBBEvent`](../../doc/models/ebb-event.md) | Body, Optional | - |
@@ -1501,20 +1499,18 @@ RecordEvent(
```go
ctx := context.Background()
-subdomain := "subdomain4"
-
apiHandle := "api_handle6"
body := models.EBBEvent{
- Chargify: models.ToPointer(models.ChargifyEBB{
+ Chargify: models.ToPointer(models.ChargifyEBB{
Timestamp: models.ToPointer(parseTime(time.RFC3339, "2020-02-27T17:45:50-05:00", func(err error) { log.Fatalln(err) })),
SubscriptionId: models.ToPointer(1),
}),
}
-resp, err := subscriptionComponentsController.RecordEvent(ctx, subdomain, apiHandle, nil, &body)
+resp, err := subscriptionComponentsController.RecordEvent(ctx, apiHandle, nil, &body)
if err != nil {
log.Fatalln(err)
} else {
@@ -1534,7 +1530,6 @@ A maximum of 1000 events can be published in a single request. A 422 will be ret
```go
BulkRecordEvents(
ctx context.Context,
- subdomain string,
apiHandle string,
storeUid *string,
body []models.EBBEvent) (
@@ -1546,7 +1541,6 @@ BulkRecordEvents(
| Parameter | Type | Tags | Description |
| --- | --- | --- | --- |
-| `subdomain` | `string` | Template, Required | Your site's subdomain |
| `apiHandle` | `string` | Template, Required | Identifies the Stream for which the events should be published. |
| `storeUid` | `*string` | Query, Optional | If you've attached your own Keen project as an Advanced Billing event data-store, use this parameter to indicate the data-store. |
| `body` | [`[]models.EBBEvent`](../../doc/models/ebb-event.md) | Body, Optional | - |
@@ -1560,22 +1554,20 @@ BulkRecordEvents(
```go
ctx := context.Background()
-subdomain := "subdomain4"
-
apiHandle := "api_handle6"
body := []models.EBBEvent{
models.EBBEvent{
- Chargify: models.ToPointer(models.ChargifyEBB{
+ Chargify: models.ToPointer(models.ChargifyEBB{
Timestamp: models.ToPointer(parseTime(time.RFC3339, "2020-02-27T17:45:50-05:00", func(err error) { log.Fatalln(err) })),
SubscriptionId: models.ToPointer(1),
}),
},
}
-resp, err := subscriptionComponentsController.BulkRecordEvents(ctx, subdomain, apiHandle, nil, body)
+resp, err := subscriptionComponentsController.BulkRecordEvents(ctx, apiHandle, nil, body)
if err != nil {
log.Fatalln(err)
} else {
@@ -1629,7 +1621,7 @@ collectedInput := advancedbilling.ListSubscriptionComponentsForSiteInput{
PerPage: models.ToPointer(50),
Sort: models.ToPointer(models.ListSubscriptionComponentsSort("updated_at")),
Filter: models.ToPointer(models.ListSubscriptionComponentsForSiteFilter{
- Currencies: []string{
+ Currencies: []string{
"EUR",
"USD",
},
diff --git a/doc/controllers/subscription-group-invoice-account.md b/doc/controllers/subscription-group-invoice-account.md
index c9424e35..b3002611 100644
--- a/doc/controllers/subscription-group-invoice-account.md
+++ b/doc/controllers/subscription-group-invoice-account.md
@@ -113,9 +113,9 @@ collectedInput := advancedbilling.ListPrepaymentsForSubscriptionGroupInput{
Page: models.ToPointer(2),
PerPage: models.ToPointer(50),
Filter: models.ToPointer(models.ListPrepaymentsFilter{
- DateField: models.ToPointer(models.ListPrepaymentDateField("created_at")),
- StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2024-01-01", func(err error) { log.Fatalln(err) })),
- EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2024-01-31", func(err error) { log.Fatalln(err) })),
+ DateField: models.ToPointer(models.ListPrepaymentDateField("created_at")),
+ StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2024-01-01", func(err error) { log.Fatalln(err) })),
+ EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2024-01-31", func(err error) { log.Fatalln(err) })),
}),
}
@@ -190,9 +190,9 @@ ctx := context.Background()
uid := "uid0"
body := models.IssueServiceCreditRequest{
- ServiceCredit: models.IssueServiceCredit{
- Amount: models.IssueServiceCreditAmountContainer.FromPrecision(float64(10)),
- Memo: models.ToPointer("Credit the group account"),
+ ServiceCredit: models.IssueServiceCredit{
+ Amount: models.IssueServiceCreditAmountContainer.FromPrecision(float64(10)),
+ Memo: models.ToPointer("Credit the group account"),
},
}
@@ -259,9 +259,9 @@ ctx := context.Background()
uid := "uid0"
body := models.DeductServiceCreditRequest{
- Deduction: models.DeductServiceCredit{
- Amount: models.DeductServiceCreditAmountContainer.FromPrecision(float64(10)),
- Memo: models.ToPointer("Deduct from group account"),
+ Deduction: models.DeductServiceCredit{
+ Amount: models.DeductServiceCreditAmountContainer.FromPrecision(float64(10)),
+ Memo: models.ToPointer("Deduct from group account"),
},
}
diff --git a/doc/controllers/subscription-group-status.md b/doc/controllers/subscription-group-status.md
index 4fd1b9d5..9e5af08c 100644
--- a/doc/controllers/subscription-group-status.md
+++ b/doc/controllers/subscription-group-status.md
@@ -50,7 +50,7 @@ ctx := context.Background()
uid := "uid0"
body := models.CancelGroupedSubscriptionsRequest{
- ChargeUnbilledUsage: models.ToPointer(true),
+ ChargeUnbilledUsage: models.ToPointer(true),
}
resp, err := subscriptionGroupStatusController.CancelSubscriptionsInGroup(ctx, uid, &body)
@@ -208,7 +208,7 @@ ctx := context.Background()
uid := "uid0"
body := models.ReactivateSubscriptionGroupRequest{
- Resume: models.ToPointer(true),
+ Resume: models.ToPointer(true),
}
apiResponse, err := subscriptionGroupStatusController.ReactivateSubscriptionGroup(ctx, uid, &body)
diff --git a/doc/controllers/subscription-groups.md b/doc/controllers/subscription-groups.md
index 653b13e9..c27a9d72 100644
--- a/doc/controllers/subscription-groups.md
+++ b/doc/controllers/subscription-groups.md
@@ -57,7 +57,7 @@ SignupWithSubscriptionGroup(
ctx := context.Background()
body := models.SubscriptionGroupSignupRequest{
- SubscriptionGroup: models.SubscriptionGroupSignup{
+ SubscriptionGroup: models.SubscriptionGroupSignup{
PaymentProfileId: models.ToPointer(123),
PayerId: models.ToPointer(123),
Subscriptions: []models.SubscriptionGroupSignupItem{
@@ -120,9 +120,9 @@ CreateSubscriptionGroup(
ctx := context.Background()
body := models.CreateSubscriptionGroupRequest{
- SubscriptionGroup: models.CreateSubscriptionGroup{
- SubscriptionId: 1,
- MemberIds: []int{
+ SubscriptionGroup: models.CreateSubscriptionGroup{
+ SubscriptionId: 1,
+ MemberIds: []int{
2,
3,
4,
@@ -384,8 +384,8 @@ ctx := context.Background()
uid := "uid0"
body := models.UpdateSubscriptionGroupRequest{
- SubscriptionGroup: models.UpdateSubscriptionGroup{
- MemberIds: []int{
+ SubscriptionGroup: models.UpdateSubscriptionGroup{
+ MemberIds: []int{
1,
2,
3,
@@ -621,17 +621,17 @@ ctx := context.Background()
subscriptionId := 222
body := models.AddSubscriptionToAGroup{
- Group: models.ToPointer(models.AddSubscriptionToAGroupGroupContainer.FromGroupSettings(models.GroupSettings{
- Target: models.GroupTarget{
- Type: models.GroupTargetType("subscription"),
- Id: models.ToPointer(32987),
+ Group: models.ToPointer(models.GroupSettings{
+ Target: models.GroupTarget{
+ Type: models.GroupTargetType("subscription"),
+ Id: models.ToPointer(32987),
},
- Billing: models.ToPointer(models.GroupBilling{
- Accrue: models.ToPointer(true),
- AlignDate: models.ToPointer(true),
- Prorate: models.ToPointer(true),
+ Billing: models.ToPointer(models.GroupBilling{
+ Accrue: models.ToPointer(true),
+ AlignDate: models.ToPointer(true),
+ Prorate: models.ToPointer(true),
}),
- })),
+ }),
}
apiResponse, err := subscriptionGroupsController.AddSubscriptionToGroup(ctx, subscriptionId, &body)
diff --git a/doc/controllers/subscription-invoice-account.md b/doc/controllers/subscription-invoice-account.md
index 24ca6e5f..d60af911 100644
--- a/doc/controllers/subscription-invoice-account.md
+++ b/doc/controllers/subscription-invoice-account.md
@@ -96,11 +96,11 @@ ctx := context.Background()
subscriptionId := 222
body := models.CreatePrepaymentRequest{
- Prepayment: models.CreatePrepayment{
- Amount: float64(100),
- Details: "John Doe signup for $100",
- Memo: "Signup for $100",
- Method: models.CreatePrepaymentMethod("check"),
+ Prepayment: models.CreatePrepayment{
+ Amount: float64(100),
+ Details: "John Doe signup for $100",
+ Memo: "Signup for $100",
+ Method: models.CreatePrepaymentMethod("check"),
},
}
@@ -172,9 +172,9 @@ collectedInput := advancedbilling.ListPrepaymentsInput{
Page: models.ToPointer(2),
PerPage: models.ToPointer(50),
Filter: models.ToPointer(models.ListPrepaymentsFilter{
- DateField: models.ToPointer(models.ListPrepaymentDateField("created_at")),
- StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2024-01-01", func(err error) { log.Fatalln(err) })),
- EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2024-01-31", func(err error) { log.Fatalln(err) })),
+ DateField: models.ToPointer(models.ListPrepaymentDateField("created_at")),
+ StartDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2024-01-01", func(err error) { log.Fatalln(err) })),
+ EndDate: models.ToPointer(parseTime(models.DEFAULT_DATE, "2024-01-31", func(err error) { log.Fatalln(err) })),
}),
}
@@ -248,8 +248,8 @@ ctx := context.Background()
subscriptionId := 222
body := models.IssueServiceCreditRequest{
- ServiceCredit: models.IssueServiceCredit{
- Amount: models.IssueServiceCreditAmountContainer.FromString("1"),
+ ServiceCredit: models.IssueServiceCredit{
+ Amount: models.IssueServiceCreditAmountContainer.FromString("1"),
},
}
@@ -314,9 +314,9 @@ ctx := context.Background()
subscriptionId := 222
body := models.DeductServiceCreditRequest{
- Deduction: models.DeductServiceCredit{
- Amount: models.DeductServiceCreditAmountContainer.FromString("1"),
- Memo: models.ToPointer("Deduction"),
+ Deduction: models.DeductServiceCredit{
+ Amount: models.DeductServiceCreditAmountContainer.FromString("1"),
+ Memo: models.ToPointer("Deduction"),
},
}
diff --git a/doc/controllers/subscription-notes.md b/doc/controllers/subscription-notes.md
index cff10049..868e6013 100644
--- a/doc/controllers/subscription-notes.md
+++ b/doc/controllers/subscription-notes.md
@@ -57,9 +57,9 @@ ctx := context.Background()
subscriptionId := 222
body := models.UpdateSubscriptionNoteRequest{
- Note: models.UpdateSubscriptionNote{
- Body: "New test note.",
- Sticky: true,
+ Note: models.UpdateSubscriptionNote{
+ Body: "New test note.",
+ Sticky: true,
},
}
@@ -73,6 +73,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
+
# List Subscription Notes
@@ -146,6 +152,12 @@ if err != nil {
]
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
+
# Read Subscription Note
@@ -242,9 +254,9 @@ subscriptionId := 222
noteId := 66
body := models.UpdateSubscriptionNoteRequest{
- Note: models.UpdateSubscriptionNote{
- Body: "Modified test note.",
- Sticky: true,
+ Note: models.UpdateSubscriptionNote{
+ Body: "Modified test note.",
+ Sticky: true,
},
}
@@ -258,6 +270,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
+
# Delete Subscription Note
diff --git a/doc/controllers/subscription-products.md b/doc/controllers/subscription-products.md
index baa9443e..618d0505 100644
--- a/doc/controllers/subscription-products.md
+++ b/doc/controllers/subscription-products.md
@@ -101,7 +101,7 @@ ctx := context.Background()
subscriptionId := 222
body := models.SubscriptionProductMigrationRequest{
- Migration: models.SubscriptionProductMigration{
+ Migration: models.SubscriptionProductMigration{
ProductId: models.ToPointer(3801242),
IncludeTrial: models.ToPointer(false),
IncludeInitialCharge: models.ToPointer(false),
@@ -287,7 +287,7 @@ ctx := context.Background()
subscriptionId := 222
body := models.SubscriptionMigrationPreviewRequest{
- Migration: models.SubscriptionMigrationPreviewOptions{
+ Migration: models.SubscriptionMigrationPreviewOptions{
IncludeTrial: models.ToPointer(false),
IncludeInitialCharge: models.ToPointer(false),
IncludeCoupons: models.ToPointer(true),
diff --git a/doc/controllers/subscription-status.md b/doc/controllers/subscription-status.md
index 7d907f10..85b2ffb8 100644
--- a/doc/controllers/subscription-status.md
+++ b/doc/controllers/subscription-status.md
@@ -594,7 +594,7 @@ ctx := context.Background()
subscriptionId := 222
body := models.PauseRequest{
- Hold: models.ToPointer(models.AutoResume{
+ Hold: models.ToPointer(models.AutoResume{
AutomaticallyResumeAt: models.NewOptional(models.ToPointer(parseTime(time.RFC3339, "2017-05-25T11:25:00Z", func(err error) { log.Fatalln(err) }))),
}),
}
@@ -763,7 +763,7 @@ ctx := context.Background()
subscriptionId := 222
body := models.PauseRequest{
- Hold: models.ToPointer(models.AutoResume{
+ Hold: models.ToPointer(models.AutoResume{
AutomaticallyResumeAt: models.NewOptional(models.ToPointer(parseTime(time.RFC3339, "2019-01-20T00:00:00", func(err error) { log.Fatalln(err) }))),
}),
}
@@ -1096,7 +1096,7 @@ subscriptionId := 222
body := models.ReactivateSubscriptionRequest{
CalendarBilling: models.ToPointer(models.ReactivationBilling{
- ReactivationCharge: models.ToPointer(models.ReactivationCharge("prorated")),
+ ReactivationCharge: models.ToPointer(models.ReactivationCharge("prorated")),
}),
IncludeTrial: models.ToPointer(true),
PreserveBalance: models.ToPointer(true),
@@ -1284,6 +1284,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) |
# Cancel Delayed Cancellation
@@ -1381,6 +1382,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | [`ErrorListResponseException`](../../doc/models/error-list-response-exception.md) |
+
# Preview Renewal
@@ -1435,20 +1442,20 @@ ctx := context.Background()
subscriptionId := 222
body := models.RenewalPreviewRequest{
- Components: []models.RenewalPreviewComponent{
+ Components: []models.RenewalPreviewComponent{
models.RenewalPreviewComponent{
- ComponentId: models.ToPointer(models.RenewalPreviewComponentComponentIdContainer.FromNumber(10708)),
- Quantity: models.ToPointer(10000),
+ ComponentId: models.ToPointer(models.RenewalPreviewComponentComponentIdContainer.FromNumber(10708)),
+ Quantity: models.ToPointer(10000),
},
models.RenewalPreviewComponent{
- ComponentId: models.ToPointer(models.RenewalPreviewComponentComponentIdContainer.FromString("handle:small-instance-hours")),
- Quantity: models.ToPointer(10000),
- PricePointId: models.ToPointer(models.RenewalPreviewComponentPricePointIdContainer.FromNumber(8712)),
+ ComponentId: models.ToPointer(models.RenewalPreviewComponentComponentIdContainer.FromString("handle:small-instance-hours")),
+ Quantity: models.ToPointer(10000),
+ PricePointId: models.ToPointer(models.RenewalPreviewComponentPricePointIdContainer.FromNumber(8712)),
},
models.RenewalPreviewComponent{
- ComponentId: models.ToPointer(models.RenewalPreviewComponentComponentIdContainer.FromString("handle:large-instance-hours")),
- Quantity: models.ToPointer(100),
- PricePointId: models.ToPointer(models.RenewalPreviewComponentPricePointIdContainer.FromString("handle:startup-pricing")),
+ ComponentId: models.ToPointer(models.RenewalPreviewComponentComponentIdContainer.FromString("handle:large-instance-hours")),
+ Quantity: models.ToPointer(100),
+ PricePointId: models.ToPointer(models.RenewalPreviewComponentPricePointIdContainer.FromString("handle:startup-pricing")),
},
},
}
diff --git a/doc/controllers/subscriptions.md b/doc/controllers/subscriptions.md
index c74743a1..2b8ea31b 100644
--- a/doc/controllers/subscriptions.md
+++ b/doc/controllers/subscriptions.md
@@ -44,6 +44,14 @@ Credit card details may be required, depending on the options for the product be
If you are creating a subscription with a payment profile, the attribute to send will be `credit_card_attributes` or `bank_account_attributes` for ACH and Direct Debit. That said, when you read the subscription after creation, we return the profile details under `credit_card` or `bank_account`.
+## Bulk creation of subscriptions
+
+Bulk creation of subscriptions is currently not supported. For scenarios where multiple subscriptions must be added, particularly when assigning to the same subscription group, it is essential to switch to a single-threaded approach.
+
+To avoid data conflicts or inaccuracies, incorporate a sleep interval between requests.
+
+While this single-threaded approach may impact performance, it ensures data consistency and accuracy in cases where concurrent creation attempts could otherwise lead to issues with subscription alignment and integrity.
+
## Taxable Subscriptions
If your intent is to charge your subscribers tax via [Avalara Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287043035661-Avalara-VAT-Tax) or [Custom Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287044212749-Custom-Taxes), there are a few considerations to be made regarding collecting subscription data.
@@ -364,13 +372,13 @@ For more information on Stripe Direct Debit, please view the following two resou
For more information on Stripe Direct Debit, please view the following two resources:
-+ [Payment Profiles via API for Stripe BECS Direct Debit]($e/Payment%20Profiles/createPaymentProfile)
++ [Payment Profiles via API for Stripe BECS Direct Debit](../../doc/controllers/payment-profiles.md#create-payment-profile)
+ [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit)
-+ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](page:development-tools/chargify-js/examples#minimal-example-with-sepa-becs-or-bacs-direct-debit-stripe-gateway)
++ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](http://localhost:8080/go)
-+ [Using Chargify.js with Stripe BECS Direct Debit - full example](page:development-tools/chargify-js/examples#full-example-with-becs-direct-debit-stripe-gateway)
++ [Using Chargify.js with Stripe BECS Direct Debit - full example](http://localhost:8080/go)
```json
{
@@ -395,13 +403,13 @@ For more information on Stripe Direct Debit, please view the following two resou
For more information on Stripe Direct Debit, please view the following two resources:
-+ [Payment Profiles via API for Stripe BACS Direct Debit]($e/Payment%20Profiles/createPaymentProfile)
++ [Payment Profiles via API for Stripe BACS Direct Debit](../../doc/controllers/payment-profiles.md#create-payment-profile)
+ [Full documentation on Stripe Direct Debit](https://maxio.zendesk.com/hc/en-us/articles/24176170430093-Stripe-SEPA-and-BECS-Direct-Debit)
-+ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](page:development-tools/chargify-js/examples#minimal-example-with-sepa-becs-or-bacs-direct-debit-stripe-gateway)
++ [Using Chargify.js with Stripe SEPA, BECS or BACS Direct Debit - minimal example](http://localhost:8080/go)
-+ [Using Chargify.js with Stripe BACS Direct Debit - full example](page:development-tools/chargify-js/examples#full-example-with-bacs-direct-debit-stripe-gateway)
++ [Using Chargify.js with Stripe BACS Direct Debit - full example](http://localhost:8080/go)
```json
{
@@ -697,8 +705,9 @@ CreateSubscription(
ctx := context.Background()
body := models.CreateSubscriptionRequest{
- Subscription: models.CreateSubscription{
+ Subscription: models.CreateSubscription{
ProductHandle: models.ToPointer("basic"),
+ PaymentCollectionMethod: models.ToPointer(models.CollectionMethod("remittance")),
CustomerAttributes: models.ToPointer(models.CustomerAttributes{
FirstName: models.ToPointer("Joe"),
LastName: models.ToPointer("Blow"),
@@ -713,20 +722,6 @@ body := models.CreateSubscriptionRequest{
Country: models.ToPointer("US"),
Phone: models.ToPointer("(617) 111 - 0000"),
}),
- CreditCardAttributes: models.ToPointer(models.PaymentProfileAttributes{
- FirstName: models.ToPointer("Joe"),
- LastName: models.ToPointer("Smith"),
- FullNumber: models.ToPointer("4111111111111111"),
- CardType: models.ToPointer(models.CardType("visa")),
- ExpirationMonth: models.ToPointer(models.PaymentProfileAttributesExpirationMonthContainer.FromString("1")),
- ExpirationYear: models.ToPointer(models.PaymentProfileAttributesExpirationYearContainer.FromString("2021")),
- BillingAddress: models.ToPointer("123 Mass Ave."),
- BillingAddress2: models.NewOptional(models.ToPointer("billing_address_22")),
- BillingCity: models.ToPointer("Boston"),
- BillingState: models.ToPointer("MA"),
- BillingCountry: models.ToPointer("US"),
- BillingZip: models.ToPointer("02120"),
- }),
},
}
@@ -1031,11 +1026,11 @@ ctx := context.Background()
subscriptionId := 222
body := models.UpdateSubscriptionRequest{
- Subscription: models.UpdateSubscription{
+ Subscription: models.UpdateSubscription{
CreditCardAttributes: models.ToPointer(models.CreditCardAttributes{
- FullNumber: models.ToPointer("4111111111111111"),
- ExpirationMonth: models.ToPointer("10"),
- ExpirationYear: models.ToPointer("2030"),
+ FullNumber: models.ToPointer("4111111111111111"),
+ ExpirationMonth: models.ToPointer("10"),
+ ExpirationYear: models.ToPointer("2030"),
}),
NextBillingAt: models.ToPointer(parseTime(time.RFC3339, "2010-08-06T15:34:00Z", func(err error) { log.Fatalln(err) })),
},
@@ -1408,7 +1403,7 @@ ctx := context.Background()
subscriptionId := 222
body := models.OverrideSubscriptionRequest{
- Subscription: models.OverrideSubscription{
+ Subscription: models.OverrideSubscription{
ActivatedAt: models.ToPointer(parseTime(time.RFC3339, "1999-12-01T10:28:34-05:00", func(err error) { log.Fatalln(err) })),
CanceledAt: models.ToPointer(parseTime(time.RFC3339, "2000-12-31T10:28:34-05:00", func(err error) { log.Fatalln(err) })),
CancellationMessage: models.ToPointer("Original cancellation in 2000"),
@@ -1470,6 +1465,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 404 | Not Found | `ApiError` |
+
# Purge Subscription
@@ -1489,7 +1490,7 @@ PurgeSubscription(
subscriptionId int,
ack int,
cascade []models.SubscriptionPurgeType) (
- http.Response,
+ models.ApiResponse[models.SubscriptionResponse],
error)
```
@@ -1503,7 +1504,7 @@ PurgeSubscription(
## Response Type
-``
+[`models.SubscriptionResponse`](../../doc/models/subscription-response.md)
## Example Usage
@@ -1519,14 +1520,22 @@ cascade := []models.SubscriptionPurgeType{
models.SubscriptionPurgeType("payment_profile"),
}
-resp, err := subscriptionsController.PurgeSubscription(ctx, subscriptionId, ack, cascade)
+apiResponse, err := subscriptionsController.PurgeSubscription(ctx, subscriptionId, ack, cascade)
if err != nil {
log.Fatalln(err)
} else {
- fmt.Println(resp.StatusCode)
+ // Printing the result and response
+ fmt.Println(apiResponse.Data)
+ fmt.Println(apiResponse.Response.StatusCode)
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 400 | Bad Request | [`SubscriptionResponseErrorException`](../../doc/models/subscription-response-error-exception.md) |
+
# Update Prepaid Subscription Configuration
@@ -1592,6 +1601,12 @@ if err != nil {
}
```
+## Errors
+
+| HTTP Status Code | Error Description | Exception Class |
+| --- | --- | --- |
+| 422 | Unprocessable Entity (WebDAV) | `ApiError` |
+
# Preview Subscription
@@ -1645,7 +1660,7 @@ PreviewSubscription(
ctx := context.Background()
body := models.CreateSubscriptionRequest{
- Subscription: models.CreateSubscription{
+ Subscription: models.CreateSubscription{
ProductHandle: models.ToPointer("gold-product"),
},
}
@@ -1823,7 +1838,7 @@ subscriptionId := 222
body := models.AddCouponsRequest{
- Codes: []string{
+ Codes: []string{
"COUPON_1",
"COUPON_2",
},
diff --git a/doc/controllers/webhooks.md b/doc/controllers/webhooks.md
index 4641e0ed..f721274e 100644
--- a/doc/controllers/webhooks.md
+++ b/doc/controllers/webhooks.md
@@ -147,7 +147,7 @@ EnableWebhooks(
ctx := context.Background()
body := models.EnableWebhooksRequest{
- WebhooksEnabled: true,
+ WebhooksEnabled: true,
}
apiResponse, err := webhooksController.EnableWebhooks(ctx, &body)
@@ -199,7 +199,7 @@ ReplayWebhooks(
ctx := context.Background()
body := models.ReplayWebhooksRequest{
- Ids: []int64{
+ Ids: []int64{
int64(123456789),
int64(123456788),
},
@@ -255,7 +255,7 @@ CreateEndpoint(
ctx := context.Background()
body := models.CreateOrUpdateEndpointRequest{
- Endpoint: models.CreateOrUpdateEndpoint{
+ Endpoint: models.CreateOrUpdateEndpoint{
Url: "https://your.site/webhooks",
WebhookSubscriptions: []models.WebhookSubscription{
models.WebhookSubscription("payment_success"),
@@ -397,7 +397,7 @@ ctx := context.Background()
endpointId := 42
body := models.CreateOrUpdateEndpointRequest{
- Endpoint: models.CreateOrUpdateEndpoint{
+ Endpoint: models.CreateOrUpdateEndpoint{
Url: "https://yout.site/webhooks/1/json.",
WebhookSubscriptions: []models.WebhookSubscription{
models.WebhookSubscription("payment_failure"),
diff --git a/doc/models/add-subscription-to-a-group.md b/doc/models/add-subscription-to-a-group.md
index cfc41655..72e2520a 100644
--- a/doc/models/add-subscription-to-a-group.md
+++ b/doc/models/add-subscription-to-a-group.md
@@ -9,7 +9,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `Group` | [`*models.AddSubscriptionToAGroupGroup`](../../doc/models/containers/add-subscription-to-a-group-group.md) | Optional | This is a container for one-of cases. |
+| `Group` | [`*models.GroupSettings`](../../doc/models/group-settings.md) | Optional | - |
## Example (as JSON)
diff --git a/doc/models/change-invoice-status-event-data.md b/doc/models/change-invoice-status-event-data.md
index b742a918..4fb3b58c 100644
--- a/doc/models/change-invoice-status-event-data.md
+++ b/doc/models/change-invoice-status-event-data.md
@@ -24,7 +24,7 @@ Example schema for an `change_invoice_status` event
"gateway_trans_id": "gateway_trans_id2",
"amount": "amount2",
"from_status": "draft",
- "to_status": "paid",
+ "to_status": "pending",
"consolidation_level": "none"
}
```
diff --git a/doc/models/change-invoice-status-event.md b/doc/models/change-invoice-status-event.md
index 6084f63c..6ae96d15 100644
--- a/doc/models/change-invoice-status-event.md
+++ b/doc/models/change-invoice-status-event.md
@@ -36,8 +36,8 @@
"event_data": {
"gateway_trans_id": "gateway_trans_id2",
"amount": "amount8",
- "from_status": "paid",
- "to_status": "paid",
+ "from_status": "open",
+ "to_status": "pending",
"consolidation_level": "child"
}
}
diff --git a/doc/models/component-price-point.md b/doc/models/component-price-point.md
index b7b50d2a..53be6856 100644
--- a/doc/models/component-price-point.md
+++ b/doc/models/component-price-point.md
@@ -26,6 +26,12 @@
| `Interval` | `models.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` | [`models.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. |
+| `OveragePrices` | [`[]models.ComponentPrice`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. |
+| `OveragePricingScheme` | [`*models.PricingScheme`](../../doc/models/pricing-scheme.md) | Optional | Applicable only to prepaid usage components. Pricing scheme for overage pricing. |
+| `RenewPrepaidAllocation` | `*bool` | Optional | Applicable only to prepaid usage components. Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period. |
+| `RolloverPrepaidRemainder` | `*bool` | Optional | Applicable only to prepaid usage components. Boolean which controls whether or not remaining units should be rolled over to the next period. |
+| `ExpirationInterval` | `models.Optional[int]` | Optional | Applicable only to prepaid usage components where rollover_prepaid_remainder is true. The number of `expiration_interval_unit`s after which rollover amounts should expire. |
+| `ExpirationIntervalUnit` | [`models.Optional[models.ExpirationIntervalUnit]`](../../doc/models/expiration-interval-unit.md) | Optional | Applicable only to prepaid usage components where rollover_prepaid_remainder is true. A string representing the expiration interval unit for this component, either month or day. |
## Example (as JSON)
diff --git a/doc/models/component.md b/doc/models/component.md
index 63c68f6f..0433235c 100644
--- a/doc/models/component.md
+++ b/doc/models/component.md
@@ -23,7 +23,7 @@
| `Taxable` | `*bool` | Optional | Boolean flag describing whether a component is taxable or not. |
| `Description` | `models.Optional[string]` | Optional | The description of the component. |
| `DefaultPricePointId` | `models.Optional[int]` | Optional | - |
-| `OveragePrices` | [`models.Optional[[]models.ComponentPrice]`](../../doc/models/component-price.md) | Optional | An array of price brackets. If the component uses the ‘per_unit’ pricing scheme, this array will be empty. |
+| `OveragePrices` | [`models.Optional[[]models.ComponentPrice]`](../../doc/models/component-price.md) | Optional | Applicable only to prepaid usage components. An array of overage price brackets. |
| `Prices` | [`models.Optional[[]models.ComponentPrice]`](../../doc/models/component-price.md) | Optional | An array of price brackets. If the component uses the ‘per_unit’ pricing scheme, this array will be empty. |
| `PricePointCount` | `*int` | Optional | Count for the number of price points associated with the component |
| `PricePointsUrl` | `models.Optional[string]` | Optional | URL that points to the location to read the existing price points via GET request |
diff --git a/doc/models/compounding-strategy.md b/doc/models/compounding-strategy.md
index d3746d9f..ec68b1f7 100644
--- a/doc/models/compounding-strategy.md
+++ b/doc/models/compounding-strategy.md
@@ -1,6 +1,8 @@
# Compounding Strategy
+Applicable only to stackable coupons. For `compound`, Percentage-based discounts will be calculated against the remaining price, after prior discounts have been calculated. For `full-price`, Percentage-based discounts will always be calculated against the original item price, before other discounts are applied.
+
## Enumeration
`CompoundingStrategy`
diff --git a/doc/models/containers/add-subscription-to-a-group-group.md b/doc/models/containers/add-subscription-to-a-group-group.md
deleted file mode 100644
index 6be00d98..00000000
--- a/doc/models/containers/add-subscription-to-a-group-group.md
+++ /dev/null
@@ -1,14 +0,0 @@
-
-# Add Subscription to a Group Group
-
-## Class Name
-
-`AddSubscriptionToAGroupGroup`
-
-## Cases
-
-| Type | Factory Method |
-| --- | --- |
-| [`models.GroupSettings`](../../../doc/models/group-settings.md) | models.AddSubscriptionToAGroupGroupContainer.FromGroupSettings(models.GroupSettings groupSettings) |
-| `bool` | models.AddSubscriptionToAGroupGroupContainer.FromBoolean(bool boolean) |
-
diff --git a/doc/models/containers/coupon-payload-percentage.md b/doc/models/containers/coupon-payload-percentage.md
new file mode 100644
index 00000000..a577ae8d
--- /dev/null
+++ b/doc/models/containers/coupon-payload-percentage.md
@@ -0,0 +1,14 @@
+
+# Coupon Payload Percentage
+
+## Class Name
+
+`CouponPayloadPercentage`
+
+## Cases
+
+| Type | Factory Method |
+| --- | --- |
+| `string` | models.CouponPayloadPercentageContainer.FromString(string mString) |
+| `float64` | models.CouponPayloadPercentageContainer.FromPrecision(float64 precision) |
+
diff --git a/doc/models/containers/create-or-update-coupon-coupon.md b/doc/models/containers/create-or-update-coupon-coupon.md
deleted file mode 100644
index faf302a5..00000000
--- a/doc/models/containers/create-or-update-coupon-coupon.md
+++ /dev/null
@@ -1,14 +0,0 @@
-
-# Create or Update Coupon Coupon
-
-## Class Name
-
-`CreateOrUpdateCouponCoupon`
-
-## Cases
-
-| Type | Factory Method |
-| --- | --- |
-| [`models.CreateOrUpdatePercentageCoupon`](../../../doc/models/create-or-update-percentage-coupon.md) | models.CreateOrUpdateCouponCouponContainer.FromCreateOrUpdatePercentageCoupon(models.CreateOrUpdatePercentageCoupon createOrUpdatePercentageCoupon) |
-| [`models.CreateOrUpdateFlatAmountCoupon`](../../../doc/models/create-or-update-flat-amount-coupon.md) | models.CreateOrUpdateCouponCouponContainer.FromCreateOrUpdateFlatAmountCoupon(models.CreateOrUpdateFlatAmountCoupon createOrUpdateFlatAmountCoupon) |
-
diff --git a/doc/models/containers/create-or-update-percentage-coupon-percentage.md b/doc/models/containers/create-or-update-percentage-coupon-percentage.md
deleted file mode 100644
index ae1e4b7a..00000000
--- a/doc/models/containers/create-or-update-percentage-coupon-percentage.md
+++ /dev/null
@@ -1,14 +0,0 @@
-
-# Create or Update Percentage Coupon Percentage
-
-## Class Name
-
-`CreateOrUpdatePercentageCouponPercentage`
-
-## Cases
-
-| Type | Factory Method |
-| --- | --- |
-| `string` | models.CreateOrUpdatePercentageCouponPercentageContainer.FromString(string mString) |
-| `float64` | models.CreateOrUpdatePercentageCouponPercentageContainer.FromPrecision(float64 precision) |
-
diff --git a/doc/models/containers/event-event-specific-data.md b/doc/models/containers/event-event-specific-data.md
index 97236be5..1d54c60d 100644
--- a/doc/models/containers/event-event-specific-data.md
+++ b/doc/models/containers/event-event-specific-data.md
@@ -21,8 +21,7 @@
| [`models.PendingCancellationChange`](../../../doc/models/pending-cancellation-change.md) | models.EventEventSpecificDataContainer.FromPendingCancellationChange(models.PendingCancellationChange pendingCancellationChange) |
| [`models.PrepaidSubscriptionBalanceChanged`](../../../doc/models/prepaid-subscription-balance-changed.md) | models.EventEventSpecificDataContainer.FromPrepaidSubscriptionBalanceChanged(models.PrepaidSubscriptionBalanceChanged prepaidSubscriptionBalanceChanged) |
| [`models.ProformaInvoiceIssued`](../../../doc/models/proforma-invoice-issued.md) | models.EventEventSpecificDataContainer.FromProformaInvoiceIssued(models.ProformaInvoiceIssued proformaInvoiceIssued) |
-| [`models.SubscriptionGroupSignupSuccess`](../../../doc/models/subscription-group-signup-success.md) | models.EventEventSpecificDataContainer.FromSubscriptionGroupSignupSuccess(models.SubscriptionGroupSignupSuccess subscriptionGroupSignupSuccess) |
-| [`models.SubscriptionGroupSignupFailure`](../../../doc/models/subscription-group-signup-failure.md) | models.EventEventSpecificDataContainer.FromSubscriptionGroupSignupFailure(models.SubscriptionGroupSignupFailure subscriptionGroupSignupFailure) |
+| [`models.SubscriptionGroupSignupEventData`](../../../doc/models/subscription-group-signup-event-data.md) | models.EventEventSpecificDataContainer.FromSubscriptionGroupSignupEventData(models.SubscriptionGroupSignupEventData subscriptionGroupSignupEventData) |
| [`models.CreditAccountBalanceChanged`](../../../doc/models/credit-account-balance-changed.md) | models.EventEventSpecificDataContainer.FromCreditAccountBalanceChanged(models.CreditAccountBalanceChanged creditAccountBalanceChanged) |
| [`models.PrepaymentAccountBalanceChanged`](../../../doc/models/prepayment-account-balance-changed.md) | models.EventEventSpecificDataContainer.FromPrepaymentAccountBalanceChanged(models.PrepaymentAccountBalanceChanged prepaymentAccountBalanceChanged) |
| [`models.PaymentCollectionMethodChanged`](../../../doc/models/payment-collection-method-changed.md) | models.EventEventSpecificDataContainer.FromPaymentCollectionMethodChanged(models.PaymentCollectionMethodChanged paymentCollectionMethodChanged) |
diff --git a/doc/models/coupon-currency-response.md b/doc/models/coupon-currency-response.md
index 5c72de8f..1952a77d 100644
--- a/doc/models/coupon-currency-response.md
+++ b/doc/models/coupon-currency-response.md
@@ -19,19 +19,19 @@
{
"id": 50,
"currency": "currency8",
- "price": 78,
+ "price": 233.74,
"coupon_id": 224
},
{
"id": 50,
"currency": "currency8",
- "price": 78,
+ "price": 233.74,
"coupon_id": 224
},
{
"id": 50,
"currency": "currency8",
- "price": 78,
+ "price": 233.74,
"coupon_id": 224
}
]
diff --git a/doc/models/coupon-currency.md b/doc/models/coupon-currency.md
index 9d611507..8c92008f 100644
--- a/doc/models/coupon-currency.md
+++ b/doc/models/coupon-currency.md
@@ -9,9 +9,9 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `Id` | `*int` | Optional | - |
+| `Id` | `models.Optional[int]` | Optional | - |
| `Currency` | `*string` | Optional | - |
-| `Price` | `*int` | Optional | - |
+| `Price` | `models.Optional[float64]` | Optional | - |
| `CouponId` | `*int` | Optional | - |
## Example (as JSON)
@@ -20,7 +20,7 @@
{
"id": 228,
"currency": "currency8",
- "price": 100,
+ "price": 169.96,
"coupon_id": 210
}
```
diff --git a/doc/models/coupon-payload.md b/doc/models/coupon-payload.md
new file mode 100644
index 00000000..024ea690
--- /dev/null
+++ b/doc/models/coupon-payload.md
@@ -0,0 +1,38 @@
+
+# Coupon Payload
+
+## Structure
+
+`CouponPayload`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `Name` | `*string` | Optional | Required when creating a new coupon. This name is not displayed to customers and is limited to 255 characters. |
+| `Code` | `*string` | Optional | Required when creating a new coupon. The code is limited to 255 characters. May contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.” |
+| `Description` | `*string` | Optional | Required when creating a new coupon. A description of the coupon that can be displayed to customers in transactions and on statements. The description is limited to 255 characters. |
+| `Percentage` | [`*models.CouponPayloadPercentage`](../../doc/models/containers/coupon-payload-percentage.md) | Optional | This is a container for one-of cases. |
+| `AmountInCents` | `*int64` | Optional | Required when creating a new flat amount coupon. Can't be used together with percentage. Flat USD discount |
+| `AllowNegativeBalance` | `*bool` | Optional | If set to true, discount is not limited (credits will carry forward to next billing). Can't be used together with restrictions. |
+| `Recurring` | `*bool` | Optional | - |
+| `EndDate` | `*time.Time` | Optional | After the end of the given day, this coupon code will be invalid for new signups. Recurring discounts started before this date will continue to recur even after this date. |
+| `ProductFamilyId` | `*string` | Optional | - |
+| `Stackable` | `*bool` | Optional | A stackable coupon can be combined with other coupons on a Subscription. |
+| `CompoundingStrategy` | [`*models.CompoundingStrategy`](../../doc/models/compounding-strategy.md) | Optional | Applicable only to stackable coupons. For `compound`, Percentage-based discounts will be calculated against the remaining price, after prior discounts have been calculated. For `full-price`, Percentage-based discounts will always be calculated against the original item price, before other discounts are applied. |
+| `ExcludeMidPeriodAllocations` | `*bool` | Optional | - |
+| `ApplyOnCancelAtEndOfPeriod` | `*bool` | Optional | - |
+| `ApplyOnSubscriptionExpiration` | `*bool` | Optional | - |
+
+## Example (as JSON)
+
+```json
+{
+ "name": "name8",
+ "code": "code6",
+ "description": "description8",
+ "percentage": "String7",
+ "amount_in_cents": 110
+}
+```
+
diff --git a/doc/models/create-or-update-coupon.md b/doc/models/coupon-request.md
similarity index 57%
rename from doc/models/create-or-update-coupon.md
rename to doc/models/coupon-request.md
index db44d89e..32637a14 100644
--- a/doc/models/create-or-update-coupon.md
+++ b/doc/models/coupon-request.md
@@ -1,15 +1,15 @@
-# Create or Update Coupon
+# Coupon Request
## Structure
-`CreateOrUpdateCoupon`
+`CouponRequest`
## Fields
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `Coupon` | [`*models.CreateOrUpdateCouponCoupon`](../../doc/models/containers/create-or-update-coupon-coupon.md) | Optional | This is a container for one-of cases. |
+| `Coupon` | [`*models.CouponPayload`](../../doc/models/coupon-payload.md) | Optional | - |
| `RestrictedProducts` | `map[string]bool` | Optional | An object where the keys are product_ids and the values are booleans indicating if the coupon should be applicable to the product |
| `RestrictedComponents` | `map[string]bool` | Optional | An object where the keys are component_ids and the values are booleans indicating if the coupon should be applicable to the component |
@@ -18,14 +18,11 @@
```json
{
"coupon": {
- "name": "name0",
- "code": "code8",
- "description": "description0",
- "percentage": "String9",
- "allow_negative_balance": false,
- "recurring": false,
- "end_date": "2016-03-13T12:52:32.123Z",
- "product_family_id": "product_family_id6"
+ "name": "name4",
+ "code": "code2",
+ "description": "description6",
+ "percentage": "String3",
+ "amount_in_cents": 230
},
"restricted_products": {
"key0": true
diff --git a/doc/models/coupon.md b/doc/models/coupon.md
index 8c09ffa6..d0cd9ee4 100644
--- a/doc/models/coupon.md
+++ b/doc/models/coupon.md
@@ -14,11 +14,11 @@
| `Code` | `*string` | Optional | - |
| `Description` | `*string` | Optional | - |
| `Amount` | `models.Optional[float64]` | Optional | - |
-| `AmountInCents` | `models.Optional[int]` | Optional | - |
+| `AmountInCents` | `models.Optional[int64]` | Optional | - |
| `ProductFamilyId` | `*int` | Optional | - |
| `ProductFamilyName` | `models.Optional[string]` | Optional | - |
| `StartDate` | `*time.Time` | Optional | - |
-| `EndDate` | `models.Optional[time.Time]` | Optional | - |
+| `EndDate` | `models.Optional[time.Time]` | Optional | After the given time, this coupon code will be invalid for new signups. Recurring discounts started before this date will continue to recur even after this date. |
| `Percentage` | `models.Optional[string]` | Optional | - |
| `Recurring` | `*bool` | Optional | - |
| `RecurringScheme` | [`*models.RecurringScheme`](../../doc/models/recurring-scheme.md) | Optional | - |
@@ -26,11 +26,11 @@
| `DurationInterval` | `models.Optional[int]` | Optional | - |
| `DurationIntervalUnit` | `models.Optional[string]` | Optional | - |
| `DurationIntervalSpan` | `models.Optional[string]` | Optional | - |
-| `AllowNegativeBalance` | `*bool` | Optional | - |
+| `AllowNegativeBalance` | `*bool` | Optional | If set to true, discount is not limited (credits will carry forward to next billing). |
| `ArchivedAt` | `models.Optional[time.Time]` | Optional | - |
| `ConversionLimit` | `models.Optional[string]` | Optional | - |
-| `Stackable` | `*bool` | Optional | - |
-| `CompoundingStrategy` | [`models.Optional[models.CompoundingStrategy]`](../../doc/models/compounding-strategy.md) | Optional | - |
+| `Stackable` | `*bool` | Optional | A stackable coupon can be combined with other coupons on a Subscription. |
+| `CompoundingStrategy` | [`models.Optional[models.CompoundingStrategy]`](../../doc/models/compounding-strategy.md) | Optional | Applicable only to stackable coupons. For `compound`, Percentage-based discounts will be calculated against the remaining price, after prior discounts have been calculated. For `full-price`, Percentage-based discounts will always be calculated against the original item price, before other discounts are applied. |
| `UseSiteExchangeRate` | `*bool` | Optional | - |
| `CreatedAt` | `*time.Time` | Optional | - |
| `UpdatedAt` | `*time.Time` | Optional | - |
@@ -39,6 +39,7 @@
| `ApplyOnCancelAtEndOfPeriod` | `*bool` | Optional | - |
| `ApplyOnSubscriptionExpiration` | `*bool` | Optional | - |
| `CouponRestrictions` | [`[]models.CouponRestriction`](../../doc/models/coupon-restriction.md) | Optional | - |
+| `CurrencyPrices` | [`[]models.CouponCurrency`](../../doc/models/coupon-currency.md) | Optional | Returned in read, find, and list endpoints if the query parameter is provided. |
## Example (as JSON)
diff --git a/doc/models/create-component-price-point.md b/doc/models/create-component-price-point.md
index 544246c7..8ee9087b 100644
--- a/doc/models/create-component-price-point.md
+++ b/doc/models/create-component-price-point.md
@@ -13,8 +13,8 @@
| `Handle` | `*string` | Optional | - |
| `PricingScheme` | [`models.PricingScheme`](../../doc/models/pricing-scheme.md) | Required | 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) | Required | - |
-| `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 |
+| `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. Setting not supported when creating price points in bulk.
**Default**: `true` |
+| `TaxIncluded` | `*bool` | Optional | Whether or not the price point includes tax. Setting not supported when creating price points in bulk. |
| `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.Optional[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. |
diff --git a/doc/models/create-ebb-component.md b/doc/models/create-ebb-component.md
index 69c6b4a9..46fe2570 100644
--- a/doc/models/create-ebb-component.md
+++ b/doc/models/create-ebb-component.md
@@ -29,7 +29,15 @@
"unit_price": 23.26
}
],
- "upgrade_charge": "full",
+ "price_points": [
+ {
+ "name": "name2",
+ "handle": "handle8",
+ "pricing_scheme": "per_unit",
+ "interval": 92,
+ "interval_unit": "day"
+ }
+ ],
"event_based_billing_metric_id": 68
}
}
diff --git a/doc/models/create-invoice-coupon.md b/doc/models/create-invoice-coupon.md
index 1d35792d..9e319248 100644
--- a/doc/models/create-invoice-coupon.md
+++ b/doc/models/create-invoice-coupon.md
@@ -14,7 +14,7 @@
| `Amount` | [`*models.CreateInvoiceCouponAmount`](../../doc/models/containers/create-invoice-coupon-amount.md) | Optional | This is a container for one-of cases. |
| `Description` | `*string` | Optional | **Constraints**: *Maximum Length*: `255` |
| `ProductFamilyId` | [`*models.CreateInvoiceCouponProductFamilyId`](../../doc/models/containers/create-invoice-coupon-product-family-id.md) | Optional | This is a container for one-of cases. |
-| `CompoundingStrategy` | [`*models.CompoundingStrategy`](../../doc/models/compounding-strategy.md) | Optional | - |
+| `CompoundingStrategy` | [`*models.CompoundingStrategy`](../../doc/models/compounding-strategy.md) | Optional | Applicable only to stackable coupons. For `compound`, Percentage-based discounts will be calculated against the remaining price, after prior discounts have been calculated. For `full-price`, Percentage-based discounts will always be calculated against the original item price, before other discounts are applied. |
## Example (as JSON)
diff --git a/doc/models/create-metered-component.md b/doc/models/create-metered-component.md
index 91922958..7aca0e2d 100644
--- a/doc/models/create-metered-component.md
+++ b/doc/models/create-metered-component.md
@@ -39,7 +39,29 @@
"unit_price": 23.26
}
],
- "upgrade_charge": "none"
+ "price_points": [
+ {
+ "name": "name2",
+ "handle": "handle8",
+ "pricing_scheme": "per_unit",
+ "interval": 92,
+ "interval_unit": "day"
+ },
+ {
+ "name": "name2",
+ "handle": "handle8",
+ "pricing_scheme": "per_unit",
+ "interval": 92,
+ "interval_unit": "day"
+ },
+ {
+ "name": "name2",
+ "handle": "handle8",
+ "pricing_scheme": "per_unit",
+ "interval": 92,
+ "interval_unit": "day"
+ }
+ ]
}
}
```
diff --git a/doc/models/create-on-off-component.md b/doc/models/create-on-off-component.md
index d73390de..98d0a6e1 100644
--- a/doc/models/create-on-off-component.md
+++ b/doc/models/create-on-off-component.md
@@ -20,14 +20,9 @@
"description": "description6",
"handle": "handle2",
"taxable": false,
- "prices": [
- {
- "starting_quantity": 242,
- "ending_quantity": 40,
- "unit_price": 23.26
- }
- ],
- "upgrade_charge": "full"
+ "upgrade_charge": "full",
+ "downgrade_credit": "full",
+ "unit_price": "String5"
}
}
```
diff --git a/doc/models/create-or-update-flat-amount-coupon.md b/doc/models/create-or-update-flat-amount-coupon.md
deleted file mode 100644
index 90294e59..00000000
--- a/doc/models/create-or-update-flat-amount-coupon.md
+++ /dev/null
@@ -1,40 +0,0 @@
-
-# Create or Update Flat Amount Coupon
-
-## Structure
-
-`CreateOrUpdateFlatAmountCoupon`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `Name` | `string` | Required | the name of the coupon |
-| `Code` | `string` | Required | may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.” |
-| `Description` | `*string` | Optional | - |
-| `AmountInCents` | `int64` | Required | - |
-| `AllowNegativeBalance` | `*bool` | Optional | - |
-| `Recurring` | `*bool` | Optional | - |
-| `EndDate` | `*time.Time` | Optional | - |
-| `ProductFamilyId` | `*string` | Optional | - |
-| `Stackable` | `*bool` | Optional | - |
-| `CompoundingStrategy` | [`*models.CompoundingStrategy`](../../doc/models/compounding-strategy.md) | Optional | - |
-| `ExcludeMidPeriodAllocations` | `*bool` | Optional | - |
-| `ApplyOnCancelAtEndOfPeriod` | `*bool` | Optional | - |
-| `ApplyOnSubscriptionExpiration` | `*bool` | Optional | - |
-
-## Example (as JSON)
-
-```json
-{
- "name": "name0",
- "code": "code8",
- "description": "description0",
- "amount_in_cents": 120,
- "allow_negative_balance": false,
- "recurring": false,
- "end_date": "2016-03-13T12:52:32.123Z",
- "product_family_id": "product_family_id4"
-}
-```
-
diff --git a/doc/models/create-or-update-percentage-coupon.md b/doc/models/create-or-update-percentage-coupon.md
deleted file mode 100644
index 289d7d69..00000000
--- a/doc/models/create-or-update-percentage-coupon.md
+++ /dev/null
@@ -1,40 +0,0 @@
-
-# Create or Update Percentage Coupon
-
-## Structure
-
-`CreateOrUpdatePercentageCoupon`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `Name` | `string` | Required | the name of the coupon |
-| `Code` | `string` | Required | may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.” |
-| `Description` | `*string` | Optional | - |
-| `Percentage` | [`models.CreateOrUpdatePercentageCouponPercentage`](../../doc/models/containers/create-or-update-percentage-coupon-percentage.md) | Required | This is a container for one-of cases. |
-| `AllowNegativeBalance` | `*bool` | Optional | - |
-| `Recurring` | `*bool` | Optional | - |
-| `EndDate` | `*time.Time` | Optional | - |
-| `ProductFamilyId` | `*string` | Optional | - |
-| `Stackable` | `*bool` | Optional | - |
-| `CompoundingStrategy` | [`*models.CompoundingStrategy`](../../doc/models/compounding-strategy.md) | Optional | - |
-| `ExcludeMidPeriodAllocations` | `*bool` | Optional | - |
-| `ApplyOnCancelAtEndOfPeriod` | `*bool` | Optional | - |
-| `ApplyOnSubscriptionExpiration` | `*bool` | Optional | - |
-
-## Example (as JSON)
-
-```json
-{
- "name": "name0",
- "code": "code8",
- "description": "description0",
- "percentage": "String9",
- "allow_negative_balance": false,
- "recurring": false,
- "end_date": "2016-03-13T12:52:32.123Z",
- "product_family_id": "product_family_id6"
-}
-```
-
diff --git a/doc/models/create-prepaid-component.md b/doc/models/create-prepaid-component.md
index 1cc3cd74..2d5484c2 100644
--- a/doc/models/create-prepaid-component.md
+++ b/doc/models/create-prepaid-component.md
@@ -21,7 +21,25 @@
"description": "description2",
"handle": "handle8",
"taxable": false,
- "pricing_scheme": "per_unit"
+ "pricing_scheme": "per_unit",
+ "prices": [
+ {
+ "starting_quantity": 242,
+ "ending_quantity": 40,
+ "unit_price": 23.26
+ }
+ ],
+ "upgrade_charge": "full",
+ "overage_pricing": {
+ "pricing_scheme": "stairstep",
+ "prices": [
+ {
+ "starting_quantity": 242,
+ "ending_quantity": 40,
+ "unit_price": 23.26
+ }
+ ]
+ }
}
}
```
diff --git a/doc/models/create-prepaid-usage-component-price-point.md b/doc/models/create-prepaid-usage-component-price-point.md
index 842cde51..dc725cdc 100644
--- a/doc/models/create-prepaid-usage-component-price-point.md
+++ b/doc/models/create-prepaid-usage-component-price-point.md
@@ -15,10 +15,10 @@
| `Prices` | [`[]models.Price`](../../doc/models/price.md) | Required | - |
| `OveragePricing` | [`models.OveragePricing`](../../doc/models/overage-pricing.md) | Required | - |
| `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` |
-| `RolloverPrepaidRemainder` | `*bool` | Optional | Boolean which controls whether or not remaining units should be rolled over to the next period |
-| `RenewPrepaidAllocation` | `*bool` | Optional | Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period |
+| `RolloverPrepaidRemainder` | `*bool` | Optional | (only for prepaid usage components) Boolean which controls whether or not remaining units should be rolled over to the next period |
+| `RenewPrepaidAllocation` | `*bool` | Optional | (only for prepaid usage components) Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period |
| `ExpirationInterval` | `*float64` | Optional | (only for prepaid usage components where rollover_prepaid_remainder is true) The number of `expiration_interval_unit`s after which rollover amounts should expire |
-| `ExpirationIntervalUnit` | [`models.Optional[models.ExpirationIntervalUnit]`](../../doc/models/expiration-interval-unit.md) | Optional | A string representing the expiration interval unit for this component, either month or day |
+| `ExpirationIntervalUnit` | [`models.Optional[models.ExpirationIntervalUnit]`](../../doc/models/expiration-interval-unit.md) | Optional | (only for prepaid usage components where rollover_prepaid_remainder is true) A string representing the expiration interval unit for this component, either month or day |
## Example (as JSON)
diff --git a/doc/models/create-subscription.md b/doc/models/create-subscription.md
index ac7a44b3..9655a29f 100644
--- a/doc/models/create-subscription.md
+++ b/doc/models/create-subscription.md
@@ -55,7 +55,7 @@
| `ActivatedAt` | `*time.Time` | Optional | - |
| `AgreementAcceptance` | [`*models.AgreementAcceptance`](../../doc/models/agreement-acceptance.md) | Optional | Required when creating a subscription with Maxio Payments. |
| `AchAgreement` | [`*models.ACHAgreement`](../../doc/models/ach-agreement.md) | Optional | (Optional) If passed, the proof of the authorized ACH agreement terms will be persisted. |
-| `DunningCommunicationDelayEnabled` | `models.Optional[bool]` | Optional | Enable Communication Delay feature, making sure no communication (email or SMS) is sent to the Customer between 9PM and 8AM in time zone set by the `dunning_communication_delay_time_zone` attribute.
**Default**: `false` |
+| `DunningCommunicationDelayEnabled` | `*bool` | Optional | Enable Communication Delay feature, making sure no communication (email or SMS) is sent to the Customer between 9PM and 8AM in time zone set by the `dunning_communication_delay_time_zone` attribute.
**Default**: `false` |
| `DunningCommunicationDelayTimeZone` | `models.Optional[string]` | Optional | Time zone for the Dunning Communication Delay feature. |
| `SkipBillingManifestTaxes` | `*bool` | Optional | Valid only for the Subscription Preview endpoint. When set to `true` it skips calculating taxes for the current and next billing manifests.
**Default**: `false` |
diff --git a/doc/models/currency-price.md b/doc/models/currency-price.md
index ae33e5f2..9883d867 100644
--- a/doc/models/currency-price.md
+++ b/doc/models/currency-price.md
@@ -13,6 +13,8 @@
| `Currency` | `*string` | Optional | - |
| `Price` | `*float64` | Optional | - |
| `FormattedPrice` | `*string` | Optional | - |
+| `PriceId` | `*int` | Optional | - |
+| `PricePointId` | `*int` | Optional | - |
| `ProductPricePointId` | `*int` | Optional | - |
| `Role` | [`*models.CurrencyPriceRole`](../../doc/models/currency-price-role.md) | Optional | Role for the price. |
@@ -24,7 +26,7 @@
"currency": "currency6",
"price": 41.36,
"formatted_price": "formatted_price4",
- "product_price_point_id": 210
+ "price_id": 178
}
```
diff --git a/doc/models/currency-prices-response.md b/doc/models/currency-prices-response.md
index 4cd95fb1..2a6fa176 100644
--- a/doc/models/currency-prices-response.md
+++ b/doc/models/currency-prices-response.md
@@ -21,7 +21,7 @@
"currency": "currency8",
"price": 233.74,
"formatted_price": "formatted_price6",
- "product_price_point_id": 172
+ "price_id": 116
}
]
}
diff --git a/doc/models/ebb-component.md b/doc/models/ebb-component.md
index f3afada0..90ba72ea 100644
--- a/doc/models/ebb-component.md
+++ b/doc/models/ebb-component.md
@@ -15,14 +15,11 @@
| `Handle` | `*string` | Optional | A unique identifier for your use that can be used to retrieve this component is subsequent requests. Must start with a letter or number and may only contain lowercase letters, numbers, or the characters '.', ':', '-', or '_'.
**Constraints**: *Pattern*: `^[a-z0-9][a-z0-9\-_:.]*$` |
| `Taxable` | `*bool` | Optional | Boolean flag describing whether a component is taxable or not. |
| `PricingScheme` | [`models.PricingScheme`](../../doc/models/pricing-scheme.md) | Required | 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 | (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://help.chargify.com/products/product-components.html#general-price-bracket-rules) for an overview of how price brackets work for different pricing schemes. |
-| `UpgradeCharge` | [`models.Optional[models.CreditType]`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. |
-| `DowngradeCredit` | [`models.Optional[models.CreditType]`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. |
+| `Prices` | [`[]models.Price`](../../doc/models/price.md) | Optional | (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes. |
| `PricePoints` | [`[]models.ComponentPricePointItem`](../../doc/models/component-price-point-item.md) | Optional | - |
| `UnitPrice` | [`*models.EBBComponentUnitPrice`](../../doc/models/containers/ebb-component-unit-price.md) | Optional | This is a container for one-of cases. |
| `TaxCode` | `*string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. |
| `HideDateRangeOnInvoice` | `*bool` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. |
-| `PriceInCents` | `*string` | Optional | deprecated May 2011 - use unit_price instead |
| `EventBasedBillingMetricId` | `int` | Required | The ID of an event based billing metric that will be attached to this component. |
| `Interval` | `*int` | Optional | The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component's default price point would renew every 30 days. This property is only available for sites with Multifrequency enabled. |
| `IntervalUnit` | [`models.Optional[models.IntervalUnit]`](../../doc/models/interval-unit.md) | Optional | A string representing the interval unit for this component's default price point, either month or day. This property is only available for sites with Multifrequency enabled. |
@@ -44,7 +41,15 @@
"unit_price": 23.26
}
],
- "upgrade_charge": "full",
+ "price_points": [
+ {
+ "name": "name2",
+ "handle": "handle8",
+ "pricing_scheme": "per_unit",
+ "interval": 92,
+ "interval_unit": "day"
+ }
+ ],
"event_based_billing_metric_id": 190
}
```
diff --git a/doc/models/event-key.md b/doc/models/event-key.md
new file mode 100644
index 00000000..d9989975
--- /dev/null
+++ b/doc/models/event-key.md
@@ -0,0 +1,92 @@
+
+# Event Key
+
+## Enumeration
+
+`EventKey`
+
+## Fields
+
+| Name |
+| --- |
+| `PAYMENTSUCCESS` |
+| `PAYMENTFAILURE` |
+| `SIGNUPSUCCESS` |
+| `SIGNUPFAILURE` |
+| `DELAYEDSIGNUPCREATIONSUCCESS` |
+| `DELAYEDSIGNUPCREATIONFAILURE` |
+| `BILLINGDATECHANGE` |
+| `EXPIRATIONDATECHANGE` |
+| `RENEWALSUCCESS` |
+| `RENEWALFAILURE` |
+| `SUBSCRIPTIONSTATECHANGE` |
+| `SUBSCRIPTIONPRODUCTCHANGE` |
+| `PENDINGCANCELLATIONCHANGE` |
+| `EXPIRINGCARD` |
+| `CUSTOMERUPDATE` |
+| `CUSTOMERCREATE` |
+| `CUSTOMERDELETE` |
+| `COMPONENTALLOCATIONCHANGE` |
+| `METEREDUSAGE` |
+| `PREPAIDUSAGE` |
+| `UPGRADEDOWNGRADESUCCESS` |
+| `UPGRADEDOWNGRADEFAILURE` |
+| `STATEMENTCLOSED` |
+| `STATEMENTSETTLED` |
+| `SUBSCRIPTIONCARDUPDATE` |
+| `SUBSCRIPTIONGROUPCARDUPDATE` |
+| `SUBSCRIPTIONBANKACCOUNTUPDATE` |
+| `REFUNDSUCCESS` |
+| `REFUNDFAILURE` |
+| `UPCOMINGRENEWALNOTICE` |
+| `TRIALENDNOTICE` |
+| `DUNNINGSTEPREACHED` |
+| `INVOICEISSUED` |
+| `PREPAIDSUBSCRIPTIONBALANCECHANGED` |
+| `SUBSCRIPTIONGROUPSIGNUPSUCCESS` |
+| `SUBSCRIPTIONGROUPSIGNUPFAILURE` |
+| `DIRECTDEBITPAYMENTPAIDOUT` |
+| `DIRECTDEBITPAYMENTREJECTED` |
+| `DIRECTDEBITPAYMENTPENDING` |
+| `PENDINGPAYMENTCREATED` |
+| `PENDINGPAYMENTFAILED` |
+| `PENDINGPAYMENTCOMPLETED` |
+| `PROFORMAINVOICEISSUED` |
+| `SUBSCRIPTIONPREPAYMENTACCOUNTBALANCECHANGED` |
+| `SUBSCRIPTIONSERVICECREDITACCOUNTBALANCECHANGED` |
+| `CUSTOMFIELDVALUECHANGE` |
+| `ITEMPRICEPOINTCHANGED` |
+| `RENEWALSUCCESSRECREATED` |
+| `RENEWALFAILURERECREATED` |
+| `PAYMENTSUCCESSRECREATED` |
+| `PAYMENTFAILURERECREATED` |
+| `SUBSCRIPTIONDELETION` |
+| `SUBSCRIPTIONGROUPBANKACCOUNTUPDATE` |
+| `SUBSCRIPTIONPAYPALACCOUNTUPDATE` |
+| `SUBSCRIPTIONGROUPPAYPALACCOUNTUPDATE` |
+| `SUBSCRIPTIONCUSTOMERCHANGE` |
+| `ACCOUNTTRANSACTIONCHANGED` |
+| `GOCARDLESSPAYMENTPAIDOUT` |
+| `GOCARDLESSPAYMENTREJECTED` |
+| `GOCARDLESSPAYMENTPENDING` |
+| `STRIPEDIRECTDEBITPAYMENTPAIDOUT` |
+| `STRIPEDIRECTDEBITPAYMENTREJECTED` |
+| `STRIPEDIRECTDEBITPAYMENTPENDING` |
+| `MAXIOPAYMENTSDIRECTDEBITPAYMENTPAIDOUT` |
+| `MAXIOPAYMENTSDIRECTDEBITPAYMENTREJECTED` |
+| `MAXIOPAYMENTSDIRECTDEBITPAYMENTPENDING` |
+| `INVOICEINCOLLECTIONSCANCELED` |
+| `SUBSCRIPTIONADDEDTOGROUP` |
+| `SUBSCRIPTIONREMOVEDFROMGROUP` |
+| `CHARGEBACKOPENED` |
+| `CHARGEBACKLOST` |
+| `CHARGEBACKACCEPTED` |
+| `CHARGEBACKCLOSED` |
+| `CHARGEBACKWON` |
+| `PAYMENTCOLLECTIONMETHODCHANGED` |
+| `COMPONENTBILLINGDATECHANGED` |
+| `SUBSCRIPTIONTERMRENEWALSCHEDULED` |
+| `SUBSCRIPTIONTERMRENEWALPENDING` |
+| `SUBSCRIPTIONTERMRENEWALACTIVATED` |
+| `SUBSCRIPTIONTERMRENEWALREMOVED` |
+
diff --git a/doc/models/event-response.md b/doc/models/event-response.md
index 5ffe05ab..bdac7da1 100644
--- a/doc/models/event-response.md
+++ b/doc/models/event-response.md
@@ -17,7 +17,7 @@
{
"event": {
"id": 242,
- "key": "key0",
+ "key": "subscription_state_change",
"message": "message0",
"subscription_id": 96,
"customer_id": 24,
diff --git a/doc/models/event-type.md b/doc/models/event-type.md
deleted file mode 100644
index da8af062..00000000
--- a/doc/models/event-type.md
+++ /dev/null
@@ -1,46 +0,0 @@
-
-# Event Type
-
-## Enumeration
-
-`EventType`
-
-## Fields
-
-| Name |
-| --- |
-| `ACCOUNTTRANSACTIONCHANGED` |
-| `BILLINGDATECHANGE` |
-| `COMPONENTALLOCATIONCHANGE` |
-| `CUSTOMERUPDATE` |
-| `CUSTOMERCREATE` |
-| `DUNNINGSTEPREACHED` |
-| `EXPIRATIONDATECHANGE` |
-| `EXPIRINGCARD` |
-| `METEREDUSAGE` |
-| `PAYMENTSUCCESS` |
-| `PAYMENTSUCCESSRECREATED` |
-| `PAYMENTFAILURE` |
-| `PAYMENTFAILURERECREATED` |
-| `REFUNDFAILURE` |
-| `REFUNDSUCCESS` |
-| `RENEWALSUCCESS` |
-| `RENEWALSUCCESSRECREATED` |
-| `RENEWALFAILURE` |
-| `SIGNUPSUCCESS` |
-| `SIGNUPFAILURE` |
-| `STATEMENTCLOSED` |
-| `STATEMENTSETTLED` |
-| `SUBSCRIPTIONBANKACCOUNTUPDATE` |
-| `SUBSCRIPTIONDELETION` |
-| `SUBSCRIPTIONPAYPALACCOUNTUPDATE` |
-| `SUBSCRIPTIONPRODUCTCHANGE` |
-| `SUBSCRIPTIONSTATECHANGE` |
-| `TRIALENDNOTICE` |
-| `UPGRADEDOWNGRADESUCCESS` |
-| `UPGRADEDOWNGRADEFAILURE` |
-| `UPCOMINGRENEWALNOTICE` |
-| `CUSTOMFIELDVALUECHANGE` |
-| `SUBSCRIPTIONPREPAYMENTACCOUNTBALANCECHANGED` |
-| `SUBSCRIPTIONSERVICECREDITACCOUNTBALANCECHANGED` |
-
diff --git a/doc/models/event.md b/doc/models/event.md
index 8dbed5a9..08f48816 100644
--- a/doc/models/event.md
+++ b/doc/models/event.md
@@ -10,7 +10,7 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `Id` | `int64` | Required | - |
-| `Key` | `string` | Required | **Constraints**: *Minimum Length*: `1` |
+| `Key` | [`models.EventKey`](../../doc/models/event-key.md) | Required | - |
| `Message` | `string` | Required | **Constraints**: *Minimum Length*: `1` |
| `SubscriptionId` | `*int` | Required | - |
| `CustomerId` | `*int` | Required | - |
@@ -22,7 +22,7 @@
```json
{
"id": 40,
- "key": "key2",
+ "key": "invoice_issued",
"message": "message8",
"subscription_id": 150,
"customer_id": 78,
diff --git a/doc/models/invoice-avatax-details.md b/doc/models/invoice-avatax-details.md
new file mode 100644
index 00000000..07f0a385
--- /dev/null
+++ b/doc/models/invoice-avatax-details.md
@@ -0,0 +1,29 @@
+
+# Invoice Avatax Details
+
+## Structure
+
+`InvoiceAvataxDetails`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `Id` | `models.Optional[int64]` | Optional | - |
+| `Status` | `models.Optional[string]` | Optional | - |
+| `DocumentCode` | `models.Optional[string]` | Optional | - |
+| `CommitDate` | `models.Optional[time.Time]` | Optional | - |
+| `ModifyDate` | `models.Optional[time.Time]` | Optional | - |
+
+## Example (as JSON)
+
+```json
+{
+ "id": 112,
+ "status": "status2",
+ "document_code": "document_code0",
+ "commit_date": "2016-03-13T12:52:32.123Z",
+ "modify_date": "2016-03-13T12:52:32.123Z"
+}
+```
+
diff --git a/doc/models/invoice-debit.md b/doc/models/invoice-debit.md
new file mode 100644
index 00000000..04c36ac0
--- /dev/null
+++ b/doc/models/invoice-debit.md
@@ -0,0 +1,32 @@
+
+# Invoice Debit
+
+## Structure
+
+`InvoiceDebit`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `Uid` | `*string` | Optional | - |
+| `DebitNoteNumber` | `*string` | Optional | - |
+| `DebitNoteUid` | `*string` | Optional | - |
+| `Role` | [`*models.DebitNoteRole`](../../doc/models/debit-note-role.md) | Optional | The role of the debit note. |
+| `TransactionTime` | `*time.Time` | Optional | - |
+| `Memo` | `*string` | Optional | - |
+| `OriginalAmount` | `*string` | Optional | - |
+| `AppliedAmount` | `*string` | Optional | - |
+
+## Example (as JSON)
+
+```json
+{
+ "uid": "uid2",
+ "debit_note_number": "debit_note_number2",
+ "debit_note_uid": "debit_note_uid8",
+ "role": "chargeback",
+ "transaction_time": "2016-03-13T12:52:32.123Z"
+}
+```
+
diff --git a/doc/models/invoice-line-item.md b/doc/models/invoice-line-item.md
index 24af87ce..c9f9164f 100644
--- a/doc/models/invoice-line-item.md
+++ b/doc/models/invoice-line-item.md
@@ -26,6 +26,7 @@
| `ProductVersion` | `models.Optional[int]` | Optional | The version of the product subscribed when the charge was made. |
| `ComponentId` | `models.Optional[int]` | Optional | The ID of the component being billed. Will be `nil` for non-component charges. |
| `PricePointId` | `models.Optional[int]` | Optional | The price point ID of the component being billed. Will be `nil` for non-component charges. |
+| `BillingScheduleItemId` | `models.Optional[int]` | Optional | - |
| `Hide` | `*bool` | Optional | - |
| `ComponentCostData` | [`models.Optional[models.InvoiceLineItemComponentCostData]`](../../doc/models/invoice-line-item-component-cost-data.md) | Optional | - |
| `ProductPricePointId` | `models.Optional[int]` | Optional | The price point ID of the line item's product |
diff --git a/doc/models/invoice-status.md b/doc/models/invoice-status.md
index c4242ed9..87ba0765 100644
--- a/doc/models/invoice-status.md
+++ b/doc/models/invoice-status.md
@@ -17,4 +17,5 @@ The current status of the invoice. See [Invoice Statuses](https://maxio.zendesk.
| `PENDING` |
| `VOIDED` |
| `CANCELED` |
+| `PROCESSING` |
diff --git a/doc/models/invoice.md b/doc/models/invoice.md
index bd445b1e..82671980 100644
--- a/doc/models/invoice.md
+++ b/doc/models/invoice.md
@@ -48,6 +48,7 @@
| `TaxAmount` | `*string` | Optional | Total tax on the invoice. |
| `TotalAmount` | `*string` | Optional | The invoice total, which is `subtotal_amount - discount_amount + tax_amount`.' |
| `CreditAmount` | `*string` | Optional | The amount of credit (from credit notes) applied to this invoice.
Credits offset the amount due from the customer. |
+| `DebitAmount` | `*string` | Optional | - |
| `RefundAmount` | `*string` | Optional | - |
| `PaidAmount` | `*string` | Optional | The amount paid on the invoice by the customer. |
| `DueAmount` | `*string` | Optional | Amount due on the invoice, which is `total_amount - credit_amount - paid_amount`. |
@@ -55,10 +56,12 @@
| `Discounts` | [`[]models.InvoiceDiscount`](../../doc/models/invoice-discount.md) | Optional | - |
| `Taxes` | [`[]models.InvoiceTax`](../../doc/models/invoice-tax.md) | Optional | - |
| `Credits` | [`[]models.InvoiceCredit`](../../doc/models/invoice-credit.md) | Optional | - |
+| `Debits` | [`[]models.InvoiceDebit`](../../doc/models/invoice-debit.md) | Optional | - |
| `Refunds` | [`[]models.InvoiceRefund`](../../doc/models/invoice-refund.md) | Optional | - |
| `Payments` | [`[]models.InvoicePayment`](../../doc/models/invoice-payment.md) | Optional | - |
| `CustomFields` | [`[]models.InvoiceCustomField`](../../doc/models/invoice-custom-field.md) | Optional | - |
| `DisplaySettings` | [`*models.InvoiceDisplaySettings`](../../doc/models/invoice-display-settings.md) | Optional | - |
+| `AvataxDetails` | [`*models.InvoiceAvataxDetails`](../../doc/models/invoice-avatax-details.md) | Optional | - |
| `PublicUrl` | `*string` | Optional | The public URL of the invoice |
| `PreviousBalanceData` | [`*models.InvoicePreviousBalance`](../../doc/models/invoice-previous-balance.md) | Optional | - |
| `PublicUrlExpiresOn` | `*time.Time` | Optional | The format is `"YYYY-MM-DD"`. |
diff --git a/doc/models/issue-invoice-event-data.md b/doc/models/issue-invoice-event-data.md
index 7664088e..53d692e8 100644
--- a/doc/models/issue-invoice-event-data.md
+++ b/doc/models/issue-invoice-event-data.md
@@ -22,8 +22,8 @@ Example schema for an `issue_invoice` event
```json
{
"consolidation_level": "none",
- "from_status": "draft",
- "to_status": "voided",
+ "from_status": "voided",
+ "to_status": "draft",
"due_amount": "due_amount6",
"total_amount": "total_amount0"
}
diff --git a/doc/models/issue-invoice-event.md b/doc/models/issue-invoice-event.md
index 8a498ec1..68cc9045 100644
--- a/doc/models/issue-invoice-event.md
+++ b/doc/models/issue-invoice-event.md
@@ -35,8 +35,8 @@
"event_type": "issue_invoice",
"event_data": {
"consolidation_level": "child",
- "from_status": "paid",
- "to_status": "paid",
+ "from_status": "open",
+ "to_status": "pending",
"due_amount": "due_amount8",
"total_amount": "total_amount2"
}
diff --git a/doc/models/metered-component.md b/doc/models/metered-component.md
index 7ab9bfe3..f61c8cd0 100644
--- a/doc/models/metered-component.md
+++ b/doc/models/metered-component.md
@@ -16,13 +16,10 @@
| `Taxable` | `*bool` | Optional | Boolean flag describing whether a component is taxable or not. |
| `PricingScheme` | [`models.PricingScheme`](../../doc/models/pricing-scheme.md) | Required | 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 | (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes. |
-| `UpgradeCharge` | [`models.Optional[models.CreditType]`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. |
-| `DowngradeCredit` | [`models.Optional[models.CreditType]`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. |
| `PricePoints` | [`[]models.ComponentPricePointItem`](../../doc/models/component-price-point-item.md) | Optional | - |
| `UnitPrice` | [`*models.MeteredComponentUnitPrice`](../../doc/models/containers/metered-component-unit-price.md) | Optional | This is a container for one-of cases. |
| `TaxCode` | `*string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. |
| `HideDateRangeOnInvoice` | `*bool` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. |
-| `PriceInCents` | `*string` | Optional | deprecated May 2011 - use unit_price instead |
| `DisplayOnHostedPage` | `*bool` | Optional | - |
| `AllowFractionalQuantities` | `*bool` | Optional | - |
| `PublicSignupPageIds` | `[]int` | Optional | - |
@@ -46,7 +43,15 @@
"unit_price": 23.26
}
],
- "upgrade_charge": "full"
+ "price_points": [
+ {
+ "name": "name2",
+ "handle": "handle8",
+ "pricing_scheme": "per_unit",
+ "interval": 92,
+ "interval_unit": "day"
+ }
+ ]
}
```
diff --git a/doc/models/reason-codes-json-response.md b/doc/models/ok-response.md
similarity index 70%
rename from doc/models/reason-codes-json-response.md
rename to doc/models/ok-response.md
index 319fe242..a464e3f5 100644
--- a/doc/models/reason-codes-json-response.md
+++ b/doc/models/ok-response.md
@@ -1,9 +1,9 @@
-# Reason Codes Json Response
+# Ok Response
## Structure
-`ReasonCodesJsonResponse`
+`OkResponse`
## Fields
@@ -15,7 +15,7 @@
```json
{
- "ok": "ok2"
+ "ok": "ok4"
}
```
diff --git a/doc/models/on-off-component.md b/doc/models/on-off-component.md
index e22df608..73d31edd 100644
--- a/doc/models/on-off-component.md
+++ b/doc/models/on-off-component.md
@@ -13,14 +13,12 @@
| `Description` | `*string` | Optional | A description for the component that will be displayed to the user on the hosted signup page. |
| `Handle` | `*string` | Optional | A unique identifier for your use that can be used to retrieve this component is subsequent requests. Must start with a letter or number and may only contain lowercase letters, numbers, or the characters '.', ':', '-', or '_'.
**Constraints**: *Pattern*: `^[a-z0-9][a-z0-9\-_:.]*$` |
| `Taxable` | `*bool` | Optional | Boolean flag describing whether a component is taxable or not. |
-| `Prices` | [`[]models.Price`](../../doc/models/price.md) | Optional | (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261191737101-Price-Points-Components) for an overview of how price brackets work for different pricing schemes. |
| `UpgradeCharge` | [`models.Optional[models.CreditType]`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. |
| `DowngradeCredit` | [`models.Optional[models.CreditType]`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. |
| `PricePoints` | [`[]models.ComponentPricePointItem`](../../doc/models/component-price-point-item.md) | Optional | - |
-| `UnitPrice` | [`*models.OnOffComponentUnitPrice`](../../doc/models/containers/on-off-component-unit-price.md) | Optional | This is a container for one-of cases. |
+| `UnitPrice` | [`models.OnOffComponentUnitPrice`](../../doc/models/containers/on-off-component-unit-price.md) | Required | This is a container for one-of cases. |
| `TaxCode` | `*string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. |
| `HideDateRangeOnInvoice` | `*bool` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. |
-| `PriceInCents` | `*string` | Optional | deprecated May 2011 - use unit_price instead |
| `DisplayOnHostedPage` | `*bool` | Optional | - |
| `AllowFractionalQuantities` | `*bool` | Optional | - |
| `PublicSignupPageIds` | `[]int` | Optional | - |
@@ -35,24 +33,9 @@
"description": "description2",
"handle": "handle8",
"taxable": false,
- "prices": [
- {
- "starting_quantity": 242,
- "ending_quantity": 40,
- "unit_price": 23.26
- },
- {
- "starting_quantity": 242,
- "ending_quantity": 40,
- "unit_price": 23.26
- },
- {
- "starting_quantity": 242,
- "ending_quantity": 40,
- "unit_price": 23.26
- }
- ],
- "upgrade_charge": "prorated"
+ "upgrade_charge": "prorated",
+ "downgrade_credit": "prorated",
+ "unit_price": "String1"
}
```
diff --git a/doc/models/paid-invoice.md b/doc/models/paid-invoice.md
index 6fd9fe94..be44ea6c 100644
--- a/doc/models/paid-invoice.md
+++ b/doc/models/paid-invoice.md
@@ -19,7 +19,7 @@
```json
{
"invoice_id": "invoice_id6",
- "status": "draft",
+ "status": "open",
"due_amount": "due_amount8",
"paid_amount": "paid_amount8"
}
diff --git a/doc/models/prepaid-component-price-point.md b/doc/models/prepaid-component-price-point.md
deleted file mode 100644
index 6082e389..00000000
--- a/doc/models/prepaid-component-price-point.md
+++ /dev/null
@@ -1,49 +0,0 @@
-
-# Prepaid Component Price Point
-
-## Structure
-
-`PrepaidComponentPricePoint`
-
-## Fields
-
-| 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. |
-| `Prices` | [`[]models.Price`](../../doc/models/price.md) | Optional | - |
-| `OveragePricing` | [`*models.OveragePricing`](../../doc/models/overage-pricing.md) | Optional | - |
-
-## Example (as JSON)
-
-```json
-{
- "name": "name8",
- "handle": "handle4",
- "pricing_scheme": "stairstep",
- "prices": [
- {
- "starting_quantity": 242,
- "ending_quantity": 40,
- "unit_price": 23.26
- },
- {
- "starting_quantity": 242,
- "ending_quantity": 40,
- "unit_price": 23.26
- }
- ],
- "overage_pricing": {
- "pricing_scheme": "stairstep",
- "prices": [
- {
- "starting_quantity": 242,
- "ending_quantity": 40,
- "unit_price": 23.26
- }
- ]
- }
-}
-```
-
diff --git a/doc/models/prepaid-usage-component.md b/doc/models/prepaid-usage-component.md
index ecb83135..903b6ef2 100644
--- a/doc/models/prepaid-usage-component.md
+++ b/doc/models/prepaid-usage-component.md
@@ -10,20 +10,19 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `Name` | `string` | Required | A name for this component that is suitable for showing customers and displaying on billing statements, ie. "Minutes". |
-| `UnitName` | `*string` | Optional | The name of the unit of measurement for the component. It should be singular since it will be automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on a subscription’s component line-item |
+| `UnitName` | `string` | Required | The name of the unit of measurement for the component. It should be singular since it will be automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on a subscription’s component line-item |
| `Description` | `*string` | Optional | A description for the component that will be displayed to the user on the hosted signup page. |
| `Handle` | `*string` | Optional | A unique identifier for your use that can be used to retrieve this component is subsequent requests. Must start with a letter or number and may only contain lowercase letters, numbers, or the characters '.', ':', '-', or '_'.
**Constraints**: *Pattern*: `^[a-z0-9][a-z0-9\-_:.]*$` |
| `Taxable` | `*bool` | Optional | Boolean flag describing whether a component is taxable or not. |
-| `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. |
+| `PricingScheme` | [`models.PricingScheme`](../../doc/models/pricing-scheme.md) | Required | 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 | (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes. |
| `UpgradeCharge` | [`models.Optional[models.CreditType]`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. |
| `DowngradeCredit` | [`models.Optional[models.CreditType]`](../../doc/models/credit-type.md) | Optional | The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
Available values: `full`, `prorated`, `none`. |
-| `PricePoints` | [`[]models.PrepaidComponentPricePoint`](../../doc/models/prepaid-component-price-point.md) | Optional | - |
+| `PricePoints` | [`[]models.CreatePrepaidUsageComponentPricePoint`](../../doc/models/create-prepaid-usage-component-price-point.md) | Optional | - |
| `UnitPrice` | [`*models.PrepaidUsageComponentUnitPrice`](../../doc/models/containers/prepaid-usage-component-unit-price.md) | Optional | This is a container for one-of cases. |
| `TaxCode` | `*string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. |
| `HideDateRangeOnInvoice` | `*bool` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. |
-| `PriceInCents` | `*string` | Optional | deprecated May 2011 - use unit_price instead |
-| `OveragePricing` | [`*models.OveragePricing`](../../doc/models/overage-pricing.md) | Optional | - |
+| `OveragePricing` | [`models.OveragePricing`](../../doc/models/overage-pricing.md) | Required | - |
| `RolloverPrepaidRemainder` | `*bool` | Optional | Boolean which controls whether or not remaining units should be rolled over to the next period |
| `RenewPrepaidAllocation` | `*bool` | Optional | Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period |
| `ExpirationInterval` | `*float64` | Optional | (only for prepaid usage components where rollover_prepaid_remainder is true) The number of `expiration_interval_unit`s after which rollover amounts should expire |
@@ -41,7 +40,30 @@
"description": "description8",
"handle": "handle8",
"taxable": false,
- "pricing_scheme": "stairstep"
+ "pricing_scheme": "stairstep",
+ "prices": [
+ {
+ "starting_quantity": 242,
+ "ending_quantity": 40,
+ "unit_price": 23.26
+ },
+ {
+ "starting_quantity": 242,
+ "ending_quantity": 40,
+ "unit_price": 23.26
+ }
+ ],
+ "upgrade_charge": "prorated",
+ "overage_pricing": {
+ "pricing_scheme": "stairstep",
+ "prices": [
+ {
+ "starting_quantity": 242,
+ "ending_quantity": 40,
+ "unit_price": 23.26
+ }
+ ]
+ }
}
```
diff --git a/doc/models/quantity-based-component.md b/doc/models/quantity-based-component.md
index e71254e6..903ca5ff 100644
--- a/doc/models/quantity-based-component.md
+++ b/doc/models/quantity-based-component.md
@@ -22,7 +22,6 @@
| `UnitPrice` | [`*models.QuantityBasedComponentUnitPrice`](../../doc/models/containers/quantity-based-component-unit-price.md) | Optional | This is a container for one-of cases. |
| `TaxCode` | `*string` | Optional | A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters. |
| `HideDateRangeOnInvoice` | `*bool` | Optional | (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices. |
-| `PriceInCents` | `*string` | Optional | deprecated May 2011 - use unit_price instead |
| `Recurring` | `*bool` | Optional | - |
| `DisplayOnHostedPage` | `*bool` | Optional | - |
| `AllowFractionalQuantities` | `*bool` | Optional | - |
diff --git a/doc/models/subscription-group-member-error.md b/doc/models/subscription-group-member-error.md
deleted file mode 100644
index 0d141b30..00000000
--- a/doc/models/subscription-group-member-error.md
+++ /dev/null
@@ -1,25 +0,0 @@
-
-# Subscription Group Member Error
-
-## Structure
-
-`SubscriptionGroupMemberError`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `Id` | `*int` | Optional | - |
-| `Type` | `*string` | Optional | - |
-| `Message` | `*string` | Optional | - |
-
-## Example (as JSON)
-
-```json
-{
- "id": 56,
- "type": "type8",
- "message": "message2"
-}
-```
-
diff --git a/doc/models/subscription-group-signup-failure.md b/doc/models/subscription-group-signup-event-data.md
similarity index 66%
rename from doc/models/subscription-group-signup-failure.md
rename to doc/models/subscription-group-signup-event-data.md
index d5487b52..057606e6 100644
--- a/doc/models/subscription-group-signup-failure.md
+++ b/doc/models/subscription-group-signup-event-data.md
@@ -1,16 +1,16 @@
-# Subscription Group Signup Failure
+# Subscription Group Signup Event Data
## Structure
-`SubscriptionGroupSignupFailure`
+`SubscriptionGroupSignupEventData`
## Fields
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `SubscriptionGroup` | [`models.SubscriptionGroupSignupFailureData`](../../doc/models/subscription-group-signup-failure-data.md) | Required | - |
-| `Customer` | `*string` | Required | - |
+| `Customer` | [`*models.Customer`](../../doc/models/customer.md) | Required | - |
## Example (as JSON)
@@ -29,7 +29,13 @@
"organization": "organization6"
}
},
- "customer": "customer8"
+ "customer": {
+ "first_name": "first_name0",
+ "last_name": "last_name8",
+ "email": "email6",
+ "cc_emails": "cc_emails0",
+ "organization": "organization6"
+ }
}
```
diff --git a/doc/models/subscription-group-signup-success-data.md b/doc/models/subscription-group-signup-success-data.md
deleted file mode 100644
index 9381446b..00000000
--- a/doc/models/subscription-group-signup-success-data.md
+++ /dev/null
@@ -1,40 +0,0 @@
-
-# Subscription Group Signup Success Data
-
-## Structure
-
-`SubscriptionGroupSignupSuccessData`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `Uid` | `string` | Required | - |
-| `Scheme` | `int` | Required | - |
-| `CustomerId` | `int` | Required | - |
-| `PaymentProfileId` | `int` | Required | - |
-| `SubscriptionIds` | `[]int` | Required | - |
-| `PrimarySubscriptionId` | `int` | Required | - |
-| `NextAssessmentAt` | `time.Time` | Required | - |
-| `State` | `string` | Required | - |
-| `CancelAtEndOfPeriod` | `bool` | Required | - |
-
-## Example (as JSON)
-
-```json
-{
- "uid": "uid8",
- "scheme": 154,
- "customer_id": 174,
- "payment_profile_id": 82,
- "subscription_ids": [
- 28,
- 29
- ],
- "primary_subscription_id": 102,
- "next_assessment_at": "2016-03-13T12:52:32.123Z",
- "state": "state4",
- "cancel_at_end_of_period": false
-}
-```
-
diff --git a/doc/models/subscription-group-signup-success.md b/doc/models/subscription-group-signup-success.md
deleted file mode 100644
index aff98447..00000000
--- a/doc/models/subscription-group-signup-success.md
+++ /dev/null
@@ -1,42 +0,0 @@
-
-# Subscription Group Signup Success
-
-## Structure
-
-`SubscriptionGroupSignupSuccess`
-
-## Fields
-
-| Name | Type | Tags | Description |
-| --- | --- | --- | --- |
-| `SubscriptionGroup` | [`models.SubscriptionGroupSignupSuccessData`](../../doc/models/subscription-group-signup-success-data.md) | Required | - |
-| `Customer` | [`models.Customer`](../../doc/models/customer.md) | Required | - |
-
-## Example (as JSON)
-
-```json
-{
- "subscription_group": {
- "uid": "uid8",
- "scheme": 200,
- "customer_id": 220,
- "payment_profile_id": 128,
- "subscription_ids": [
- 74,
- 75
- ],
- "primary_subscription_id": 148,
- "next_assessment_at": "2016-03-13T12:52:32.123Z",
- "state": "state6",
- "cancel_at_end_of_period": false
- },
- "customer": {
- "first_name": "first_name0",
- "last_name": "last_name8",
- "email": "email6",
- "cc_emails": "cc_emails0",
- "organization": "organization6"
- }
-}
-```
-
diff --git a/doc/models/subscription-group-update-error-response-exception.md b/doc/models/subscription-group-update-error-response-exception.md
index 9b363907..7acbe793 100644
--- a/doc/models/subscription-group-update-error-response-exception.md
+++ b/doc/models/subscription-group-update-error-response-exception.md
@@ -17,16 +17,8 @@
{
"errors": {
"members": [
- {
- "id": 204,
- "type": "type2",
- "message": "message8"
- },
- {
- "id": 204,
- "type": "type2",
- "message": "message8"
- }
+ "members2",
+ "members1"
]
}
}
diff --git a/doc/models/subscription-group-update-error.md b/doc/models/subscription-group-update-error.md
index 9948c0b8..686e4518 100644
--- a/doc/models/subscription-group-update-error.md
+++ b/doc/models/subscription-group-update-error.md
@@ -9,28 +9,16 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
-| `Members` | [`[]models.SubscriptionGroupMemberError`](../../doc/models/subscription-group-member-error.md) | Optional | - |
+| `Members` | `[]string` | Optional | - |
## Example (as JSON)
```json
{
"members": [
- {
- "id": 204,
- "type": "type2",
- "message": "message8"
- },
- {
- "id": 204,
- "type": "type2",
- "message": "message8"
- },
- {
- "id": 204,
- "type": "type2",
- "message": "message8"
- }
+ "members4",
+ "members5",
+ "members6"
]
}
```
diff --git a/doc/models/subscription-response-error-exception.md b/doc/models/subscription-response-error-exception.md
new file mode 100644
index 00000000..a31671a5
--- /dev/null
+++ b/doc/models/subscription-response-error-exception.md
@@ -0,0 +1,27 @@
+
+# Subscription Response Error Exception
+
+## Structure
+
+`SubscriptionResponseErrorException`
+
+## Fields
+
+| Name | Type | Tags | Description |
+| --- | --- | --- | --- |
+| `Subscription` | [`*models.Subscription`](../../doc/models/subscription.md) | Optional | - |
+
+## Example (as JSON)
+
+```json
+{
+ "subscription": {
+ "id": 8,
+ "state": "paused",
+ "balance_in_cents": 124,
+ "total_revenue_in_cents": 48,
+ "product_price_in_cents": 238
+ }
+}
+```
+
diff --git a/doc/models/update-currency-price.md b/doc/models/update-currency-price.md
index 4c2d3cd7..6ee1330f 100644
--- a/doc/models/update-currency-price.md
+++ b/doc/models/update-currency-price.md
@@ -10,14 +10,14 @@
| Name | Type | Tags | Description |
| --- | --- | --- | --- |
| `Id` | `int` | Required | ID of the currency price record being updated |
-| `Price` | `int` | Required | New price for the given currency |
+| `Price` | `float64` | Required | New price for the given currency |
## Example (as JSON)
```json
{
"id": 146,
- "price": 18
+ "price": 71.86
}
```
diff --git a/doc/models/update-currency-prices-request.md b/doc/models/update-currency-prices-request.md
index 818744d5..199e42b2 100644
--- a/doc/models/update-currency-prices-request.md
+++ b/doc/models/update-currency-prices-request.md
@@ -18,7 +18,7 @@
"currency_prices": [
{
"id": 50,
- "price": 78
+ "price": 233.74
}
]
}
diff --git a/doc/models/update-subscription.md b/doc/models/update-subscription.md
index 02a0d317..a5ba1dcd 100644
--- a/doc/models/update-subscription.md
+++ b/doc/models/update-subscription.md
@@ -24,7 +24,7 @@
| `Reference` | `*string` | Optional | - |
| `CustomPrice` | [`*models.SubscriptionCustomPrice`](../../doc/models/subscription-custom-price.md) | Optional | (Optional) Used in place of `product_price_point_id` to define a custom price point unique to the subscription |
| `Components` | [`[]models.UpdateSubscriptionComponent`](../../doc/models/update-subscription-component.md) | Optional | (Optional) An array of component ids and custom prices to be added to the subscription. |
-| `DunningCommunicationDelayEnabled` | `models.Optional[bool]` | Optional | Enable Communication Delay feature, making sure no communication (email or SMS) is sent to the Customer between 9PM and 8AM in time zone set by the `dunning_communication_delay_time_zone` attribute. |
+| `DunningCommunicationDelayEnabled` | `*bool` | Optional | Enable Communication Delay feature, making sure no communication (email or SMS) is sent to the Customer between 9PM and 8AM in time zone set by the `dunning_communication_delay_time_zone` attribute. |
| `DunningCommunicationDelayTimeZone` | `models.Optional[string]` | Optional | Time zone for the Dunning Communication Delay feature. |
| `ProductPricePointId` | `*int` | Optional | Set to change the current product's price point. |
| `ProductPricePointHandle` | `*string` | Optional | Set to change the current product's price point. |
diff --git a/errors/errors.go b/errors/errors.go
index f9556128..ef19fdbe 100644
--- a/errors/errors.go
+++ b/errors/errors.go
@@ -416,6 +416,26 @@ func (s SubscriptionRemoveCouponErrors) Error() string {
return fmt.Sprintf("SubscriptionRemoveCouponErrors occured: %v", s.Message)
}
+// SubscriptionResponseError is a custom error.
+type SubscriptionResponseError struct {
+ https.ApiError
+ Subscription *models.Subscription `json:"subscription,omitempty"`
+}
+
+// NewSubscriptionResponseError is a constructor for SubscriptionResponseError.
+// It creates and returns a pointer to a new SubscriptionResponseError instance with the given statusCode and body.
+func NewSubscriptionResponseError(apiError https.ApiError) error {
+ return &SubscriptionResponseError{
+ ApiError: apiError,
+ }
+}
+
+// Error implements the Error method for the error interface.
+// It returns a formatted error message for SubscriptionResponseError.
+func (s SubscriptionResponseError) Error() string {
+ return fmt.Sprintf("SubscriptionResponseError occured: %v", s.Message)
+}
+
// SubscriptionsMrrErrorResponse is a custom error.
type SubscriptionsMrrErrorResponse struct {
https.ApiError
diff --git a/events_controller.go b/events_controller.go
index 3a9f9b08..1d4e94c9 100644
--- a/events_controller.go
+++ b/events_controller.go
@@ -40,7 +40,7 @@ type ListEventsInput struct {
Direction *models.Direction
// You can pass multiple event keys after comma.
// Use in query `filter=signup_success,payment_success`.
- Filter []models.EventType
+ Filter []models.EventKey
// The type of filter you would like to apply to your search.
DateField *models.ListEventsDateField
// The start date (format YYYY-MM-DD) with which to filter the date_field. Returns components with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified.
@@ -69,9 +69,13 @@ type ListEventsInput struct {
// + `renewal_success_recreated`
// + `zferral_revenue_post_failure` - (Specific to the deprecated Zferral integration)
// + `zferral_revenue_post_success` - (Specific to the deprecated Zferral integration)
+// ## Event Key
+// The event type is identified by the key property. You can check supported keys [here]($m/Event%20Key).
// ## Event Specific Data
-// Event Specific Data
-// Each event type has its own `event_specific_data` specified.
+// Different event types may include additional data in `event_specific_data` property.
+// While some events share the same schema for `event_specific_data`, others may not include it at all.
+// For precise mappings from key to event_specific_data, refer to [Event]($m/Event).
+// ### Example
// Here’s an example event for the `subscription_product_change` event:
// ```
// {
@@ -157,29 +161,34 @@ func (e *EventsController) ListEvents(
// ListSubscriptionEventsInput represents the input of the ListSubscriptionEvents endpoint.
type ListSubscriptionEventsInput struct {
// The Chargify id of the subscription
- SubscriptionId int
+ SubscriptionId int
// Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
// Use in query `page=1`.
- Page *int
+ Page *int
// This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
// Use in query `per_page=200`.
- PerPage *int
+ PerPage *int
// Returns events with an id greater than or equal to the one specified
- SinceId *int64
+ SinceId *int64
// Returns events with an id less than or equal to the one specified
- MaxId *int64
+ MaxId *int64
// The sort direction of the returned events.
- Direction *models.Direction
+ Direction *models.Direction
// You can pass multiple event keys after comma.
// Use in query `filter=signup_success,payment_success`.
- Filter []models.EventType
+ Filter []models.EventKey
}
// ListSubscriptionEvents takes context, subscriptionId, page, perPage, sinceId, maxId, direction, filter as parameters and
// returns an models.ApiResponse with []models.EventResponse data and
// an error if there was an issue with the request or response.
// The following request will return a list of events for a subscription.
-// Each event type has its own `event_specific_data` specified.
+// ## Event Key
+// The event type is identified by the key property. You can check supported keys [here]($m/Event%20Key).
+// ## Event Specific Data
+// Different event types may include additional data in `event_specific_data` property.
+// While some events share the same schema for `event_specific_data`, others may not include it at all.
+// For precise mappings from key to event_specific_data, refer to [Event]($m/Event).
func (e *EventsController) ListSubscriptionEvents(
ctx context.Context,
input ListSubscriptionEventsInput) (
@@ -224,19 +233,19 @@ func (e *EventsController) ListSubscriptionEvents(
type ReadEventsCountInput struct {
// Result records are organized in pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned.
// Use in query `page=1`.
- Page *int
+ Page *int
// This parameter indicates how many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200.
// Use in query `per_page=200`.
- PerPage *int
+ PerPage *int
// Returns events with an id greater than or equal to the one specified
- SinceId *int64
+ SinceId *int64
// Returns events with an id less than or equal to the one specified
- MaxId *int64
+ MaxId *int64
// The sort direction of the returned events.
- Direction *models.Direction
+ Direction *models.Direction
// You can pass multiple event keys after comma.
// Use in query `filter=signup_success,payment_success`.
- Filter []models.EventType
+ Filter []models.EventKey
}
// ReadEventsCount takes context, page, perPage, sinceId, maxId, direction, filter as parameters and
diff --git a/go.mod b/go.mod
index 445ef80a..6877ab66 100644
--- a/go.mod
+++ b/go.mod
@@ -2,6 +2,6 @@ module github.com/maxio-com/ab-golang-sdk
go 1.18
-require github.com/apimatic/go-core-runtime v0.0.25
+require github.com/apimatic/go-core-runtime v0.0.27
require github.com/google/uuid v1.6.0 // indirect
diff --git a/go.sum b/go.sum
index 4dbab2d9..ece1ad9b 100644
--- a/go.sum
+++ b/go.sum
@@ -1,4 +1,4 @@
-github.com/apimatic/go-core-runtime v0.0.25 h1:bEndGNqpBMZc9QSlUTcjw+RTrLEATi702N2raqPC44g=
-github.com/apimatic/go-core-runtime v0.0.25/go.mod h1:eYSG9icLyMjbPWq212ELOQ4PZdlT2RihZGXEaAZdx6Q=
+github.com/apimatic/go-core-runtime v0.0.27 h1:xRLbPQD94GhGfC3k1ro8HyMcooBFKPYT4yVzQCbKi34=
+github.com/apimatic/go-core-runtime v0.0.27/go.mod h1:eYSG9icLyMjbPWq212ELOQ4PZdlT2RihZGXEaAZdx6Q=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
diff --git a/models/account_balance.go b/models/account_balance.go
index 41d83c9f..4ccef11d 100644
--- a/models/account_balance.go
+++ b/models/account_balance.go
@@ -12,12 +12,12 @@ import (
// AccountBalance represents a AccountBalance struct.
type AccountBalance struct {
// The balance in cents.
- BalanceInCents *int64 `json:"balance_in_cents,omitempty"`
+ BalanceInCents *int64 `json:"balance_in_cents,omitempty"`
// The automatic balance in cents.
- AutomaticBalanceInCents Optional[int64] `json:"automatic_balance_in_cents"`
+ AutomaticBalanceInCents Optional[int64] `json:"automatic_balance_in_cents"`
// The remittance balance in cents.
- RemittanceBalanceInCents Optional[int64] `json:"remittance_balance_in_cents"`
- AdditionalProperties map[string]any `json:"_"`
+ RemittanceBalanceInCents Optional[int64] `json:"remittance_balance_in_cents"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AccountBalance.
@@ -25,13 +25,17 @@ type AccountBalance struct {
func (a AccountBalance) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "balance_in_cents", "automatic_balance_in_cents", "remittance_balance_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AccountBalance object to a map representation for JSON marshaling.
func (a AccountBalance) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.BalanceInCents != nil {
structMap["balance_in_cents"] = a.BalanceInCents
}
@@ -60,12 +64,12 @@ func (a *AccountBalance) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "balance_in_cents", "automatic_balance_in_cents", "remittance_balance_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "balance_in_cents", "automatic_balance_in_cents", "remittance_balance_in_cents")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.BalanceInCents = temp.BalanceInCents
a.AutomaticBalanceInCents = temp.AutomaticBalanceInCents
a.RemittanceBalanceInCents = temp.RemittanceBalanceInCents
diff --git a/models/account_balances.go b/models/account_balances.go
index 4cbe0c25..a3932fc9 100644
--- a/models/account_balances.go
+++ b/models/account_balances.go
@@ -12,16 +12,16 @@ import (
// AccountBalances represents a AccountBalances struct.
type AccountBalances struct {
// The balance, in cents, of the sum of the subscription's open, payable invoices.
- OpenInvoices *AccountBalance `json:"open_invoices,omitempty"`
+ OpenInvoices *AccountBalance `json:"open_invoices,omitempty"`
// The balance, in cents, of the sum of the subscription's pending, payable invoices.
- PendingInvoices *AccountBalance `json:"pending_invoices,omitempty"`
+ PendingInvoices *AccountBalance `json:"pending_invoices,omitempty"`
// The balance, in cents, of the subscription's Pending Discount account.
- PendingDiscounts *AccountBalance `json:"pending_discounts,omitempty"`
+ PendingDiscounts *AccountBalance `json:"pending_discounts,omitempty"`
// The balance, in cents, of the subscription's Service Credit account.
- ServiceCredits *AccountBalance `json:"service_credits,omitempty"`
+ ServiceCredits *AccountBalance `json:"service_credits,omitempty"`
// The balance, in cents, of the subscription's Prepayment account.
- Prepayments *AccountBalance `json:"prepayments,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Prepayments *AccountBalance `json:"prepayments,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AccountBalances.
@@ -29,13 +29,17 @@ type AccountBalances struct {
func (a AccountBalances) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "open_invoices", "pending_invoices", "pending_discounts", "service_credits", "prepayments"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AccountBalances object to a map representation for JSON marshaling.
func (a AccountBalances) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.OpenInvoices != nil {
structMap["open_invoices"] = a.OpenInvoices.toMap()
}
@@ -62,12 +66,12 @@ func (a *AccountBalances) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "open_invoices", "pending_invoices", "pending_discounts", "service_credits", "prepayments")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "open_invoices", "pending_invoices", "pending_discounts", "service_credits", "prepayments")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.OpenInvoices = temp.OpenInvoices
a.PendingInvoices = temp.PendingInvoices
a.PendingDiscounts = temp.PendingDiscounts
diff --git a/models/ach_agreement.go b/models/ach_agreement.go
index 962c48a4..dffd510b 100644
--- a/models/ach_agreement.go
+++ b/models/ach_agreement.go
@@ -13,14 +13,14 @@ import (
// (Optional) If passed, the proof of the authorized ACH agreement terms will be persisted.
type ACHAgreement struct {
// (Required when providing ACH agreement params) The ACH authorization agreement terms.
- AgreementTerms *string `json:"agreement_terms,omitempty"`
+ AgreementTerms *string `json:"agreement_terms,omitempty"`
// (Required when providing ACH agreement params) The first name of the person authorizing the ACH agreement.
- AuthorizerFirstName *string `json:"authorizer_first_name,omitempty"`
+ AuthorizerFirstName *string `json:"authorizer_first_name,omitempty"`
// (Required when providing ACH agreement params) The last name of the person authorizing the ACH agreement.
- AuthorizerLastName *string `json:"authorizer_last_name,omitempty"`
+ AuthorizerLastName *string `json:"authorizer_last_name,omitempty"`
// (Required when providing ACH agreement params) The IP address of the person authorizing the ACH agreement.
- IpAddress *string `json:"ip_address,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ IpAddress *string `json:"ip_address,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ACHAgreement.
@@ -28,13 +28,17 @@ type ACHAgreement struct {
func (a ACHAgreement) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "agreement_terms", "authorizer_first_name", "authorizer_last_name", "ip_address"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the ACHAgreement object to a map representation for JSON marshaling.
func (a ACHAgreement) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.AgreementTerms != nil {
structMap["agreement_terms"] = a.AgreementTerms
}
@@ -58,12 +62,12 @@ func (a *ACHAgreement) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "agreement_terms", "authorizer_first_name", "authorizer_last_name", "ip_address")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "agreement_terms", "authorizer_first_name", "authorizer_last_name", "ip_address")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.AgreementTerms = temp.AgreementTerms
a.AuthorizerFirstName = temp.AuthorizerFirstName
a.AuthorizerLastName = temp.AuthorizerLastName
diff --git a/models/activate_event_based_component.go b/models/activate_event_based_component.go
index 20ed9829..7a59fb36 100644
--- a/models/activate_event_based_component.go
+++ b/models/activate_event_based_component.go
@@ -12,12 +12,12 @@ import (
// ActivateEventBasedComponent represents a ActivateEventBasedComponent struct.
type ActivateEventBasedComponent struct {
// The Chargify id of the price point
- PricePointId *int `json:"price_point_id,omitempty"`
+ PricePointId *int `json:"price_point_id,omitempty"`
// This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled
- BillingSchedule *BillingSchedule `json:"billing_schedule,omitempty"`
+ BillingSchedule *BillingSchedule `json:"billing_schedule,omitempty"`
// Create or update custom pricing unique to the subscription. Used in place of `price_point_id`.
- CustomPrice *ComponentCustomPrice `json:"custom_price,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CustomPrice *ComponentCustomPrice `json:"custom_price,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ActivateEventBasedComponent.
@@ -25,13 +25,17 @@ type ActivateEventBasedComponent struct {
func (a ActivateEventBasedComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "price_point_id", "billing_schedule", "custom_price"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the ActivateEventBasedComponent object to a map representation for JSON marshaling.
func (a ActivateEventBasedComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.PricePointId != nil {
structMap["price_point_id"] = a.PricePointId
}
@@ -52,12 +56,12 @@ func (a *ActivateEventBasedComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_point_id", "billing_schedule", "custom_price")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_point_id", "billing_schedule", "custom_price")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.PricePointId = temp.PricePointId
a.BillingSchedule = temp.BillingSchedule
a.CustomPrice = temp.CustomPrice
diff --git a/models/activate_subscription_request.go b/models/activate_subscription_request.go
index cc062658..44b3a258 100644
--- a/models/activate_subscription_request.go
+++ b/models/activate_subscription_request.go
@@ -12,8 +12,8 @@ import (
// ActivateSubscriptionRequest represents a ActivateSubscriptionRequest struct.
type ActivateSubscriptionRequest struct {
// You may choose how to handle the activation failure. `true` means do not change the subscription’s state and billing period. `false` means to continue through with the activation and enter an end of life state. If this parameter is omitted or `null` is passed it will default to value set in the site settings (default: `true`)
- RevertOnFailure Optional[bool] `json:"revert_on_failure"`
- AdditionalProperties map[string]any `json:"_"`
+ RevertOnFailure Optional[bool] `json:"revert_on_failure"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ActivateSubscriptionRequest.
@@ -21,13 +21,17 @@ type ActivateSubscriptionRequest struct {
func (a ActivateSubscriptionRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "revert_on_failure"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the ActivateSubscriptionRequest object to a map representation for JSON marshaling.
func (a ActivateSubscriptionRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.RevertOnFailure.IsValueSet() {
if a.RevertOnFailure.Value() != nil {
structMap["revert_on_failure"] = a.RevertOnFailure.Value()
@@ -46,12 +50,12 @@ func (a *ActivateSubscriptionRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "revert_on_failure")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "revert_on_failure")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.RevertOnFailure = temp.RevertOnFailure
return nil
}
diff --git a/models/add_coupons_request.go b/models/add_coupons_request.go
index 5e35d57c..e1c89bf1 100644
--- a/models/add_coupons_request.go
+++ b/models/add_coupons_request.go
@@ -11,8 +11,8 @@ import (
// AddCouponsRequest represents a AddCouponsRequest struct.
type AddCouponsRequest struct {
- Codes []string `json:"codes,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Codes []string `json:"codes,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AddCouponsRequest.
@@ -20,13 +20,17 @@ type AddCouponsRequest struct {
func (a AddCouponsRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "codes"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AddCouponsRequest object to a map representation for JSON marshaling.
func (a AddCouponsRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.Codes != nil {
structMap["codes"] = a.Codes
}
@@ -41,12 +45,12 @@ func (a *AddCouponsRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "codes")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "codes")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.Codes = temp.Codes
return nil
}
diff --git a/models/add_subscription_to_a_group.go b/models/add_subscription_to_a_group.go
index 662ba3a2..0363c0ab 100644
--- a/models/add_subscription_to_a_group.go
+++ b/models/add_subscription_to_a_group.go
@@ -11,8 +11,8 @@ import (
// AddSubscriptionToAGroup represents a AddSubscriptionToAGroup struct.
type AddSubscriptionToAGroup struct {
- Group *AddSubscriptionToAGroupGroup `json:"group,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Group *GroupSettings `json:"group,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AddSubscriptionToAGroup.
@@ -20,13 +20,17 @@ type AddSubscriptionToAGroup struct {
func (a AddSubscriptionToAGroup) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "group"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AddSubscriptionToAGroup object to a map representation for JSON marshaling.
func (a AddSubscriptionToAGroup) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.Group != nil {
structMap["group"] = a.Group.toMap()
}
@@ -41,17 +45,17 @@ func (a *AddSubscriptionToAGroup) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "group")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "group")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.Group = temp.Group
return nil
}
// tempAddSubscriptionToAGroup is a temporary struct used for validating the fields of AddSubscriptionToAGroup.
type tempAddSubscriptionToAGroup struct {
- Group *AddSubscriptionToAGroupGroup `json:"group,omitempty"`
+ Group *GroupSettings `json:"group,omitempty"`
}
diff --git a/models/add_subscription_to_a_group_group.go b/models/add_subscription_to_a_group_group.go
deleted file mode 100644
index aff34d1a..00000000
--- a/models/add_subscription_to_a_group_group.go
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-Package advancedbilling
-
-This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
-*/
-package models
-
-import (
- "encoding/json"
- "errors"
- "strings"
-)
-
-// AddSubscriptionToAGroupGroup represents a AddSubscriptionToAGroupGroup struct.
-// This is a container for one-of cases.
-type AddSubscriptionToAGroupGroup struct {
- value any
- isGroupSettings bool
- isBoolean bool
-}
-
-// String converts the AddSubscriptionToAGroupGroup object to a string representation.
-func (a AddSubscriptionToAGroupGroup) String() string {
- if bytes, err := json.Marshal(a.value); err == nil {
- return strings.Trim(string(bytes), "\"")
- }
- return ""
-}
-
-// MarshalJSON implements the json.Marshaler interface for AddSubscriptionToAGroupGroup.
-// It customizes the JSON marshaling process for AddSubscriptionToAGroupGroup objects.
-func (a AddSubscriptionToAGroupGroup) MarshalJSON() (
- []byte,
- error) {
- if a.value == nil {
- return nil, errors.New("No underlying type is set. Please use any of the `models.AddSubscriptionToAGroupGroupContainer.From*` functions to initialize the AddSubscriptionToAGroupGroup object.")
- }
- return json.Marshal(a.toMap())
-}
-
-// toMap converts the AddSubscriptionToAGroupGroup object to a map representation for JSON marshaling.
-func (a *AddSubscriptionToAGroupGroup) toMap() any {
- switch obj := a.value.(type) {
- case *GroupSettings:
- return obj.toMap()
- case *bool:
- return *obj
- }
- return nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for AddSubscriptionToAGroupGroup.
-// It customizes the JSON unmarshaling process for AddSubscriptionToAGroupGroup objects.
-func (a *AddSubscriptionToAGroupGroup) UnmarshalJSON(input []byte) error {
- result, err := UnmarshallOneOf(input,
- NewTypeHolder(&GroupSettings{}, false, &a.isGroupSettings),
- NewTypeHolder(new(bool), false, &a.isBoolean),
- )
-
- a.value = result
- return err
-}
-
-func (a *AddSubscriptionToAGroupGroup) AsGroupSettings() (
- *GroupSettings,
- bool) {
- if !a.isGroupSettings {
- return nil, false
- }
- return a.value.(*GroupSettings), true
-}
-
-func (a *AddSubscriptionToAGroupGroup) AsBoolean() (
- *bool,
- bool) {
- if !a.isBoolean {
- return nil, false
- }
- return a.value.(*bool), true
-}
-
-// internalAddSubscriptionToAGroupGroup represents a addSubscriptionToAGroupGroup struct.
-// This is a container for one-of cases.
-type internalAddSubscriptionToAGroupGroup struct {}
-
-var AddSubscriptionToAGroupGroupContainer internalAddSubscriptionToAGroupGroup
-
-// The internalAddSubscriptionToAGroupGroup instance, wrapping the provided GroupSettings value.
-func (a *internalAddSubscriptionToAGroupGroup) FromGroupSettings(val GroupSettings) AddSubscriptionToAGroupGroup {
- return AddSubscriptionToAGroupGroup{value: &val}
-}
-
-// The internalAddSubscriptionToAGroupGroup instance, wrapping the provided bool value.
-func (a *internalAddSubscriptionToAGroupGroup) FromBoolean(val bool) AddSubscriptionToAGroupGroup {
- return AddSubscriptionToAGroupGroup{value: &val}
-}
diff --git a/models/address_change.go b/models/address_change.go
index a0ec064d..ecf80599 100644
--- a/models/address_change.go
+++ b/models/address_change.go
@@ -13,9 +13,9 @@ import (
// AddressChange represents a AddressChange struct.
type AddressChange struct {
- Before InvoiceAddress `json:"before"`
- After InvoiceAddress `json:"after"`
- AdditionalProperties map[string]any `json:"_"`
+ Before InvoiceAddress `json:"before"`
+ After InvoiceAddress `json:"after"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AddressChange.
@@ -23,13 +23,17 @@ type AddressChange struct {
func (a AddressChange) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "before", "after"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AddressChange object to a map representation for JSON marshaling.
func (a AddressChange) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
structMap["before"] = a.Before.toMap()
structMap["after"] = a.After.toMap()
return structMap
@@ -47,12 +51,12 @@ func (a *AddressChange) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "before", "after")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "before", "after")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.Before = *temp.Before
a.After = *temp.After
return nil
diff --git a/models/agreement_acceptance.go b/models/agreement_acceptance.go
index 85b6c041..69ac3155 100644
--- a/models/agreement_acceptance.go
+++ b/models/agreement_acceptance.go
@@ -13,14 +13,14 @@ import (
// Required when creating a subscription with Maxio Payments.
type AgreementAcceptance struct {
// Required when providing agreement acceptance params.
- IpAddress *string `json:"ip_address,omitempty"`
+ IpAddress *string `json:"ip_address,omitempty"`
// Required when creating a subscription with Maxio Payments. Either terms_url or provacy_policy_url required when providing agreement_acceptance params.
- TermsUrl *string `json:"terms_url,omitempty"`
- PrivacyPolicyUrl *string `json:"privacy_policy_url,omitempty"`
- ReturnRefundPolicyUrl *string `json:"return_refund_policy_url,omitempty"`
- DeliveryPolicyUrl *string `json:"delivery_policy_url,omitempty"`
- SecureCheckoutPolicyUrl *string `json:"secure_checkout_policy_url,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ TermsUrl *string `json:"terms_url,omitempty"`
+ PrivacyPolicyUrl *string `json:"privacy_policy_url,omitempty"`
+ ReturnRefundPolicyUrl *string `json:"return_refund_policy_url,omitempty"`
+ DeliveryPolicyUrl *string `json:"delivery_policy_url,omitempty"`
+ SecureCheckoutPolicyUrl *string `json:"secure_checkout_policy_url,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AgreementAcceptance.
@@ -28,13 +28,17 @@ type AgreementAcceptance struct {
func (a AgreementAcceptance) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "ip_address", "terms_url", "privacy_policy_url", "return_refund_policy_url", "delivery_policy_url", "secure_checkout_policy_url"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AgreementAcceptance object to a map representation for JSON marshaling.
func (a AgreementAcceptance) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.IpAddress != nil {
structMap["ip_address"] = a.IpAddress
}
@@ -64,12 +68,12 @@ func (a *AgreementAcceptance) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "ip_address", "terms_url", "privacy_policy_url", "return_refund_policy_url", "delivery_policy_url", "secure_checkout_policy_url")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "ip_address", "terms_url", "privacy_policy_url", "return_refund_policy_url", "delivery_policy_url", "secure_checkout_policy_url")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.IpAddress = temp.IpAddress
a.TermsUrl = temp.TermsUrl
a.PrivacyPolicyUrl = temp.PrivacyPolicyUrl
diff --git a/models/allocate_components.go b/models/allocate_components.go
index cb060d71..cfb1a419 100644
--- a/models/allocate_components.go
+++ b/models/allocate_components.go
@@ -11,22 +11,22 @@ import (
// AllocateComponents represents a AllocateComponents struct.
type AllocateComponents struct {
- ProrationUpgradeScheme *string `json:"proration_upgrade_scheme,omitempty"` // Deprecated
- ProrationDowngradeScheme *string `json:"proration_downgrade_scheme,omitempty"` // Deprecated
- Allocations []CreateAllocation `json:"allocations,omitempty"`
- AccrueCharge *bool `json:"accrue_charge,omitempty"`
+ ProrationUpgradeScheme *string `json:"proration_upgrade_scheme,omitempty"` // Deprecated
+ ProrationDowngradeScheme *string `json:"proration_downgrade_scheme,omitempty"` // Deprecated
+ Allocations []CreateAllocation `json:"allocations,omitempty"`
+ AccrueCharge *bool `json:"accrue_charge,omitempty"`
// The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
// Available values: `full`, `prorated`, `none`.
- UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
+ UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
// The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
// Available values: `full`, `prorated`, `none`.
- DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
+ DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
// (Optional) If not passed, the allocation(s) will use the payment collection method on the subscription
- PaymentCollectionMethod *CollectionMethod `json:"payment_collection_method,omitempty"`
+ PaymentCollectionMethod *CollectionMethod `json:"payment_collection_method,omitempty"`
// If true, if the immediate component payment fails, initiate dunning for the subscription.
// Otherwise, leave the charges on the subscription to pay for at renewal.
- InitiateDunning *bool `json:"initiate_dunning,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ InitiateDunning *bool `json:"initiate_dunning,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AllocateComponents.
@@ -34,13 +34,17 @@ type AllocateComponents struct {
func (a AllocateComponents) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "proration_upgrade_scheme", "proration_downgrade_scheme", "allocations", "accrue_charge", "upgrade_charge", "downgrade_credit", "payment_collection_method", "initiate_dunning"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AllocateComponents object to a map representation for JSON marshaling.
func (a AllocateComponents) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.ProrationUpgradeScheme != nil {
structMap["proration_upgrade_scheme"] = a.ProrationUpgradeScheme
}
@@ -84,12 +88,12 @@ func (a *AllocateComponents) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "proration_upgrade_scheme", "proration_downgrade_scheme", "allocations", "accrue_charge", "upgrade_charge", "downgrade_credit", "payment_collection_method", "initiate_dunning")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "proration_upgrade_scheme", "proration_downgrade_scheme", "allocations", "accrue_charge", "upgrade_charge", "downgrade_credit", "payment_collection_method", "initiate_dunning")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.ProrationUpgradeScheme = temp.ProrationUpgradeScheme
a.ProrationDowngradeScheme = temp.ProrationDowngradeScheme
a.Allocations = temp.Allocations
diff --git a/models/allocation.go b/models/allocation.go
index 739a6bfc..8e61b040 100644
--- a/models/allocation.go
+++ b/models/allocation.go
@@ -58,7 +58,7 @@ type Allocation struct {
ExpiresAt *time.Time `json:"expires_at,omitempty"`
UsedQuantity *int64 `json:"used_quantity,omitempty"`
ChargeId *int64 `json:"charge_id,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Allocation.
@@ -66,13 +66,17 @@ type Allocation struct {
func (a Allocation) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "allocation_id", "component_id", "component_handle", "subscription_id", "quantity", "previous_quantity", "memo", "timestamp", "created_at", "proration_upgrade_scheme", "proration_downgrade_scheme", "price_point_id", "price_point_name", "price_point_handle", "interval", "interval_unit", "previous_price_point_id", "accrue_charge", "initiate_dunning", "upgrade_charge", "downgrade_credit", "payment", "expires_at", "used_quantity", "charge_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the Allocation object to a map representation for JSON marshaling.
func (a Allocation) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.AllocationId != nil {
structMap["allocation_id"] = a.AllocationId
}
@@ -183,12 +187,12 @@ func (a *Allocation) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "allocation_id", "component_id", "component_handle", "subscription_id", "quantity", "previous_quantity", "memo", "timestamp", "created_at", "proration_upgrade_scheme", "proration_downgrade_scheme", "price_point_id", "price_point_name", "price_point_handle", "interval", "interval_unit", "previous_price_point_id", "accrue_charge", "initiate_dunning", "upgrade_charge", "downgrade_credit", "payment", "expires_at", "used_quantity", "charge_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "allocation_id", "component_id", "component_handle", "subscription_id", "quantity", "previous_quantity", "memo", "timestamp", "created_at", "proration_upgrade_scheme", "proration_downgrade_scheme", "price_point_id", "price_point_name", "price_point_handle", "interval", "interval_unit", "previous_price_point_id", "accrue_charge", "initiate_dunning", "upgrade_charge", "downgrade_credit", "payment", "expires_at", "used_quantity", "charge_id")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.AllocationId = temp.AllocationId
a.ComponentId = temp.ComponentId
a.ComponentHandle = temp.ComponentHandle
diff --git a/models/allocation_expiration_date.go b/models/allocation_expiration_date.go
index f1f8560e..e31f5cf0 100644
--- a/models/allocation_expiration_date.go
+++ b/models/allocation_expiration_date.go
@@ -13,8 +13,8 @@ import (
// AllocationExpirationDate represents a AllocationExpirationDate struct.
type AllocationExpirationDate struct {
- ExpiresAt *time.Time `json:"expires_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ExpiresAt *time.Time `json:"expires_at,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AllocationExpirationDate.
@@ -22,13 +22,17 @@ type AllocationExpirationDate struct {
func (a AllocationExpirationDate) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "expires_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AllocationExpirationDate object to a map representation for JSON marshaling.
func (a AllocationExpirationDate) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.ExpiresAt != nil {
structMap["expires_at"] = a.ExpiresAt.Format(time.RFC3339)
}
@@ -43,12 +47,12 @@ func (a *AllocationExpirationDate) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "expires_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "expires_at")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
if temp.ExpiresAt != nil {
ExpiresAtVal, err := time.Parse(time.RFC3339, *temp.ExpiresAt)
if err != nil {
diff --git a/models/allocation_preview.go b/models/allocation_preview.go
index f38a499c..894d2457 100644
--- a/models/allocation_preview.go
+++ b/models/allocation_preview.go
@@ -27,7 +27,7 @@ type AllocationPreview struct {
PeriodType *string `json:"period_type,omitempty"`
// An integer representing the amount of the subscription's current balance
ExistingBalanceInCents *int64 `json:"existing_balance_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AllocationPreview.
@@ -35,13 +35,17 @@ type AllocationPreview struct {
func (a AllocationPreview) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "start_date", "end_date", "subtotal_in_cents", "total_tax_in_cents", "total_discount_in_cents", "total_in_cents", "direction", "proration_scheme", "line_items", "accrue_charge", "allocations", "period_type", "existing_balance_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AllocationPreview object to a map representation for JSON marshaling.
func (a AllocationPreview) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.StartDate != nil {
structMap["start_date"] = a.StartDate.Format(time.RFC3339)
}
@@ -92,12 +96,12 @@ func (a *AllocationPreview) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "start_date", "end_date", "subtotal_in_cents", "total_tax_in_cents", "total_discount_in_cents", "total_in_cents", "direction", "proration_scheme", "line_items", "accrue_charge", "allocations", "period_type", "existing_balance_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "start_date", "end_date", "subtotal_in_cents", "total_tax_in_cents", "total_discount_in_cents", "total_in_cents", "direction", "proration_scheme", "line_items", "accrue_charge", "allocations", "period_type", "existing_balance_in_cents")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
if temp.StartDate != nil {
StartDateVal, err := time.Parse(time.RFC3339, *temp.StartDate)
if err != nil {
diff --git a/models/allocation_preview_item.go b/models/allocation_preview_item.go
index 2a1d97ca..2212b3b2 100644
--- a/models/allocation_preview_item.go
+++ b/models/allocation_preview_item.go
@@ -35,7 +35,7 @@ type AllocationPreviewItem struct {
PricePointHandle *string `json:"price_point_handle,omitempty"`
PricePointName *string `json:"price_point_name,omitempty"`
ComponentHandle Optional[string] `json:"component_handle"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AllocationPreviewItem.
@@ -43,13 +43,17 @@ type AllocationPreviewItem struct {
func (a AllocationPreviewItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "component_id", "subscription_id", "quantity", "previous_quantity", "memo", "timestamp", "proration_upgrade_scheme", "proration_downgrade_scheme", "accrue_charge", "upgrade_charge", "downgrade_credit", "price_point_id", "interval", "interval_unit", "previous_price_point_id", "price_point_handle", "price_point_name", "component_handle"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AllocationPreviewItem object to a map representation for JSON marshaling.
func (a AllocationPreviewItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.ComponentId != nil {
structMap["component_id"] = a.ComponentId
}
@@ -139,12 +143,12 @@ func (a *AllocationPreviewItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component_id", "subscription_id", "quantity", "previous_quantity", "memo", "timestamp", "proration_upgrade_scheme", "proration_downgrade_scheme", "accrue_charge", "upgrade_charge", "downgrade_credit", "price_point_id", "interval", "interval_unit", "previous_price_point_id", "price_point_handle", "price_point_name", "component_handle")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component_id", "subscription_id", "quantity", "previous_quantity", "memo", "timestamp", "proration_upgrade_scheme", "proration_downgrade_scheme", "accrue_charge", "upgrade_charge", "downgrade_credit", "price_point_id", "interval", "interval_unit", "previous_price_point_id", "price_point_handle", "price_point_name", "component_handle")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.ComponentId = temp.ComponentId
a.SubscriptionId = temp.SubscriptionId
a.Quantity = temp.Quantity
diff --git a/models/allocation_preview_line_item.go b/models/allocation_preview_line_item.go
index eae07628..75dc2b78 100644
--- a/models/allocation_preview_line_item.go
+++ b/models/allocation_preview_line_item.go
@@ -23,7 +23,7 @@ type AllocationPreviewLineItem struct {
ComponentHandle *string `json:"component_handle,omitempty"`
// Visible when using Fine-grained Component Control
Direction *AllocationPreviewDirection `json:"direction,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AllocationPreviewLineItem.
@@ -31,13 +31,17 @@ type AllocationPreviewLineItem struct {
func (a AllocationPreviewLineItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "transaction_type", "kind", "amount_in_cents", "memo", "discount_amount_in_cents", "taxable_amount_in_cents", "component_id", "component_handle", "direction"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AllocationPreviewLineItem object to a map representation for JSON marshaling.
func (a AllocationPreviewLineItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.TransactionType != nil {
structMap["transaction_type"] = a.TransactionType
}
@@ -76,12 +80,12 @@ func (a *AllocationPreviewLineItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "transaction_type", "kind", "amount_in_cents", "memo", "discount_amount_in_cents", "taxable_amount_in_cents", "component_id", "component_handle", "direction")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "transaction_type", "kind", "amount_in_cents", "memo", "discount_amount_in_cents", "taxable_amount_in_cents", "component_id", "component_handle", "direction")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.TransactionType = temp.TransactionType
a.Kind = temp.Kind
a.AmountInCents = temp.AmountInCents
diff --git a/models/allocation_preview_response.go b/models/allocation_preview_response.go
index 8c28f7c4..5c451866 100644
--- a/models/allocation_preview_response.go
+++ b/models/allocation_preview_response.go
@@ -13,8 +13,8 @@ import (
// AllocationPreviewResponse represents a AllocationPreviewResponse struct.
type AllocationPreviewResponse struct {
- AllocationPreview AllocationPreview `json:"allocation_preview"`
- AdditionalProperties map[string]any `json:"_"`
+ AllocationPreview AllocationPreview `json:"allocation_preview"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AllocationPreviewResponse.
@@ -22,13 +22,17 @@ type AllocationPreviewResponse struct {
func (a AllocationPreviewResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "allocation_preview"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AllocationPreviewResponse object to a map representation for JSON marshaling.
func (a AllocationPreviewResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
structMap["allocation_preview"] = a.AllocationPreview.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (a *AllocationPreviewResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "allocation_preview")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "allocation_preview")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.AllocationPreview = *temp.AllocationPreview
return nil
}
diff --git a/models/allocation_response.go b/models/allocation_response.go
index 0bf3020b..f39ab5a2 100644
--- a/models/allocation_response.go
+++ b/models/allocation_response.go
@@ -11,8 +11,8 @@ import (
// AllocationResponse represents a AllocationResponse struct.
type AllocationResponse struct {
- Allocation *Allocation `json:"allocation,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Allocation *Allocation `json:"allocation,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AllocationResponse.
@@ -20,13 +20,17 @@ type AllocationResponse struct {
func (a AllocationResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "allocation"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AllocationResponse object to a map representation for JSON marshaling.
func (a AllocationResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.Allocation != nil {
structMap["allocation"] = a.Allocation.toMap()
}
@@ -41,12 +45,12 @@ func (a *AllocationResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "allocation")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "allocation")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.Allocation = temp.Allocation
return nil
}
diff --git a/models/allocation_settings.go b/models/allocation_settings.go
index f7b6ee2d..62b6107f 100644
--- a/models/allocation_settings.go
+++ b/models/allocation_settings.go
@@ -13,13 +13,13 @@ import (
type AllocationSettings struct {
// The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
// Available values: `full`, `prorated`, `none`.
- UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
+ UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
// The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
// Available values: `full`, `prorated`, `none`.
- DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
+ DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
// Either "true" or "false".
- AccrueCharge *string `json:"accrue_charge,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AccrueCharge *string `json:"accrue_charge,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AllocationSettings.
@@ -27,13 +27,17 @@ type AllocationSettings struct {
func (a AllocationSettings) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "upgrade_charge", "downgrade_credit", "accrue_charge"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AllocationSettings object to a map representation for JSON marshaling.
func (a AllocationSettings) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.UpgradeCharge.IsValueSet() {
if a.UpgradeCharge.Value() != nil {
structMap["upgrade_charge"] = a.UpgradeCharge.Value()
@@ -62,12 +66,12 @@ func (a *AllocationSettings) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "upgrade_charge", "downgrade_credit", "accrue_charge")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "upgrade_charge", "downgrade_credit", "accrue_charge")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.UpgradeCharge = temp.UpgradeCharge
a.DowngradeCredit = temp.DowngradeCredit
a.AccrueCharge = temp.AccrueCharge
diff --git a/models/apple_pay_payment_profile.go b/models/apple_pay_payment_profile.go
index 6d259920..b074fc34 100644
--- a/models/apple_pay_payment_profile.go
+++ b/models/apple_pay_payment_profile.go
@@ -14,34 +14,34 @@ import (
// ApplePayPaymentProfile represents a ApplePayPaymentProfile struct.
type ApplePayPaymentProfile struct {
// The Chargify-assigned ID of the Apple Pay payment profile.
- Id *int `json:"id,omitempty"`
+ Id *int `json:"id,omitempty"`
// The first name of the Apple Pay account holder
- FirstName *string `json:"first_name,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
// The last name of the Apple Pay account holder
- LastName *string `json:"last_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
// The Chargify-assigned id for the customer record to which the Apple Pay account belongs
- CustomerId *int `json:"customer_id,omitempty"`
+ CustomerId *int `json:"customer_id,omitempty"`
// The vault that stores the payment profile with the provided vault_token.
- CurrentVault *ApplePayVault `json:"current_vault,omitempty"`
+ CurrentVault *ApplePayVault `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"`
// The current billing street address for the Apple Pay account
- BillingAddress Optional[string] `json:"billing_address"`
+ BillingAddress Optional[string] `json:"billing_address"`
// The current billing address city for the Apple Pay account
- BillingCity Optional[string] `json:"billing_city"`
+ BillingCity Optional[string] `json:"billing_city"`
// The current billing address state for the Apple Pay account
- BillingState Optional[string] `json:"billing_state"`
+ BillingState Optional[string] `json:"billing_state"`
// The current billing address zip code for the Apple Pay account
- BillingZip Optional[string] `json:"billing_zip"`
+ BillingZip Optional[string] `json:"billing_zip"`
// The current billing address country for the Apple Pay account
- BillingCountry Optional[string] `json:"billing_country"`
- CustomerVaultToken Optional[string] `json:"customer_vault_token"`
+ BillingCountry Optional[string] `json:"billing_country"`
+ CustomerVaultToken Optional[string] `json:"customer_vault_token"`
// The current billing street address, second line, for the Apple Pay account
- BillingAddress2 Optional[string] `json:"billing_address_2"`
- PaymentType PaymentType `json:"payment_type"`
- SiteGatewaySettingId Optional[int] `json:"site_gateway_setting_id"`
- GatewayHandle Optional[string] `json:"gateway_handle"`
- AdditionalProperties map[string]any `json:"_"`
+ BillingAddress2 Optional[string] `json:"billing_address_2"`
+ PaymentType PaymentType `json:"payment_type"`
+ SiteGatewaySettingId Optional[int] `json:"site_gateway_setting_id"`
+ GatewayHandle Optional[string] `json:"gateway_handle"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ApplePayPaymentProfile.
@@ -49,13 +49,17 @@ type ApplePayPaymentProfile struct {
func (a ApplePayPaymentProfile) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "id", "first_name", "last_name", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "payment_type", "site_gateway_setting_id", "gateway_handle"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the ApplePayPaymentProfile object to a map representation for JSON marshaling.
func (a ApplePayPaymentProfile) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.Id != nil {
structMap["id"] = a.Id
}
@@ -153,12 +157,12 @@ func (a *ApplePayPaymentProfile) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "first_name", "last_name", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "payment_type", "site_gateway_setting_id", "gateway_handle")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "first_name", "last_name", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "payment_type", "site_gateway_setting_id", "gateway_handle")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.Id = temp.Id
a.FirstName = temp.FirstName
a.LastName = temp.LastName
diff --git a/models/applied_credit_note_data.go b/models/applied_credit_note_data.go
index 2fd001c3..b0e454c4 100644
--- a/models/applied_credit_note_data.go
+++ b/models/applied_credit_note_data.go
@@ -12,10 +12,10 @@ import (
// AppliedCreditNoteData represents a AppliedCreditNoteData struct.
type AppliedCreditNoteData struct {
// The UID of the credit note
- Uid *string `json:"uid,omitempty"`
+ Uid *string `json:"uid,omitempty"`
// The number of the credit note
- Number *string `json:"number,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Number *string `json:"number,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AppliedCreditNoteData.
@@ -23,13 +23,17 @@ type AppliedCreditNoteData struct {
func (a AppliedCreditNoteData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "uid", "number"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AppliedCreditNoteData object to a map representation for JSON marshaling.
func (a AppliedCreditNoteData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.Uid != nil {
structMap["uid"] = a.Uid
}
@@ -47,12 +51,12 @@ func (a *AppliedCreditNoteData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "number")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "number")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.Uid = temp.Uid
a.Number = temp.Number
return nil
diff --git a/models/apply_credit_note_event.go b/models/apply_credit_note_event.go
index e7cd35cc..fc150fe3 100644
--- a/models/apply_credit_note_event.go
+++ b/models/apply_credit_note_event.go
@@ -21,7 +21,7 @@ type ApplyCreditNoteEvent struct {
EventType InvoiceEventType `json:"event_type"`
// Example schema for an `apply_credit_note` event
EventData ApplyCreditNoteEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ApplyCreditNoteEvent.
@@ -29,13 +29,17 @@ type ApplyCreditNoteEvent struct {
func (a ApplyCreditNoteEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the ApplyCreditNoteEvent object to a map representation for JSON marshaling.
func (a ApplyCreditNoteEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
structMap["id"] = a.Id
structMap["timestamp"] = a.Timestamp.Format(time.RFC3339)
structMap["invoice"] = a.Invoice.toMap()
@@ -56,12 +60,12 @@ func (a *ApplyCreditNoteEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/apply_credit_note_event_data.go b/models/apply_credit_note_event_data.go
index 1606ba76..b5d4c8b4 100644
--- a/models/apply_credit_note_event_data.go
+++ b/models/apply_credit_note_event_data.go
@@ -36,7 +36,7 @@ type ApplyCreditNoteEventData struct {
ConsolidatedInvoice *bool `json:"consolidated_invoice,omitempty"`
// List of credit notes applied to children invoices (if consolidated invoice)
AppliedCreditNotes []AppliedCreditNoteData `json:"applied_credit_notes,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ApplyCreditNoteEventData.
@@ -44,13 +44,17 @@ type ApplyCreditNoteEventData struct {
func (a ApplyCreditNoteEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "uid", "credit_note_number", "credit_note_uid", "original_amount", "applied_amount", "transaction_time", "memo", "role", "consolidated_invoice", "applied_credit_notes"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the ApplyCreditNoteEventData object to a map representation for JSON marshaling.
func (a ApplyCreditNoteEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
structMap["uid"] = a.Uid
structMap["credit_note_number"] = a.CreditNoteNumber
structMap["credit_note_uid"] = a.CreditNoteUid
@@ -90,12 +94,12 @@ func (a *ApplyCreditNoteEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "credit_note_number", "credit_note_uid", "original_amount", "applied_amount", "transaction_time", "memo", "role", "consolidated_invoice", "applied_credit_notes")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "credit_note_number", "credit_note_uid", "original_amount", "applied_amount", "transaction_time", "memo", "role", "consolidated_invoice", "applied_credit_notes")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.Uid = *temp.Uid
a.CreditNoteNumber = *temp.CreditNoteNumber
a.CreditNoteUid = *temp.CreditNoteUid
diff --git a/models/apply_debit_note_event.go b/models/apply_debit_note_event.go
index 80dd5d26..4d4731eb 100644
--- a/models/apply_debit_note_event.go
+++ b/models/apply_debit_note_event.go
@@ -21,7 +21,7 @@ type ApplyDebitNoteEvent struct {
EventType InvoiceEventType `json:"event_type"`
// Example schema for an `apply_debit_note` event
EventData ApplyDebitNoteEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ApplyDebitNoteEvent.
@@ -29,13 +29,17 @@ type ApplyDebitNoteEvent struct {
func (a ApplyDebitNoteEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the ApplyDebitNoteEvent object to a map representation for JSON marshaling.
func (a ApplyDebitNoteEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
structMap["id"] = a.Id
structMap["timestamp"] = a.Timestamp.Format(time.RFC3339)
structMap["invoice"] = a.Invoice.toMap()
@@ -56,12 +60,12 @@ func (a *ApplyDebitNoteEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/apply_debit_note_event_data.go b/models/apply_debit_note_event_data.go
index b4499529..744f4a3e 100644
--- a/models/apply_debit_note_event_data.go
+++ b/models/apply_debit_note_event_data.go
@@ -17,18 +17,18 @@ import (
// Example schema for an `apply_debit_note` event
type ApplyDebitNoteEventData struct {
// A unique, identifying string that appears on the debit note and in places it is referenced.
- DebitNoteNumber string `json:"debit_note_number"`
+ DebitNoteNumber string `json:"debit_note_number"`
// Unique identifier for the debit note. It is generated automatically by Chargify and has the prefix "db_" followed by alphanumeric characters.
- DebitNoteUid string `json:"debit_note_uid"`
+ DebitNoteUid string `json:"debit_note_uid"`
// The full, original amount of the debit note.
- OriginalAmount string `json:"original_amount"`
+ OriginalAmount string `json:"original_amount"`
// The amount of the debit note applied to invoice.
- AppliedAmount string `json:"applied_amount"`
+ AppliedAmount string `json:"applied_amount"`
// The debit note memo.
- Memo Optional[string] `json:"memo"`
+ Memo Optional[string] `json:"memo"`
// The time the debit note was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z"
- TransactionTime Optional[time.Time] `json:"transaction_time"`
- AdditionalProperties map[string]any `json:"_"`
+ TransactionTime Optional[time.Time] `json:"transaction_time"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ApplyDebitNoteEventData.
@@ -36,13 +36,17 @@ type ApplyDebitNoteEventData struct {
func (a ApplyDebitNoteEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "debit_note_number", "debit_note_uid", "original_amount", "applied_amount", "memo", "transaction_time"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the ApplyDebitNoteEventData object to a map representation for JSON marshaling.
func (a ApplyDebitNoteEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
structMap["debit_note_number"] = a.DebitNoteNumber
structMap["debit_note_uid"] = a.DebitNoteUid
structMap["original_amount"] = a.OriginalAmount
@@ -81,12 +85,12 @@ func (a *ApplyDebitNoteEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "debit_note_number", "debit_note_uid", "original_amount", "applied_amount", "memo", "transaction_time")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "debit_note_number", "debit_note_uid", "original_amount", "applied_amount", "memo", "transaction_time")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.DebitNoteNumber = *temp.DebitNoteNumber
a.DebitNoteUid = *temp.DebitNoteUid
a.OriginalAmount = *temp.OriginalAmount
diff --git a/models/apply_payment_event.go b/models/apply_payment_event.go
index 2a8d24e6..536593ab 100644
--- a/models/apply_payment_event.go
+++ b/models/apply_payment_event.go
@@ -15,13 +15,13 @@ import (
// ApplyPaymentEvent represents a ApplyPaymentEvent struct.
type ApplyPaymentEvent struct {
- Id int64 `json:"id"`
- Timestamp time.Time `json:"timestamp"`
- Invoice Invoice `json:"invoice"`
- EventType InvoiceEventType `json:"event_type"`
+ Id int64 `json:"id"`
+ Timestamp time.Time `json:"timestamp"`
+ Invoice Invoice `json:"invoice"`
+ EventType InvoiceEventType `json:"event_type"`
// Example schema for an `apply_payment` event
- EventData ApplyPaymentEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ EventData ApplyPaymentEventData `json:"event_data"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ApplyPaymentEvent.
@@ -29,13 +29,17 @@ type ApplyPaymentEvent struct {
func (a ApplyPaymentEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the ApplyPaymentEvent object to a map representation for JSON marshaling.
func (a ApplyPaymentEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
structMap["id"] = a.Id
structMap["timestamp"] = a.Timestamp.Format(time.RFC3339)
structMap["invoice"] = a.Invoice.toMap()
@@ -56,12 +60,12 @@ func (a *ApplyPaymentEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/apply_payment_event_data.go b/models/apply_payment_event_data.go
index 261c6eb4..ce0b7244 100644
--- a/models/apply_payment_event_data.go
+++ b/models/apply_payment_event_data.go
@@ -33,7 +33,7 @@ type ApplyPaymentEventData struct {
RemainingPrepaymentAmount Optional[string] `json:"remaining_prepayment_amount"`
Prepayment *bool `json:"prepayment,omitempty"`
External *bool `json:"external,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ApplyPaymentEventData.
@@ -41,13 +41,17 @@ type ApplyPaymentEventData struct {
func (a ApplyPaymentEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "consolidation_level", "memo", "original_amount", "applied_amount", "transaction_time", "payment_method", "transaction_id", "parent_invoice_number", "remaining_prepayment_amount", "prepayment", "external"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the ApplyPaymentEventData object to a map representation for JSON marshaling.
func (a ApplyPaymentEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
structMap["consolidation_level"] = a.ConsolidationLevel
structMap["memo"] = a.Memo
structMap["original_amount"] = a.OriginalAmount
@@ -92,12 +96,12 @@ func (a *ApplyPaymentEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "consolidation_level", "memo", "original_amount", "applied_amount", "transaction_time", "payment_method", "transaction_id", "parent_invoice_number", "remaining_prepayment_amount", "prepayment", "external")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "consolidation_level", "memo", "original_amount", "applied_amount", "transaction_time", "payment_method", "transaction_id", "parent_invoice_number", "remaining_prepayment_amount", "prepayment", "external")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.ConsolidationLevel = *temp.ConsolidationLevel
a.Memo = *temp.Memo
a.OriginalAmount = *temp.OriginalAmount
diff --git a/models/attribute_error.go b/models/attribute_error.go
index b9aae045..0dc88331 100644
--- a/models/attribute_error.go
+++ b/models/attribute_error.go
@@ -13,8 +13,8 @@ import (
// AttributeError represents a AttributeError struct.
type AttributeError struct {
- Attribute []string `json:"attribute"`
- AdditionalProperties map[string]any `json:"_"`
+ Attribute []string `json:"attribute"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AttributeError.
@@ -22,13 +22,17 @@ type AttributeError struct {
func (a AttributeError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "attribute"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AttributeError object to a map representation for JSON marshaling.
func (a AttributeError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
structMap["attribute"] = a.Attribute
return structMap
}
@@ -45,12 +49,12 @@ func (a *AttributeError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "attribute")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "attribute")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.Attribute = *temp.Attribute
return nil
}
diff --git a/models/auto_resume.go b/models/auto_resume.go
index e6569327..dd35a147 100644
--- a/models/auto_resume.go
+++ b/models/auto_resume.go
@@ -13,8 +13,8 @@ import (
// AutoResume represents a AutoResume struct.
type AutoResume struct {
- AutomaticallyResumeAt Optional[time.Time] `json:"automatically_resume_at"`
- AdditionalProperties map[string]any `json:"_"`
+ AutomaticallyResumeAt Optional[time.Time] `json:"automatically_resume_at"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for AutoResume.
@@ -22,13 +22,17 @@ type AutoResume struct {
func (a AutoResume) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(a.AdditionalProperties,
+ "automatically_resume_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(a.toMap())
}
// toMap converts the AutoResume object to a map representation for JSON marshaling.
func (a AutoResume) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, a.AdditionalProperties)
+ MergeAdditionalProperties(structMap, a.AdditionalProperties)
if a.AutomaticallyResumeAt.IsValueSet() {
var AutomaticallyResumeAtVal *string = nil
if a.AutomaticallyResumeAt.Value() != nil {
@@ -52,12 +56,12 @@ func (a *AutoResume) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "automatically_resume_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "automatically_resume_at")
if err != nil {
return err
}
-
a.AdditionalProperties = additionalProperties
+
a.AutomaticallyResumeAt.ShouldSetValue(temp.AutomaticallyResumeAt.IsValueSet())
if temp.AutomaticallyResumeAt.Value() != nil {
AutomaticallyResumeAtVal, err := time.Parse(time.RFC3339, (*temp.AutomaticallyResumeAt.Value()))
diff --git a/models/backport_invoice_event.go b/models/backport_invoice_event.go
index 4e89c4e3..08a03519 100644
--- a/models/backport_invoice_event.go
+++ b/models/backport_invoice_event.go
@@ -15,13 +15,13 @@ import (
// BackportInvoiceEvent represents a BackportInvoiceEvent struct.
type BackportInvoiceEvent struct {
- Id int64 `json:"id"`
- Timestamp time.Time `json:"timestamp"`
- Invoice Invoice `json:"invoice"`
- EventType InvoiceEventType `json:"event_type"`
+ Id int64 `json:"id"`
+ Timestamp time.Time `json:"timestamp"`
+ Invoice Invoice `json:"invoice"`
+ EventType InvoiceEventType `json:"event_type"`
// Example schema for an `backport_invoice` event
- EventData Invoice `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ EventData Invoice `json:"event_data"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BackportInvoiceEvent.
@@ -29,13 +29,17 @@ type BackportInvoiceEvent struct {
func (b BackportInvoiceEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BackportInvoiceEvent object to a map representation for JSON marshaling.
func (b BackportInvoiceEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
structMap["id"] = b.Id
structMap["timestamp"] = b.Timestamp.Format(time.RFC3339)
structMap["invoice"] = b.Invoice.toMap()
@@ -56,12 +60,12 @@ func (b *BackportInvoiceEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/bank_account_attributes.go b/models/bank_account_attributes.go
index dc6b853d..5fbb2ca8 100644
--- a/models/bank_account_attributes.go
+++ b/models/bank_account_attributes.go
@@ -32,7 +32,7 @@ type BankAccountAttributes struct {
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"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BankAccountAttributes.
@@ -40,13 +40,17 @@ type BankAccountAttributes struct {
func (b BankAccountAttributes) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "chargify_token", "bank_name", "bank_routing_number", "bank_account_number", "bank_account_type", "bank_branch_code", "bank_iban", "bank_account_holder_type", "payment_type", "current_vault", "vault_token", "customer_vault_token"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BankAccountAttributes object to a map representation for JSON marshaling.
func (b BankAccountAttributes) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.ChargifyToken != nil {
structMap["chargify_token"] = b.ChargifyToken
}
@@ -94,12 +98,12 @@ func (b *BankAccountAttributes) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "chargify_token", "bank_name", "bank_routing_number", "bank_account_number", "bank_account_type", "bank_branch_code", "bank_iban", "bank_account_holder_type", "payment_type", "current_vault", "vault_token", "customer_vault_token")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "chargify_token", "bank_name", "bank_routing_number", "bank_account_number", "bank_account_type", "bank_branch_code", "bank_iban", "bank_account_holder_type", "payment_type", "current_vault", "vault_token", "customer_vault_token")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.ChargifyToken = temp.ChargifyToken
b.BankName = temp.BankName
b.BankRoutingNumber = temp.BankRoutingNumber
diff --git a/models/bank_account_payment_profile.go b/models/bank_account_payment_profile.go
index 2d5003b3..53e425a2 100644
--- a/models/bank_account_payment_profile.go
+++ b/models/bank_account_payment_profile.go
@@ -54,7 +54,7 @@ type BankAccountPaymentProfile struct {
Verified *bool `json:"verified,omitempty"`
SiteGatewaySettingId Optional[int] `json:"site_gateway_setting_id"`
GatewayHandle Optional[string] `json:"gateway_handle"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BankAccountPaymentProfile.
@@ -62,13 +62,17 @@ type BankAccountPaymentProfile struct {
func (b BankAccountPaymentProfile) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "id", "first_name", "last_name", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "bank_name", "masked_bank_routing_number", "masked_bank_account_number", "bank_account_type", "bank_account_holder_type", "payment_type", "verified", "site_gateway_setting_id", "gateway_handle"); err != nil {
+ return []byte{}, err
+ }
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)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.Id != nil {
structMap["id"] = b.Id
}
@@ -182,12 +186,12 @@ func (b *BankAccountPaymentProfile) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "first_name", "last_name", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "bank_name", "masked_bank_routing_number", "masked_bank_account_number", "bank_account_type", "bank_account_holder_type", "payment_type", "verified", "site_gateway_setting_id", "gateway_handle")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "first_name", "last_name", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "bank_name", "masked_bank_routing_number", "masked_bank_account_number", "bank_account_type", "bank_account_holder_type", "payment_type", "verified", "site_gateway_setting_id", "gateway_handle")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.Id = temp.Id
b.FirstName = temp.FirstName
b.LastName = temp.LastName
diff --git a/models/bank_account_response.go b/models/bank_account_response.go
index e4ac83f8..f5358d9d 100644
--- a/models/bank_account_response.go
+++ b/models/bank_account_response.go
@@ -14,7 +14,7 @@ import (
// BankAccountResponse represents a BankAccountResponse struct.
type BankAccountResponse struct {
PaymentProfile BankAccountPaymentProfile `json:"payment_profile"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BankAccountResponse.
@@ -22,13 +22,17 @@ type BankAccountResponse struct {
func (b BankAccountResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "payment_profile"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BankAccountResponse object to a map representation for JSON marshaling.
func (b BankAccountResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
structMap["payment_profile"] = b.PaymentProfile.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (b *BankAccountResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payment_profile")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payment_profile")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.PaymentProfile = *temp.PaymentProfile
return nil
}
diff --git a/models/bank_account_verification.go b/models/bank_account_verification.go
index 0ce418e9..0f5c8270 100644
--- a/models/bank_account_verification.go
+++ b/models/bank_account_verification.go
@@ -11,9 +11,9 @@ import (
// BankAccountVerification represents a BankAccountVerification struct.
type BankAccountVerification struct {
- Deposit1InCents *int64 `json:"deposit_1_in_cents,omitempty"`
- Deposit2InCents *int64 `json:"deposit_2_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Deposit1InCents *int64 `json:"deposit_1_in_cents,omitempty"`
+ Deposit2InCents *int64 `json:"deposit_2_in_cents,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BankAccountVerification.
@@ -21,13 +21,17 @@ type BankAccountVerification struct {
func (b BankAccountVerification) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "deposit_1_in_cents", "deposit_2_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BankAccountVerification object to a map representation for JSON marshaling.
func (b BankAccountVerification) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.Deposit1InCents != nil {
structMap["deposit_1_in_cents"] = b.Deposit1InCents
}
@@ -45,12 +49,12 @@ func (b *BankAccountVerification) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "deposit_1_in_cents", "deposit_2_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "deposit_1_in_cents", "deposit_2_in_cents")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.Deposit1InCents = temp.Deposit1InCents
b.Deposit2InCents = temp.Deposit2InCents
return nil
diff --git a/models/bank_account_verification_request.go b/models/bank_account_verification_request.go
index e7217fc0..b3664767 100644
--- a/models/bank_account_verification_request.go
+++ b/models/bank_account_verification_request.go
@@ -14,7 +14,7 @@ import (
// BankAccountVerificationRequest represents a BankAccountVerificationRequest struct.
type BankAccountVerificationRequest struct {
BankAccountVerification BankAccountVerification `json:"bank_account_verification"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BankAccountVerificationRequest.
@@ -22,13 +22,17 @@ type BankAccountVerificationRequest struct {
func (b BankAccountVerificationRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "bank_account_verification"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BankAccountVerificationRequest object to a map representation for JSON marshaling.
func (b BankAccountVerificationRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
structMap["bank_account_verification"] = b.BankAccountVerification.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (b *BankAccountVerificationRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "bank_account_verification")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "bank_account_verification")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.BankAccountVerification = *temp.BankAccountVerification
return nil
}
diff --git a/models/base_refund_error.go b/models/base_refund_error.go
index 9c557781..b8acf8e3 100644
--- a/models/base_refund_error.go
+++ b/models/base_refund_error.go
@@ -11,8 +11,8 @@ import (
// BaseRefundError represents a BaseRefundError struct.
type BaseRefundError struct {
- Base []interface{} `json:"base,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Base []interface{} `json:"base,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BaseRefundError.
@@ -20,13 +20,17 @@ type BaseRefundError struct {
func (b BaseRefundError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "base"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BaseRefundError object to a map representation for JSON marshaling.
func (b BaseRefundError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.Base != nil {
structMap["base"] = b.Base
}
@@ -41,12 +45,12 @@ func (b *BaseRefundError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "base")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "base")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.Base = temp.Base
return nil
}
diff --git a/models/base_string_error.go b/models/base_string_error.go
index 61b8469f..14c540ec 100644
--- a/models/base_string_error.go
+++ b/models/base_string_error.go
@@ -12,8 +12,8 @@ import (
// BaseStringError represents a BaseStringError struct.
// The error is base if it is not directly associated with a single attribute.
type BaseStringError struct {
- Base []string `json:"base,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Base []string `json:"base,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BaseStringError.
@@ -21,13 +21,17 @@ type BaseStringError struct {
func (b BaseStringError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "base"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BaseStringError object to a map representation for JSON marshaling.
func (b BaseStringError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.Base != nil {
structMap["base"] = b.Base
}
@@ -42,12 +46,12 @@ func (b *BaseStringError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "base")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "base")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.Base = temp.Base
return nil
}
diff --git a/models/batch_job.go b/models/batch_job.go
index b1bc8aaf..2dad9ef8 100644
--- a/models/batch_job.go
+++ b/models/batch_job.go
@@ -13,12 +13,12 @@ import (
// BatchJob represents a BatchJob struct.
type BatchJob struct {
- Id *int `json:"id,omitempty"`
- FinishedAt Optional[time.Time] `json:"finished_at"`
- RowCount Optional[int] `json:"row_count"`
- CreatedAt Optional[time.Time] `json:"created_at"`
- Completed *string `json:"completed,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ FinishedAt Optional[time.Time] `json:"finished_at"`
+ RowCount Optional[int] `json:"row_count"`
+ CreatedAt Optional[time.Time] `json:"created_at"`
+ Completed *string `json:"completed,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BatchJob.
@@ -26,13 +26,17 @@ type BatchJob struct {
func (b BatchJob) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "id", "finished_at", "row_count", "created_at", "completed"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BatchJob object to a map representation for JSON marshaling.
func (b BatchJob) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.Id != nil {
structMap["id"] = b.Id
}
@@ -81,12 +85,12 @@ func (b *BatchJob) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "finished_at", "row_count", "created_at", "completed")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "finished_at", "row_count", "created_at", "completed")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.Id = temp.Id
b.FinishedAt.ShouldSetValue(temp.FinishedAt.IsValueSet())
if temp.FinishedAt.Value() != nil {
diff --git a/models/batch_job_response.go b/models/batch_job_response.go
index 14d87b52..3366e049 100644
--- a/models/batch_job_response.go
+++ b/models/batch_job_response.go
@@ -13,8 +13,8 @@ import (
// BatchJobResponse represents a BatchJobResponse struct.
type BatchJobResponse struct {
- Batchjob BatchJob `json:"batchjob"`
- AdditionalProperties map[string]any `json:"_"`
+ Batchjob BatchJob `json:"batchjob"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BatchJobResponse.
@@ -22,13 +22,17 @@ type BatchJobResponse struct {
func (b BatchJobResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "batchjob"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BatchJobResponse object to a map representation for JSON marshaling.
func (b BatchJobResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
structMap["batchjob"] = b.Batchjob.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (b *BatchJobResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "batchjob")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "batchjob")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.Batchjob = *temp.Batchjob
return nil
}
diff --git a/models/billing_manifest.go b/models/billing_manifest.go
index 7c785a70..2e251347 100644
--- a/models/billing_manifest.go
+++ b/models/billing_manifest.go
@@ -13,16 +13,16 @@ import (
// BillingManifest represents a BillingManifest struct.
type BillingManifest struct {
- LineItems []BillingManifestItem `json:"line_items,omitempty"`
- TotalInCents *int64 `json:"total_in_cents,omitempty"`
- TotalDiscountInCents *int64 `json:"total_discount_in_cents,omitempty"`
- TotalTaxInCents *int64 `json:"total_tax_in_cents,omitempty"`
- SubtotalInCents *int64 `json:"subtotal_in_cents,omitempty"`
- StartDate Optional[time.Time] `json:"start_date"`
- EndDate Optional[time.Time] `json:"end_date"`
- PeriodType Optional[string] `json:"period_type"`
- ExistingBalanceInCents *int64 `json:"existing_balance_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ LineItems []BillingManifestItem `json:"line_items,omitempty"`
+ TotalInCents *int64 `json:"total_in_cents,omitempty"`
+ TotalDiscountInCents *int64 `json:"total_discount_in_cents,omitempty"`
+ TotalTaxInCents *int64 `json:"total_tax_in_cents,omitempty"`
+ SubtotalInCents *int64 `json:"subtotal_in_cents,omitempty"`
+ StartDate Optional[time.Time] `json:"start_date"`
+ EndDate Optional[time.Time] `json:"end_date"`
+ PeriodType Optional[string] `json:"period_type"`
+ ExistingBalanceInCents *int64 `json:"existing_balance_in_cents,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BillingManifest.
@@ -30,13 +30,17 @@ type BillingManifest struct {
func (b BillingManifest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "line_items", "total_in_cents", "total_discount_in_cents", "total_tax_in_cents", "subtotal_in_cents", "start_date", "end_date", "period_type", "existing_balance_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BillingManifest object to a map representation for JSON marshaling.
func (b BillingManifest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.LineItems != nil {
structMap["line_items"] = b.LineItems
}
@@ -97,12 +101,12 @@ func (b *BillingManifest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "line_items", "total_in_cents", "total_discount_in_cents", "total_tax_in_cents", "subtotal_in_cents", "start_date", "end_date", "period_type", "existing_balance_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "line_items", "total_in_cents", "total_discount_in_cents", "total_tax_in_cents", "subtotal_in_cents", "start_date", "end_date", "period_type", "existing_balance_in_cents")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.LineItems = temp.LineItems
b.TotalInCents = temp.TotalInCents
b.TotalDiscountInCents = temp.TotalDiscountInCents
diff --git a/models/billing_manifest_item.go b/models/billing_manifest_item.go
index 57fa745d..ce63dbbd 100644
--- a/models/billing_manifest_item.go
+++ b/models/billing_manifest_item.go
@@ -27,7 +27,7 @@ type BillingManifestItem struct {
ProductName *string `json:"product_name,omitempty"`
PeriodRangeStart *string `json:"period_range_start,omitempty"`
PeriodRangeEnd *string `json:"period_range_end,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BillingManifestItem.
@@ -35,13 +35,17 @@ type BillingManifestItem struct {
func (b BillingManifestItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "transaction_type", "kind", "amount_in_cents", "memo", "discount_amount_in_cents", "taxable_amount_in_cents", "component_id", "component_handle", "component_name", "product_id", "product_handle", "product_name", "period_range_start", "period_range_end"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BillingManifestItem object to a map representation for JSON marshaling.
func (b BillingManifestItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.TransactionType != nil {
structMap["transaction_type"] = b.TransactionType
}
@@ -95,12 +99,12 @@ func (b *BillingManifestItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "transaction_type", "kind", "amount_in_cents", "memo", "discount_amount_in_cents", "taxable_amount_in_cents", "component_id", "component_handle", "component_name", "product_id", "product_handle", "product_name", "period_range_start", "period_range_end")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "transaction_type", "kind", "amount_in_cents", "memo", "discount_amount_in_cents", "taxable_amount_in_cents", "component_id", "component_handle", "component_name", "product_id", "product_handle", "product_name", "period_range_start", "period_range_end")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.TransactionType = temp.TransactionType
b.Kind = temp.Kind
b.AmountInCents = temp.AmountInCents
diff --git a/models/billing_schedule.go b/models/billing_schedule.go
index 7465889a..711f9f29 100644
--- a/models/billing_schedule.go
+++ b/models/billing_schedule.go
@@ -15,8 +15,8 @@ import (
// This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled
type BillingSchedule struct {
// The initial_billing_at attribute in Maxio allows you to specify a custom starting date for billing cycles associated with components that have their own billing frequency set. Only ISO8601 format is supported.
- InitialBillingAt *time.Time `json:"initial_billing_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ InitialBillingAt *time.Time `json:"initial_billing_at,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BillingSchedule.
@@ -24,13 +24,17 @@ type BillingSchedule struct {
func (b BillingSchedule) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "initial_billing_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BillingSchedule object to a map representation for JSON marshaling.
func (b BillingSchedule) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.InitialBillingAt != nil {
structMap["initial_billing_at"] = b.InitialBillingAt.Format(DEFAULT_DATE)
}
@@ -45,12 +49,12 @@ func (b *BillingSchedule) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "initial_billing_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "initial_billing_at")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
if temp.InitialBillingAt != nil {
InitialBillingAtVal, err := time.Parse(DEFAULT_DATE, *temp.InitialBillingAt)
if err != nil {
diff --git a/models/breakouts.go b/models/breakouts.go
index 573fcf6e..1df534f6 100644
--- a/models/breakouts.go
+++ b/models/breakouts.go
@@ -11,11 +11,11 @@ import (
// Breakouts represents a Breakouts struct.
type Breakouts struct {
- PlanAmountInCents *int64 `json:"plan_amount_in_cents,omitempty"`
- PlanAmountFormatted *string `json:"plan_amount_formatted,omitempty"`
- UsageAmountInCents *int64 `json:"usage_amount_in_cents,omitempty"`
- UsageAmountFormatted *string `json:"usage_amount_formatted,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PlanAmountInCents *int64 `json:"plan_amount_in_cents,omitempty"`
+ PlanAmountFormatted *string `json:"plan_amount_formatted,omitempty"`
+ UsageAmountInCents *int64 `json:"usage_amount_in_cents,omitempty"`
+ UsageAmountFormatted *string `json:"usage_amount_formatted,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Breakouts.
@@ -23,13 +23,17 @@ type Breakouts struct {
func (b Breakouts) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "plan_amount_in_cents", "plan_amount_formatted", "usage_amount_in_cents", "usage_amount_formatted"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the Breakouts object to a map representation for JSON marshaling.
func (b Breakouts) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.PlanAmountInCents != nil {
structMap["plan_amount_in_cents"] = b.PlanAmountInCents
}
@@ -53,12 +57,12 @@ func (b *Breakouts) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "plan_amount_in_cents", "plan_amount_formatted", "usage_amount_in_cents", "usage_amount_formatted")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "plan_amount_in_cents", "plan_amount_formatted", "usage_amount_in_cents", "usage_amount_formatted")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.PlanAmountInCents = temp.PlanAmountInCents
b.PlanAmountFormatted = temp.PlanAmountFormatted
b.UsageAmountInCents = temp.UsageAmountInCents
diff --git a/models/bulk_components_price_point_assignment.go b/models/bulk_components_price_point_assignment.go
index ff8deacf..5a9242f2 100644
--- a/models/bulk_components_price_point_assignment.go
+++ b/models/bulk_components_price_point_assignment.go
@@ -12,7 +12,7 @@ import (
// BulkComponentsPricePointAssignment represents a BulkComponentsPricePointAssignment struct.
type BulkComponentsPricePointAssignment struct {
Components []ComponentPricePointAssignment `json:"components,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BulkComponentsPricePointAssignment.
@@ -20,13 +20,17 @@ type BulkComponentsPricePointAssignment struct {
func (b BulkComponentsPricePointAssignment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "components"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BulkComponentsPricePointAssignment object to a map representation for JSON marshaling.
func (b BulkComponentsPricePointAssignment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.Components != nil {
structMap["components"] = b.Components
}
@@ -41,12 +45,12 @@ func (b *BulkComponentsPricePointAssignment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "components")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "components")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.Components = temp.Components
return nil
}
diff --git a/models/bulk_create_product_price_points_request.go b/models/bulk_create_product_price_points_request.go
index 2ea6ad90..a4cc574a 100644
--- a/models/bulk_create_product_price_points_request.go
+++ b/models/bulk_create_product_price_points_request.go
@@ -14,7 +14,7 @@ import (
// BulkCreateProductPricePointsRequest represents a BulkCreateProductPricePointsRequest struct.
type BulkCreateProductPricePointsRequest struct {
PricePoints []CreateProductPricePoint `json:"price_points"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BulkCreateProductPricePointsRequest.
@@ -22,13 +22,17 @@ type BulkCreateProductPricePointsRequest struct {
func (b BulkCreateProductPricePointsRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "price_points"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BulkCreateProductPricePointsRequest object to a map representation for JSON marshaling.
func (b BulkCreateProductPricePointsRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
structMap["price_points"] = b.PricePoints
return structMap
}
@@ -45,12 +49,12 @@ func (b *BulkCreateProductPricePointsRequest) UnmarshalJSON(input []byte) error
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_points")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_points")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.PricePoints = *temp.PricePoints
return nil
}
diff --git a/models/bulk_create_product_price_points_response.go b/models/bulk_create_product_price_points_response.go
index b1ad2591..3684a223 100644
--- a/models/bulk_create_product_price_points_response.go
+++ b/models/bulk_create_product_price_points_response.go
@@ -11,8 +11,8 @@ import (
// BulkCreateProductPricePointsResponse represents a BulkCreateProductPricePointsResponse struct.
type BulkCreateProductPricePointsResponse struct {
- PricePoints []ProductPricePoint `json:"price_points,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PricePoints []ProductPricePoint `json:"price_points,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BulkCreateProductPricePointsResponse.
@@ -20,13 +20,17 @@ type BulkCreateProductPricePointsResponse struct {
func (b BulkCreateProductPricePointsResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "price_points"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BulkCreateProductPricePointsResponse object to a map representation for JSON marshaling.
func (b BulkCreateProductPricePointsResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.PricePoints != nil {
structMap["price_points"] = b.PricePoints
}
@@ -41,12 +45,12 @@ func (b *BulkCreateProductPricePointsResponse) UnmarshalJSON(input []byte) error
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_points")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_points")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.PricePoints = temp.PricePoints
return nil
}
diff --git a/models/bulk_create_segments.go b/models/bulk_create_segments.go
index ff3272b1..52e0b4fc 100644
--- a/models/bulk_create_segments.go
+++ b/models/bulk_create_segments.go
@@ -11,8 +11,8 @@ import (
// BulkCreateSegments represents a BulkCreateSegments struct.
type BulkCreateSegments struct {
- Segments []CreateSegment `json:"segments,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Segments []CreateSegment `json:"segments,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BulkCreateSegments.
@@ -20,13 +20,17 @@ type BulkCreateSegments struct {
func (b BulkCreateSegments) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "segments"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BulkCreateSegments object to a map representation for JSON marshaling.
func (b BulkCreateSegments) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.Segments != nil {
structMap["segments"] = b.Segments
}
@@ -41,12 +45,12 @@ func (b *BulkCreateSegments) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "segments")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "segments")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.Segments = temp.Segments
return nil
}
diff --git a/models/bulk_update_segments.go b/models/bulk_update_segments.go
index 4b4e313d..8459d708 100644
--- a/models/bulk_update_segments.go
+++ b/models/bulk_update_segments.go
@@ -12,7 +12,7 @@ import (
// BulkUpdateSegments represents a BulkUpdateSegments struct.
type BulkUpdateSegments struct {
Segments []BulkUpdateSegmentsItem `json:"segments,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BulkUpdateSegments.
@@ -20,13 +20,17 @@ type BulkUpdateSegments struct {
func (b BulkUpdateSegments) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "segments"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BulkUpdateSegments object to a map representation for JSON marshaling.
func (b BulkUpdateSegments) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
if b.Segments != nil {
structMap["segments"] = b.Segments
}
@@ -41,12 +45,12 @@ func (b *BulkUpdateSegments) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "segments")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "segments")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.Segments = temp.Segments
return nil
}
diff --git a/models/bulk_update_segments_item.go b/models/bulk_update_segments_item.go
index 182624e4..90b07b34 100644
--- a/models/bulk_update_segments_item.go
+++ b/models/bulk_update_segments_item.go
@@ -18,7 +18,7 @@ type BulkUpdateSegmentsItem struct {
// 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"`
Prices []CreateOrUpdateSegmentPrice `json:"prices"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for BulkUpdateSegmentsItem.
@@ -26,13 +26,17 @@ type BulkUpdateSegmentsItem struct {
func (b BulkUpdateSegmentsItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(b.AdditionalProperties,
+ "id", "pricing_scheme", "prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(b.toMap())
}
// toMap converts the BulkUpdateSegmentsItem object to a map representation for JSON marshaling.
func (b BulkUpdateSegmentsItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, b.AdditionalProperties)
+ MergeAdditionalProperties(structMap, b.AdditionalProperties)
structMap["id"] = b.Id
structMap["pricing_scheme"] = b.PricingScheme
structMap["prices"] = b.Prices
@@ -51,12 +55,12 @@ func (b *BulkUpdateSegmentsItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "pricing_scheme", "prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "pricing_scheme", "prices")
if err != nil {
return err
}
-
b.AdditionalProperties = additionalProperties
+
b.Id = *temp.Id
b.PricingScheme = *temp.PricingScheme
b.Prices = *temp.Prices
diff --git a/models/calendar_billing.go b/models/calendar_billing.go
index 20f1d711..9d774a91 100644
--- a/models/calendar_billing.go
+++ b/models/calendar_billing.go
@@ -15,7 +15,7 @@ type CalendarBilling struct {
// A day of month that subscription will be processed on. Can be 1 up to 28 or 'end'.
SnapDay *CalendarBillingSnapDay `json:"snap_day,omitempty"`
CalendarBillingFirstCharge *FirstChargeType `json:"calendar_billing_first_charge,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CalendarBilling.
@@ -23,13 +23,17 @@ type CalendarBilling struct {
func (c CalendarBilling) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "snap_day", "calendar_billing_first_charge"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CalendarBilling object to a map representation for JSON marshaling.
func (c CalendarBilling) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.SnapDay != nil {
structMap["snap_day"] = c.SnapDay.toMap()
}
@@ -47,12 +51,12 @@ func (c *CalendarBilling) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "snap_day", "calendar_billing_first_charge")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "snap_day", "calendar_billing_first_charge")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.SnapDay = temp.SnapDay
c.CalendarBillingFirstCharge = temp.CalendarBillingFirstCharge
return nil
diff --git a/models/cancel_grouped_subscriptions_request.go b/models/cancel_grouped_subscriptions_request.go
index c112bd58..9cb21155 100644
--- a/models/cancel_grouped_subscriptions_request.go
+++ b/models/cancel_grouped_subscriptions_request.go
@@ -11,8 +11,8 @@ import (
// CancelGroupedSubscriptionsRequest represents a CancelGroupedSubscriptionsRequest struct.
type CancelGroupedSubscriptionsRequest struct {
- ChargeUnbilledUsage *bool `json:"charge_unbilled_usage,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ChargeUnbilledUsage *bool `json:"charge_unbilled_usage,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CancelGroupedSubscriptionsRequest.
@@ -20,13 +20,17 @@ type CancelGroupedSubscriptionsRequest struct {
func (c CancelGroupedSubscriptionsRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "charge_unbilled_usage"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CancelGroupedSubscriptionsRequest object to a map representation for JSON marshaling.
func (c CancelGroupedSubscriptionsRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.ChargeUnbilledUsage != nil {
structMap["charge_unbilled_usage"] = c.ChargeUnbilledUsage
}
@@ -41,12 +45,12 @@ func (c *CancelGroupedSubscriptionsRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "charge_unbilled_usage")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "charge_unbilled_usage")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ChargeUnbilledUsage = temp.ChargeUnbilledUsage
return nil
}
diff --git a/models/cancellation_options.go b/models/cancellation_options.go
index d3285f0a..5e345f51 100644
--- a/models/cancellation_options.go
+++ b/models/cancellation_options.go
@@ -12,10 +12,10 @@ import (
// CancellationOptions represents a CancellationOptions struct.
type CancellationOptions struct {
// For your internal use. An indication as to why the subscription is being canceled.
- CancellationMessage *string `json:"cancellation_message,omitempty"`
+ CancellationMessage *string `json:"cancellation_message,omitempty"`
// The reason code associated with the cancellation. See the list of reason codes associated with your site.
- ReasonCode *string `json:"reason_code,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ReasonCode *string `json:"reason_code,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CancellationOptions.
@@ -23,13 +23,17 @@ type CancellationOptions struct {
func (c CancellationOptions) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "cancellation_message", "reason_code"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CancellationOptions object to a map representation for JSON marshaling.
func (c CancellationOptions) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.CancellationMessage != nil {
structMap["cancellation_message"] = c.CancellationMessage
}
@@ -47,12 +51,12 @@ func (c *CancellationOptions) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "cancellation_message", "reason_code")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "cancellation_message", "reason_code")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.CancellationMessage = temp.CancellationMessage
c.ReasonCode = temp.ReasonCode
return nil
diff --git a/models/cancellation_request.go b/models/cancellation_request.go
index 4a9b231f..a3a0c90a 100644
--- a/models/cancellation_request.go
+++ b/models/cancellation_request.go
@@ -13,8 +13,8 @@ import (
// CancellationRequest represents a CancellationRequest struct.
type CancellationRequest struct {
- Subscription CancellationOptions `json:"subscription"`
- AdditionalProperties map[string]any `json:"_"`
+ Subscription CancellationOptions `json:"subscription"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CancellationRequest.
@@ -22,13 +22,17 @@ type CancellationRequest struct {
func (c CancellationRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "subscription"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CancellationRequest object to a map representation for JSON marshaling.
func (c CancellationRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["subscription"] = c.Subscription.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CancellationRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Subscription = *temp.Subscription
return nil
}
diff --git a/models/change_chargeback_status_event.go b/models/change_chargeback_status_event.go
index 16538adf..0c867423 100644
--- a/models/change_chargeback_status_event.go
+++ b/models/change_chargeback_status_event.go
@@ -21,7 +21,7 @@ type ChangeChargebackStatusEvent struct {
EventType InvoiceEventType `json:"event_type"`
// Example schema for an `change_chargeback_status` event
EventData ChangeChargebackStatusEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ChangeChargebackStatusEvent.
@@ -29,13 +29,17 @@ type ChangeChargebackStatusEvent struct {
func (c ChangeChargebackStatusEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ChangeChargebackStatusEvent object to a map representation for JSON marshaling.
func (c ChangeChargebackStatusEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["id"] = c.Id
structMap["timestamp"] = c.Timestamp.Format(time.RFC3339)
structMap["invoice"] = c.Invoice.toMap()
@@ -56,12 +60,12 @@ func (c *ChangeChargebackStatusEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/change_chargeback_status_event_data.go b/models/change_chargeback_status_event_data.go
index b17809e9..cd7e7b51 100644
--- a/models/change_chargeback_status_event_data.go
+++ b/models/change_chargeback_status_event_data.go
@@ -14,8 +14,8 @@ import (
// ChangeChargebackStatusEventData represents a ChangeChargebackStatusEventData struct.
// Example schema for an `change_chargeback_status` event
type ChangeChargebackStatusEventData struct {
- ChargebackStatus ChargebackStatus `json:"chargeback_status"`
- AdditionalProperties map[string]any `json:"_"`
+ ChargebackStatus ChargebackStatus `json:"chargeback_status"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ChangeChargebackStatusEventData.
@@ -23,13 +23,17 @@ type ChangeChargebackStatusEventData struct {
func (c ChangeChargebackStatusEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "chargeback_status"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ChangeChargebackStatusEventData object to a map representation for JSON marshaling.
func (c ChangeChargebackStatusEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["chargeback_status"] = c.ChargebackStatus
return structMap
}
@@ -46,12 +50,12 @@ func (c *ChangeChargebackStatusEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "chargeback_status")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "chargeback_status")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ChargebackStatus = *temp.ChargebackStatus
return nil
}
diff --git a/models/change_invoice_collection_method_event.go b/models/change_invoice_collection_method_event.go
index af6867ad..5bdb970f 100644
--- a/models/change_invoice_collection_method_event.go
+++ b/models/change_invoice_collection_method_event.go
@@ -21,7 +21,7 @@ type ChangeInvoiceCollectionMethodEvent struct {
EventType InvoiceEventType `json:"event_type"`
// Example schema for an `change_invoice_collection_method` event
EventData ChangeInvoiceCollectionMethodEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ChangeInvoiceCollectionMethodEvent.
@@ -29,13 +29,17 @@ type ChangeInvoiceCollectionMethodEvent struct {
func (c ChangeInvoiceCollectionMethodEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ChangeInvoiceCollectionMethodEvent object to a map representation for JSON marshaling.
func (c ChangeInvoiceCollectionMethodEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["id"] = c.Id
structMap["timestamp"] = c.Timestamp.Format(time.RFC3339)
structMap["invoice"] = c.Invoice.toMap()
@@ -56,12 +60,12 @@ func (c *ChangeInvoiceCollectionMethodEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/change_invoice_collection_method_event_data.go b/models/change_invoice_collection_method_event_data.go
index 81beea47..0b1bf901 100644
--- a/models/change_invoice_collection_method_event_data.go
+++ b/models/change_invoice_collection_method_event_data.go
@@ -15,10 +15,10 @@ import (
// Example schema for an `change_invoice_collection_method` event
type ChangeInvoiceCollectionMethodEventData struct {
// The previous collection method of the invoice.
- FromCollectionMethod string `json:"from_collection_method"`
+ FromCollectionMethod string `json:"from_collection_method"`
// The new collection method of the invoice.
- ToCollectionMethod string `json:"to_collection_method"`
- AdditionalProperties map[string]any `json:"_"`
+ ToCollectionMethod string `json:"to_collection_method"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ChangeInvoiceCollectionMethodEventData.
@@ -26,13 +26,17 @@ type ChangeInvoiceCollectionMethodEventData struct {
func (c ChangeInvoiceCollectionMethodEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "from_collection_method", "to_collection_method"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ChangeInvoiceCollectionMethodEventData object to a map representation for JSON marshaling.
func (c ChangeInvoiceCollectionMethodEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["from_collection_method"] = c.FromCollectionMethod
structMap["to_collection_method"] = c.ToCollectionMethod
return structMap
@@ -50,12 +54,12 @@ func (c *ChangeInvoiceCollectionMethodEventData) UnmarshalJSON(input []byte) err
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "from_collection_method", "to_collection_method")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "from_collection_method", "to_collection_method")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.FromCollectionMethod = *temp.FromCollectionMethod
c.ToCollectionMethod = *temp.ToCollectionMethod
return nil
diff --git a/models/change_invoice_status_event.go b/models/change_invoice_status_event.go
index 230187f8..f9a45503 100644
--- a/models/change_invoice_status_event.go
+++ b/models/change_invoice_status_event.go
@@ -21,7 +21,7 @@ type ChangeInvoiceStatusEvent struct {
EventType InvoiceEventType `json:"event_type"`
// Example schema for an `change_invoice_status` event
EventData ChangeInvoiceStatusEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ChangeInvoiceStatusEvent.
@@ -29,13 +29,17 @@ type ChangeInvoiceStatusEvent struct {
func (c ChangeInvoiceStatusEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ChangeInvoiceStatusEvent object to a map representation for JSON marshaling.
func (c ChangeInvoiceStatusEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["id"] = c.Id
structMap["timestamp"] = c.Timestamp.Format(time.RFC3339)
structMap["invoice"] = c.Invoice.toMap()
@@ -56,12 +60,12 @@ func (c *ChangeInvoiceStatusEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/change_invoice_status_event_data.go b/models/change_invoice_status_event_data.go
index 393c09c3..8ef03bf6 100644
--- a/models/change_invoice_status_event_data.go
+++ b/models/change_invoice_status_event_data.go
@@ -23,7 +23,7 @@ type ChangeInvoiceStatusEventData struct {
// The updated status of the invoice after changes have been made. See [Invoice Statuses](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview#invoice-statuses) for more.
ToStatus InvoiceStatus `json:"to_status"`
ConsolidationLevel *InvoiceConsolidationLevel `json:"consolidation_level,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ChangeInvoiceStatusEventData.
@@ -31,13 +31,17 @@ type ChangeInvoiceStatusEventData struct {
func (c ChangeInvoiceStatusEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "gateway_trans_id", "amount", "from_status", "to_status", "consolidation_level"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ChangeInvoiceStatusEventData object to a map representation for JSON marshaling.
func (c ChangeInvoiceStatusEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.GatewayTransId != nil {
structMap["gateway_trans_id"] = c.GatewayTransId
}
@@ -64,12 +68,12 @@ func (c *ChangeInvoiceStatusEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "gateway_trans_id", "amount", "from_status", "to_status", "consolidation_level")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "gateway_trans_id", "amount", "from_status", "to_status", "consolidation_level")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.GatewayTransId = temp.GatewayTransId
c.Amount = temp.Amount
c.FromStatus = *temp.FromStatus
diff --git a/models/chargify_ebb.go b/models/chargify_ebb.go
index 51421211..6001bf75 100644
--- a/models/chargify_ebb.go
+++ b/models/chargify_ebb.go
@@ -14,20 +14,20 @@ import (
// ChargifyEBB represents a ChargifyEBB struct.
type ChargifyEBB struct {
// This timestamp determines what billing period the event will be billed in. If your request payload does not include it, Chargify will add `chargify.timestamp` to the event payload and set the value to `now`.
- Timestamp *time.Time `json:"timestamp,omitempty"`
+ Timestamp *time.Time `json:"timestamp,omitempty"`
// A unique ID set by Chargify. Please note that this field is reserved. If `chargify.id` is present in the request payload, it will be overwritten.
- Id *string `json:"id,omitempty"`
+ Id *string `json:"id,omitempty"`
// An ISO-8601 timestamp, set by Chargify at the time each event is recorded. Please note that this field is reserved. If `chargify.created_at` is present in the request payload, it will be overwritten.
- CreatedAt *time.Time `json:"created_at,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
// User-defined string scoped per-stream. Duplicate events within a stream will be silently ignored. Tokens expire after 31 days.
- UniquenessToken *string `json:"uniqueness_token,omitempty"`
+ UniquenessToken *string `json:"uniqueness_token,omitempty"`
// Id of Maxio Advanced Billing Subscription which is connected to this event.
// Provide `subscription_id` if you configured `chargify.subscription_id` as Subscription Identifier in your Event Stream.
- SubscriptionId *int `json:"subscription_id,omitempty"`
+ SubscriptionId *int `json:"subscription_id,omitempty"`
// Reference of Maxio Advanced Billing Subscription which is connected to this event.
// Provide `subscription_reference` if you configured `chargify.subscription_reference` as Subscription Identifier in your Event Stream.
- SubscriptionReference *string `json:"subscription_reference,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ SubscriptionReference *string `json:"subscription_reference,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ChargifyEBB.
@@ -35,13 +35,17 @@ type ChargifyEBB struct {
func (c ChargifyEBB) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "timestamp", "id", "created_at", "uniqueness_token", "subscription_id", "subscription_reference"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ChargifyEBB object to a map representation for JSON marshaling.
func (c ChargifyEBB) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Timestamp != nil {
structMap["timestamp"] = c.Timestamp.Format(time.RFC3339)
}
@@ -71,12 +75,12 @@ func (c *ChargifyEBB) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "timestamp", "id", "created_at", "uniqueness_token", "subscription_id", "subscription_reference")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "timestamp", "id", "created_at", "uniqueness_token", "subscription_id", "subscription_reference")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
if temp.Timestamp != nil {
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/component.go b/models/component.go
index e5b2ca95..a8b69e9e 100644
--- a/models/component.go
+++ b/models/component.go
@@ -39,7 +39,7 @@ type Component struct {
// The description of the component.
Description Optional[string] `json:"description"`
DefaultPricePointId Optional[int] `json:"default_price_point_id"`
- // An array of price brackets. If the component uses the ‘per_unit’ pricing scheme, this array will be empty.
+ // Applicable only to prepaid usage components. An array of overage price brackets.
OveragePrices Optional[[]ComponentPrice] `json:"overage_prices"`
// An array of price brackets. If the component uses the ‘per_unit’ pricing scheme, this array will be empty.
Prices Optional[[]ComponentPrice] `json:"prices"`
@@ -77,7 +77,7 @@ type Component struct {
Interval *int `json:"interval,omitempty"`
// A string representing the interval unit for this component's default price point, either month or day. This property is only available for sites with Multifrequency enabled.
IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Component.
@@ -85,13 +85,17 @@ type Component struct {
func (c Component) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "name", "handle", "pricing_scheme", "unit_name", "unit_price", "product_family_id", "product_family_name", "price_per_unit_in_cents", "kind", "archived", "taxable", "description", "default_price_point_id", "overage_prices", "prices", "price_point_count", "price_points_url", "default_price_point_name", "tax_code", "recurring", "upgrade_charge", "downgrade_credit", "created_at", "updated_at", "archived_at", "hide_date_range_on_invoice", "allow_fractional_quantities", "item_category", "use_site_exchange_rate", "accounting_code", "event_based_billing_metric_id", "interval", "interval_unit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the Component object to a map representation for JSON marshaling.
func (c Component) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Id != nil {
structMap["id"] = c.Id
}
@@ -278,12 +282,12 @@ func (c *Component) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "name", "handle", "pricing_scheme", "unit_name", "unit_price", "product_family_id", "product_family_name", "price_per_unit_in_cents", "kind", "archived", "taxable", "description", "default_price_point_id", "overage_prices", "prices", "price_point_count", "price_points_url", "default_price_point_name", "tax_code", "recurring", "upgrade_charge", "downgrade_credit", "created_at", "updated_at", "archived_at", "hide_date_range_on_invoice", "allow_fractional_quantities", "item_category", "use_site_exchange_rate", "accounting_code", "event_based_billing_metric_id", "interval", "interval_unit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "name", "handle", "pricing_scheme", "unit_name", "unit_price", "product_family_id", "product_family_name", "price_per_unit_in_cents", "kind", "archived", "taxable", "description", "default_price_point_id", "overage_prices", "prices", "price_point_count", "price_points_url", "default_price_point_name", "tax_code", "recurring", "upgrade_charge", "downgrade_credit", "created_at", "updated_at", "archived_at", "hide_date_range_on_invoice", "allow_fractional_quantities", "item_category", "use_site_exchange_rate", "accounting_code", "event_based_billing_metric_id", "interval", "interval_unit")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = temp.Id
c.Name = temp.Name
c.Handle = temp.Handle
diff --git a/models/component_allocation_change.go b/models/component_allocation_change.go
index 7a02b007..5b89bfbb 100644
--- a/models/component_allocation_change.go
+++ b/models/component_allocation_change.go
@@ -20,7 +20,7 @@ type ComponentAllocationChange struct {
Memo string `json:"memo"`
AllocationId int `json:"allocation_id"`
AllocatedQuantity *ComponentAllocationChangeAllocatedQuantity `json:"allocated_quantity,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentAllocationChange.
@@ -28,13 +28,17 @@ type ComponentAllocationChange struct {
func (c ComponentAllocationChange) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "previous_allocation", "new_allocation", "component_id", "component_handle", "memo", "allocation_id", "allocated_quantity"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentAllocationChange object to a map representation for JSON marshaling.
func (c ComponentAllocationChange) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["previous_allocation"] = c.PreviousAllocation
structMap["new_allocation"] = c.NewAllocation
structMap["component_id"] = c.ComponentId
@@ -59,12 +63,12 @@ func (c *ComponentAllocationChange) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "previous_allocation", "new_allocation", "component_id", "component_handle", "memo", "allocation_id", "allocated_quantity")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "previous_allocation", "new_allocation", "component_id", "component_handle", "memo", "allocation_id", "allocated_quantity")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.PreviousAllocation = *temp.PreviousAllocation
c.NewAllocation = *temp.NewAllocation
c.ComponentId = *temp.ComponentId
diff --git a/models/component_allocation_error_item.go b/models/component_allocation_error_item.go
index 08036cca..3dfb7691 100644
--- a/models/component_allocation_error_item.go
+++ b/models/component_allocation_error_item.go
@@ -11,11 +11,11 @@ import (
// ComponentAllocationErrorItem represents a ComponentAllocationErrorItem struct.
type ComponentAllocationErrorItem struct {
- ComponentId *int `json:"component_id,omitempty"`
- Message *string `json:"message,omitempty"`
- Kind *string `json:"kind,omitempty"`
- On *string `json:"on,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ComponentId *int `json:"component_id,omitempty"`
+ Message *string `json:"message,omitempty"`
+ Kind *string `json:"kind,omitempty"`
+ On *string `json:"on,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentAllocationErrorItem.
@@ -23,13 +23,17 @@ type ComponentAllocationErrorItem struct {
func (c ComponentAllocationErrorItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "component_id", "message", "kind", "on"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentAllocationErrorItem object to a map representation for JSON marshaling.
func (c ComponentAllocationErrorItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.ComponentId != nil {
structMap["component_id"] = c.ComponentId
}
@@ -53,12 +57,12 @@ func (c *ComponentAllocationErrorItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component_id", "message", "kind", "on")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component_id", "message", "kind", "on")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ComponentId = temp.ComponentId
c.Message = temp.Message
c.Kind = temp.Kind
diff --git a/models/component_cost_data.go b/models/component_cost_data.go
index 03f11c31..155322da 100644
--- a/models/component_cost_data.go
+++ b/models/component_cost_data.go
@@ -19,7 +19,7 @@ type ComponentCostData struct {
// 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"`
Tiers []ComponentCostDataRateTier `json:"tiers,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentCostData.
@@ -27,13 +27,17 @@ type ComponentCostData struct {
func (c ComponentCostData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "component_code_id", "price_point_id", "product_id", "quantity", "amount", "pricing_scheme", "tiers"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentCostData object to a map representation for JSON marshaling.
func (c ComponentCostData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.ComponentCodeId.IsValueSet() {
if c.ComponentCodeId.Value() != nil {
structMap["component_code_id"] = c.ComponentCodeId.Value()
@@ -70,12 +74,12 @@ func (c *ComponentCostData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component_code_id", "price_point_id", "product_id", "quantity", "amount", "pricing_scheme", "tiers")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component_code_id", "price_point_id", "product_id", "quantity", "amount", "pricing_scheme", "tiers")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ComponentCodeId = temp.ComponentCodeId
c.PricePointId = temp.PricePointId
c.ProductId = temp.ProductId
diff --git a/models/component_cost_data_rate_tier.go b/models/component_cost_data_rate_tier.go
index f8f0003b..2c7ca452 100644
--- a/models/component_cost_data_rate_tier.go
+++ b/models/component_cost_data_rate_tier.go
@@ -11,12 +11,12 @@ import (
// ComponentCostDataRateTier represents a ComponentCostDataRateTier struct.
type ComponentCostDataRateTier struct {
- StartingQuantity *int `json:"starting_quantity,omitempty"`
- EndingQuantity Optional[int] `json:"ending_quantity"`
- Quantity *string `json:"quantity,omitempty"`
- UnitPrice *string `json:"unit_price,omitempty"`
- Amount *string `json:"amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ StartingQuantity *int `json:"starting_quantity,omitempty"`
+ EndingQuantity Optional[int] `json:"ending_quantity"`
+ Quantity *string `json:"quantity,omitempty"`
+ UnitPrice *string `json:"unit_price,omitempty"`
+ Amount *string `json:"amount,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentCostDataRateTier.
@@ -24,13 +24,17 @@ type ComponentCostDataRateTier struct {
func (c ComponentCostDataRateTier) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "starting_quantity", "ending_quantity", "quantity", "unit_price", "amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentCostDataRateTier object to a map representation for JSON marshaling.
func (c ComponentCostDataRateTier) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.StartingQuantity != nil {
structMap["starting_quantity"] = c.StartingQuantity
}
@@ -61,12 +65,12 @@ func (c *ComponentCostDataRateTier) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "starting_quantity", "ending_quantity", "quantity", "unit_price", "amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "starting_quantity", "ending_quantity", "quantity", "unit_price", "amount")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.StartingQuantity = temp.StartingQuantity
c.EndingQuantity = temp.EndingQuantity
c.Quantity = temp.Quantity
diff --git a/models/component_currency_price.go b/models/component_currency_price.go
index f689f219..2add5438 100644
--- a/models/component_currency_price.go
+++ b/models/component_currency_price.go
@@ -11,13 +11,13 @@ import (
// 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"`
- AdditionalProperties map[string]any `json:"_"`
+ 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"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentCurrencyPrice.
@@ -25,13 +25,17 @@ type ComponentCurrencyPrice struct {
func (c ComponentCurrencyPrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "currency", "price", "formatted_price", "price_id", "price_point_id"); err != nil {
+ return []byte{}, err
+ }
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)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Id != nil {
structMap["id"] = c.Id
}
@@ -61,12 +65,12 @@ func (c *ComponentCurrencyPrice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "currency", "price", "formatted_price", "price_id", "price_point_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "currency", "price", "formatted_price", "price_id", "price_point_id")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = temp.Id
c.Currency = temp.Currency
c.Price = temp.Price
diff --git a/models/component_currency_prices_response.go b/models/component_currency_prices_response.go
index 1ea44311..deb95910 100644
--- a/models/component_currency_prices_response.go
+++ b/models/component_currency_prices_response.go
@@ -14,7 +14,7 @@ import (
// ComponentCurrencyPricesResponse represents a ComponentCurrencyPricesResponse struct.
type ComponentCurrencyPricesResponse struct {
CurrencyPrices []ComponentCurrencyPrice `json:"currency_prices"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentCurrencyPricesResponse.
@@ -22,13 +22,17 @@ type ComponentCurrencyPricesResponse struct {
func (c ComponentCurrencyPricesResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "currency_prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentCurrencyPricesResponse object to a map representation for JSON marshaling.
func (c ComponentCurrencyPricesResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["currency_prices"] = c.CurrencyPrices
return structMap
}
@@ -45,12 +49,12 @@ func (c *ComponentCurrencyPricesResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currency_prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currency_prices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.CurrencyPrices = *temp.CurrencyPrices
return nil
}
diff --git a/models/component_custom_price.go b/models/component_custom_price.go
index 46955ff0..60ad727d 100644
--- a/models/component_custom_price.go
+++ b/models/component_custom_price.go
@@ -24,7 +24,7 @@ type ComponentCustomPrice struct {
IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
// On/off components only need one price bracket starting at 1
Prices []Price `json:"prices"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentCustomPrice.
@@ -32,13 +32,17 @@ type ComponentCustomPrice struct {
func (c ComponentCustomPrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "tax_included", "pricing_scheme", "interval", "interval_unit", "prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentCustomPrice object to a map representation for JSON marshaling.
func (c ComponentCustomPrice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.TaxIncluded != nil {
structMap["tax_included"] = c.TaxIncluded
}
@@ -71,12 +75,12 @@ func (c *ComponentCustomPrice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "tax_included", "pricing_scheme", "interval", "interval_unit", "prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "tax_included", "pricing_scheme", "interval", "interval_unit", "prices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.TaxIncluded = temp.TaxIncluded
c.PricingScheme = temp.PricingScheme
c.Interval = temp.Interval
diff --git a/models/component_price.go b/models/component_price.go
index 3c5165b7..30bf4e62 100644
--- a/models/component_price.go
+++ b/models/component_price.go
@@ -11,15 +11,15 @@ import (
// ComponentPrice represents a ComponentPrice struct.
type ComponentPrice struct {
- Id *int `json:"id,omitempty"`
- ComponentId *int `json:"component_id,omitempty"`
- StartingQuantity *int `json:"starting_quantity,omitempty"`
- EndingQuantity Optional[int] `json:"ending_quantity"`
- UnitPrice *string `json:"unit_price,omitempty"`
- PricePointId *int `json:"price_point_id,omitempty"`
- FormattedUnitPrice *string `json:"formatted_unit_price,omitempty"`
- SegmentId Optional[int] `json:"segment_id"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ ComponentId *int `json:"component_id,omitempty"`
+ StartingQuantity *int `json:"starting_quantity,omitempty"`
+ EndingQuantity Optional[int] `json:"ending_quantity"`
+ UnitPrice *string `json:"unit_price,omitempty"`
+ PricePointId *int `json:"price_point_id,omitempty"`
+ FormattedUnitPrice *string `json:"formatted_unit_price,omitempty"`
+ SegmentId Optional[int] `json:"segment_id"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentPrice.
@@ -27,13 +27,17 @@ type ComponentPrice struct {
func (c ComponentPrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "component_id", "starting_quantity", "ending_quantity", "unit_price", "price_point_id", "formatted_unit_price", "segment_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentPrice object to a map representation for JSON marshaling.
func (c ComponentPrice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Id != nil {
structMap["id"] = c.Id
}
@@ -77,12 +81,12 @@ func (c *ComponentPrice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "component_id", "starting_quantity", "ending_quantity", "unit_price", "price_point_id", "formatted_unit_price", "segment_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "component_id", "starting_quantity", "ending_quantity", "unit_price", "price_point_id", "formatted_unit_price", "segment_id")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = temp.Id
c.ComponentId = temp.ComponentId
c.StartingQuantity = temp.StartingQuantity
diff --git a/models/component_price_point.go b/models/component_price_point.go
index d1004971..8fe39510 100644
--- a/models/component_price_point.go
+++ b/models/component_price_point.go
@@ -13,35 +13,47 @@ import (
// ComponentPricePoint represents a ComponentPricePoint struct.
type ComponentPricePoint struct {
- Id *int `json:"id,omitempty"`
+ Id *int `json:"id,omitempty"`
// Price point type. We expose the following types:
// 1. **default**: a price point that is marked as a default price for a certain product.
// 2. **custom**: a custom price point.
// 3. **catalog**: a price point that is **not** marked as a default price for a certain product and is **not** a custom one.
- Type *PricePointType `json:"type,omitempty"`
+ Type *PricePointType `json:"type,omitempty"`
// Note: Refer to type attribute instead
- Default *bool `json:"default,omitempty"` // Deprecated
- Name *string `json:"name,omitempty"`
+ Default *bool `json:"default,omitempty"` // Deprecated
+ Name *string `json:"name,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"`
- ComponentId *int `json:"component_id,omitempty"`
- Handle Optional[string] `json:"handle"`
- ArchivedAt Optional[time.Time] `json:"archived_at"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- Prices []ComponentPrice `json:"prices,omitempty"`
+ PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
+ ComponentId *int `json:"component_id,omitempty"`
+ Handle Optional[string] `json:"handle"`
+ ArchivedAt Optional[time.Time] `json:"archived_at"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ UpdatedAt *time.Time `json:"updated_at,omitempty"`
+ Prices []ComponentPrice `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. Defaults to true during creation.
- UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
+ UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
// (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.
- SubscriptionId *int `json:"subscription_id,omitempty"`
- TaxIncluded *bool `json:"tax_included,omitempty"`
+ 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 Optional[int] `json:"interval"`
+ 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 Optional[IntervalUnit] `json:"interval_unit"`
+ 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"`
- AdditionalProperties map[string]any `json:"_"`
+ CurrencyPrices []ComponentCurrencyPrice `json:"currency_prices,omitempty"`
+ // Applicable only to prepaid usage components. An array of overage price brackets.
+ OveragePrices []ComponentPrice `json:"overage_prices,omitempty"`
+ // Applicable only to prepaid usage components. Pricing scheme for overage pricing.
+ OveragePricingScheme *PricingScheme `json:"overage_pricing_scheme,omitempty"`
+ // Applicable only to prepaid usage components. Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period.
+ RenewPrepaidAllocation *bool `json:"renew_prepaid_allocation,omitempty"`
+ // Applicable only to prepaid usage components. Boolean which controls whether or not remaining units should be rolled over to the next period.
+ RolloverPrepaidRemainder *bool `json:"rollover_prepaid_remainder,omitempty"`
+ // Applicable only to prepaid usage components where rollover_prepaid_remainder is true. The number of `expiration_interval_unit`s after which rollover amounts should expire.
+ ExpirationInterval Optional[int] `json:"expiration_interval"`
+ // Applicable only to prepaid usage components where rollover_prepaid_remainder is true. A string representing the expiration interval unit for this component, either month or day.
+ ExpirationIntervalUnit Optional[ExpirationIntervalUnit] `json:"expiration_interval_unit"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentPricePoint.
@@ -49,13 +61,17 @@ type ComponentPricePoint struct {
func (c ComponentPricePoint) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "type", "default", "name", "pricing_scheme", "component_id", "handle", "archived_at", "created_at", "updated_at", "prices", "use_site_exchange_rate", "subscription_id", "tax_included", "interval", "interval_unit", "currency_prices", "overage_prices", "overage_pricing_scheme", "renew_prepaid_allocation", "rollover_prepaid_remainder", "expiration_interval", "expiration_interval_unit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentPricePoint object to a map representation for JSON marshaling.
func (c ComponentPricePoint) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Id != nil {
structMap["id"] = c.Id
}
@@ -128,6 +144,32 @@ func (c ComponentPricePoint) toMap() map[string]any {
if c.CurrencyPrices != nil {
structMap["currency_prices"] = c.CurrencyPrices
}
+ if c.OveragePrices != nil {
+ structMap["overage_prices"] = c.OveragePrices
+ }
+ if c.OveragePricingScheme != nil {
+ structMap["overage_pricing_scheme"] = c.OveragePricingScheme
+ }
+ if c.RenewPrepaidAllocation != nil {
+ structMap["renew_prepaid_allocation"] = c.RenewPrepaidAllocation
+ }
+ if c.RolloverPrepaidRemainder != nil {
+ structMap["rollover_prepaid_remainder"] = c.RolloverPrepaidRemainder
+ }
+ if c.ExpirationInterval.IsValueSet() {
+ if c.ExpirationInterval.Value() != nil {
+ structMap["expiration_interval"] = c.ExpirationInterval.Value()
+ } else {
+ structMap["expiration_interval"] = nil
+ }
+ }
+ if c.ExpirationIntervalUnit.IsValueSet() {
+ if c.ExpirationIntervalUnit.Value() != nil {
+ structMap["expiration_interval_unit"] = c.ExpirationIntervalUnit.Value()
+ } else {
+ structMap["expiration_interval_unit"] = nil
+ }
+ }
return structMap
}
@@ -139,12 +181,12 @@ func (c *ComponentPricePoint) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "type", "default", "name", "pricing_scheme", "component_id", "handle", "archived_at", "created_at", "updated_at", "prices", "use_site_exchange_rate", "subscription_id", "tax_included", "interval", "interval_unit", "currency_prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "type", "default", "name", "pricing_scheme", "component_id", "handle", "archived_at", "created_at", "updated_at", "prices", "use_site_exchange_rate", "subscription_id", "tax_included", "interval", "interval_unit", "currency_prices", "overage_prices", "overage_pricing_scheme", "renew_prepaid_allocation", "rollover_prepaid_remainder", "expiration_interval", "expiration_interval_unit")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = temp.Id
c.Type = temp.Type
c.Default = temp.Default
@@ -181,26 +223,38 @@ func (c *ComponentPricePoint) UnmarshalJSON(input []byte) error {
c.Interval = temp.Interval
c.IntervalUnit = temp.IntervalUnit
c.CurrencyPrices = temp.CurrencyPrices
+ c.OveragePrices = temp.OveragePrices
+ c.OveragePricingScheme = temp.OveragePricingScheme
+ c.RenewPrepaidAllocation = temp.RenewPrepaidAllocation
+ c.RolloverPrepaidRemainder = temp.RolloverPrepaidRemainder
+ c.ExpirationInterval = temp.ExpirationInterval
+ c.ExpirationIntervalUnit = temp.ExpirationIntervalUnit
return nil
}
// tempComponentPricePoint is a temporary struct used for validating the fields of ComponentPricePoint.
type tempComponentPricePoint struct {
- Id *int `json:"id,omitempty"`
- Type *PricePointType `json:"type,omitempty"`
- Default *bool `json:"default,omitempty"`
- Name *string `json:"name,omitempty"`
- PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
- ComponentId *int `json:"component_id,omitempty"`
- Handle Optional[string] `json:"handle"`
- ArchivedAt Optional[string] `json:"archived_at"`
- CreatedAt *string `json:"created_at,omitempty"`
- UpdatedAt *string `json:"updated_at,omitempty"`
- Prices []ComponentPrice `json:"prices,omitempty"`
- UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
- SubscriptionId *int `json:"subscription_id,omitempty"`
- TaxIncluded *bool `json:"tax_included,omitempty"`
- Interval Optional[int] `json:"interval"`
- IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
- CurrencyPrices []ComponentCurrencyPrice `json:"currency_prices,omitempty"`
+ Id *int `json:"id,omitempty"`
+ Type *PricePointType `json:"type,omitempty"`
+ Default *bool `json:"default,omitempty"`
+ Name *string `json:"name,omitempty"`
+ PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
+ ComponentId *int `json:"component_id,omitempty"`
+ Handle Optional[string] `json:"handle"`
+ ArchivedAt Optional[string] `json:"archived_at"`
+ CreatedAt *string `json:"created_at,omitempty"`
+ UpdatedAt *string `json:"updated_at,omitempty"`
+ Prices []ComponentPrice `json:"prices,omitempty"`
+ UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
+ SubscriptionId *int `json:"subscription_id,omitempty"`
+ TaxIncluded *bool `json:"tax_included,omitempty"`
+ Interval Optional[int] `json:"interval"`
+ IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
+ CurrencyPrices []ComponentCurrencyPrice `json:"currency_prices,omitempty"`
+ OveragePrices []ComponentPrice `json:"overage_prices,omitempty"`
+ OveragePricingScheme *PricingScheme `json:"overage_pricing_scheme,omitempty"`
+ RenewPrepaidAllocation *bool `json:"renew_prepaid_allocation,omitempty"`
+ RolloverPrepaidRemainder *bool `json:"rollover_prepaid_remainder,omitempty"`
+ ExpirationInterval Optional[int] `json:"expiration_interval"`
+ ExpirationIntervalUnit Optional[ExpirationIntervalUnit] `json:"expiration_interval_unit"`
}
diff --git a/models/component_price_point_assignment.go b/models/component_price_point_assignment.go
index d179200c..bb160ea9 100644
--- a/models/component_price_point_assignment.go
+++ b/models/component_price_point_assignment.go
@@ -13,7 +13,7 @@ import (
type ComponentPricePointAssignment struct {
ComponentId *int `json:"component_id,omitempty"`
PricePoint *ComponentPricePointAssignmentPricePoint `json:"price_point,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentPricePointAssignment.
@@ -21,13 +21,17 @@ type ComponentPricePointAssignment struct {
func (c ComponentPricePointAssignment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "component_id", "price_point"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentPricePointAssignment object to a map representation for JSON marshaling.
func (c ComponentPricePointAssignment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.ComponentId != nil {
structMap["component_id"] = c.ComponentId
}
@@ -45,12 +49,12 @@ func (c *ComponentPricePointAssignment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component_id", "price_point")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component_id", "price_point")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ComponentId = temp.ComponentId
c.PricePoint = temp.PricePoint
return nil
diff --git a/models/component_price_point_error_item.go b/models/component_price_point_error_item.go
index c3f4a70a..89086b37 100644
--- a/models/component_price_point_error_item.go
+++ b/models/component_price_point_error_item.go
@@ -11,10 +11,10 @@ import (
// ComponentPricePointErrorItem represents a ComponentPricePointErrorItem struct.
type ComponentPricePointErrorItem struct {
- ComponentId *int `json:"component_id,omitempty"`
- Message *string `json:"message,omitempty"`
- PricePoint *int `json:"price_point,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ComponentId *int `json:"component_id,omitempty"`
+ Message *string `json:"message,omitempty"`
+ PricePoint *int `json:"price_point,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentPricePointErrorItem.
@@ -22,13 +22,17 @@ type ComponentPricePointErrorItem struct {
func (c ComponentPricePointErrorItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "component_id", "message", "price_point"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentPricePointErrorItem object to a map representation for JSON marshaling.
func (c ComponentPricePointErrorItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.ComponentId != nil {
structMap["component_id"] = c.ComponentId
}
@@ -49,12 +53,12 @@ func (c *ComponentPricePointErrorItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component_id", "message", "price_point")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component_id", "message", "price_point")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ComponentId = temp.ComponentId
c.Message = temp.Message
c.PricePoint = temp.PricePoint
diff --git a/models/component_price_point_item.go b/models/component_price_point_item.go
index f0ec95af..dba4716b 100644
--- a/models/component_price_point_item.go
+++ b/models/component_price_point_item.go
@@ -20,7 +20,7 @@ type ComponentPricePointItem struct {
// 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 Optional[IntervalUnit] `json:"interval_unit"`
Prices []Price `json:"prices,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentPricePointItem.
@@ -28,13 +28,17 @@ type ComponentPricePointItem struct {
func (c ComponentPricePointItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "name", "handle", "pricing_scheme", "interval", "interval_unit", "prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentPricePointItem object to a map representation for JSON marshaling.
func (c ComponentPricePointItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Name != nil {
structMap["name"] = c.Name
}
@@ -68,12 +72,12 @@ func (c *ComponentPricePointItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "handle", "pricing_scheme", "interval", "interval_unit", "prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "handle", "pricing_scheme", "interval", "interval_unit", "prices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Name = temp.Name
c.Handle = temp.Handle
c.PricingScheme = temp.PricingScheme
diff --git a/models/component_price_point_response.go b/models/component_price_point_response.go
index 89d33f7d..37cb2dcb 100644
--- a/models/component_price_point_response.go
+++ b/models/component_price_point_response.go
@@ -13,8 +13,8 @@ import (
// ComponentPricePointResponse represents a ComponentPricePointResponse struct.
type ComponentPricePointResponse struct {
- PricePoint ComponentPricePoint `json:"price_point"`
- AdditionalProperties map[string]any `json:"_"`
+ PricePoint ComponentPricePoint `json:"price_point"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentPricePointResponse.
@@ -22,13 +22,17 @@ type ComponentPricePointResponse struct {
func (c ComponentPricePointResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "price_point"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentPricePointResponse object to a map representation for JSON marshaling.
func (c ComponentPricePointResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["price_point"] = c.PricePoint.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *ComponentPricePointResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_point")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_point")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.PricePoint = *temp.PricePoint
return nil
}
diff --git a/models/component_price_points_response.go b/models/component_price_points_response.go
index 905b16b2..f677b699 100644
--- a/models/component_price_points_response.go
+++ b/models/component_price_points_response.go
@@ -11,9 +11,9 @@ import (
// ComponentPricePointsResponse represents a ComponentPricePointsResponse struct.
type ComponentPricePointsResponse struct {
- PricePoints []ComponentPricePoint `json:"price_points,omitempty"`
- Meta *ListPublicKeysMeta `json:"meta,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PricePoints []ComponentPricePoint `json:"price_points,omitempty"`
+ Meta *ListPublicKeysMeta `json:"meta,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentPricePointsResponse.
@@ -21,13 +21,17 @@ type ComponentPricePointsResponse struct {
func (c ComponentPricePointsResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "price_points", "meta"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentPricePointsResponse object to a map representation for JSON marshaling.
func (c ComponentPricePointsResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.PricePoints != nil {
structMap["price_points"] = c.PricePoints
}
@@ -45,12 +49,12 @@ func (c *ComponentPricePointsResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_points", "meta")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_points", "meta")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.PricePoints = temp.PricePoints
c.Meta = temp.Meta
return nil
diff --git a/models/component_response.go b/models/component_response.go
index 473e59f0..8a7bdfab 100644
--- a/models/component_response.go
+++ b/models/component_response.go
@@ -13,8 +13,8 @@ import (
// ComponentResponse represents a ComponentResponse struct.
type ComponentResponse struct {
- Component Component `json:"component"`
- AdditionalProperties map[string]any `json:"_"`
+ Component Component `json:"component"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ComponentResponse.
@@ -22,13 +22,17 @@ type ComponentResponse struct {
func (c ComponentResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "component"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ComponentResponse object to a map representation for JSON marshaling.
func (c ComponentResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["component"] = c.Component.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *ComponentResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Component = *temp.Component
return nil
}
diff --git a/models/consolidated_invoice.go b/models/consolidated_invoice.go
index 8a713d6f..410ce8eb 100644
--- a/models/consolidated_invoice.go
+++ b/models/consolidated_invoice.go
@@ -11,8 +11,8 @@ import (
// ConsolidatedInvoice represents a ConsolidatedInvoice struct.
type ConsolidatedInvoice struct {
- Invoices []Invoice `json:"invoices,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Invoices []Invoice `json:"invoices,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ConsolidatedInvoice.
@@ -20,13 +20,17 @@ type ConsolidatedInvoice struct {
func (c ConsolidatedInvoice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "invoices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the ConsolidatedInvoice object to a map representation for JSON marshaling.
func (c ConsolidatedInvoice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Invoices != nil {
structMap["invoices"] = c.Invoices
}
@@ -41,12 +45,12 @@ func (c *ConsolidatedInvoice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "invoices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "invoices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Invoices = temp.Invoices
return nil
}
diff --git a/models/count_response.go b/models/count_response.go
index 2436129d..1daa6721 100644
--- a/models/count_response.go
+++ b/models/count_response.go
@@ -11,8 +11,8 @@ import (
// CountResponse represents a CountResponse struct.
type CountResponse struct {
- Count *int `json:"count,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Count *int `json:"count,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CountResponse.
@@ -20,13 +20,17 @@ type CountResponse struct {
func (c CountResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "count"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CountResponse object to a map representation for JSON marshaling.
func (c CountResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Count != nil {
structMap["count"] = c.Count
}
@@ -41,12 +45,12 @@ func (c *CountResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "count")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "count")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Count = temp.Count
return nil
}
diff --git a/models/coupon.go b/models/coupon.go
index 8ea4cd59..6642ac00 100644
--- a/models/coupon.go
+++ b/models/coupon.go
@@ -18,10 +18,11 @@ type Coupon struct {
Code *string `json:"code,omitempty"`
Description *string `json:"description,omitempty"`
Amount Optional[float64] `json:"amount"`
- AmountInCents Optional[int] `json:"amount_in_cents"`
+ AmountInCents Optional[int64] `json:"amount_in_cents"`
ProductFamilyId *int `json:"product_family_id,omitempty"`
ProductFamilyName Optional[string] `json:"product_family_name"`
StartDate *time.Time `json:"start_date,omitempty"`
+ // After the given time, this coupon code will be invalid for new signups. Recurring discounts started before this date will continue to recur even after this date.
EndDate Optional[time.Time] `json:"end_date"`
Percentage Optional[string] `json:"percentage"`
Recurring *bool `json:"recurring,omitempty"`
@@ -30,10 +31,13 @@ type Coupon struct {
DurationInterval Optional[int] `json:"duration_interval"`
DurationIntervalUnit Optional[string] `json:"duration_interval_unit"`
DurationIntervalSpan Optional[string] `json:"duration_interval_span"`
+ // If set to true, discount is not limited (credits will carry forward to next billing).
AllowNegativeBalance *bool `json:"allow_negative_balance,omitempty"`
ArchivedAt Optional[time.Time] `json:"archived_at"`
ConversionLimit Optional[string] `json:"conversion_limit"`
+ // A stackable coupon can be combined with other coupons on a Subscription.
Stackable *bool `json:"stackable,omitempty"`
+ // Applicable only to stackable coupons. For `compound`, Percentage-based discounts will be calculated against the remaining price, after prior discounts have been calculated. For `full-price`, Percentage-based discounts will always be calculated against the original item price, before other discounts are applied.
CompoundingStrategy Optional[CompoundingStrategy] `json:"compounding_strategy"`
UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
@@ -43,7 +47,9 @@ type Coupon struct {
ApplyOnCancelAtEndOfPeriod *bool `json:"apply_on_cancel_at_end_of_period,omitempty"`
ApplyOnSubscriptionExpiration *bool `json:"apply_on_subscription_expiration,omitempty"`
CouponRestrictions []CouponRestriction `json:"coupon_restrictions,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ // Returned in read, find, and list endpoints if the query parameter is provided.
+ CurrencyPrices []CouponCurrency `json:"currency_prices,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Coupon.
@@ -51,13 +57,17 @@ type Coupon struct {
func (c Coupon) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "name", "code", "description", "amount", "amount_in_cents", "product_family_id", "product_family_name", "start_date", "end_date", "percentage", "recurring", "recurring_scheme", "duration_period_count", "duration_interval", "duration_interval_unit", "duration_interval_span", "allow_negative_balance", "archived_at", "conversion_limit", "stackable", "compounding_strategy", "use_site_exchange_rate", "created_at", "updated_at", "discount_type", "exclude_mid_period_allocations", "apply_on_cancel_at_end_of_period", "apply_on_subscription_expiration", "coupon_restrictions", "currency_prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the Coupon object to a map representation for JSON marshaling.
func (c Coupon) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Id != nil {
structMap["id"] = c.Id
}
@@ -206,6 +216,9 @@ func (c Coupon) toMap() map[string]any {
if c.CouponRestrictions != nil {
structMap["coupon_restrictions"] = c.CouponRestrictions
}
+ if c.CurrencyPrices != nil {
+ structMap["currency_prices"] = c.CurrencyPrices
+ }
return structMap
}
@@ -217,12 +230,12 @@ func (c *Coupon) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "name", "code", "description", "amount", "amount_in_cents", "product_family_id", "product_family_name", "start_date", "end_date", "percentage", "recurring", "recurring_scheme", "duration_period_count", "duration_interval", "duration_interval_unit", "duration_interval_span", "allow_negative_balance", "archived_at", "conversion_limit", "stackable", "compounding_strategy", "use_site_exchange_rate", "created_at", "updated_at", "discount_type", "exclude_mid_period_allocations", "apply_on_cancel_at_end_of_period", "apply_on_subscription_expiration", "coupon_restrictions")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "name", "code", "description", "amount", "amount_in_cents", "product_family_id", "product_family_name", "start_date", "end_date", "percentage", "recurring", "recurring_scheme", "duration_period_count", "duration_interval", "duration_interval_unit", "duration_interval_span", "allow_negative_balance", "archived_at", "conversion_limit", "stackable", "compounding_strategy", "use_site_exchange_rate", "created_at", "updated_at", "discount_type", "exclude_mid_period_allocations", "apply_on_cancel_at_end_of_period", "apply_on_subscription_expiration", "coupon_restrictions", "currency_prices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = temp.Id
c.Name = temp.Name
c.Code = temp.Code
@@ -285,6 +298,7 @@ func (c *Coupon) UnmarshalJSON(input []byte) error {
c.ApplyOnCancelAtEndOfPeriod = temp.ApplyOnCancelAtEndOfPeriod
c.ApplyOnSubscriptionExpiration = temp.ApplyOnSubscriptionExpiration
c.CouponRestrictions = temp.CouponRestrictions
+ c.CurrencyPrices = temp.CurrencyPrices
return nil
}
@@ -295,7 +309,7 @@ type tempCoupon struct {
Code *string `json:"code,omitempty"`
Description *string `json:"description,omitempty"`
Amount Optional[float64] `json:"amount"`
- AmountInCents Optional[int] `json:"amount_in_cents"`
+ AmountInCents Optional[int64] `json:"amount_in_cents"`
ProductFamilyId *int `json:"product_family_id,omitempty"`
ProductFamilyName Optional[string] `json:"product_family_name"`
StartDate *string `json:"start_date,omitempty"`
@@ -320,4 +334,5 @@ type tempCoupon struct {
ApplyOnCancelAtEndOfPeriod *bool `json:"apply_on_cancel_at_end_of_period,omitempty"`
ApplyOnSubscriptionExpiration *bool `json:"apply_on_subscription_expiration,omitempty"`
CouponRestrictions []CouponRestriction `json:"coupon_restrictions,omitempty"`
+ CurrencyPrices []CouponCurrency `json:"currency_prices,omitempty"`
}
diff --git a/models/coupon_currency.go b/models/coupon_currency.go
index 0301537d..5a85a4e0 100644
--- a/models/coupon_currency.go
+++ b/models/coupon_currency.go
@@ -11,11 +11,11 @@ import (
// CouponCurrency represents a CouponCurrency struct.
type CouponCurrency struct {
- Id *int `json:"id,omitempty"`
- Currency *string `json:"currency,omitempty"`
- Price *int `json:"price,omitempty"`
- CouponId *int `json:"coupon_id,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id Optional[int] `json:"id"`
+ Currency *string `json:"currency,omitempty"`
+ Price Optional[float64] `json:"price"`
+ CouponId *int `json:"coupon_id,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CouponCurrency.
@@ -23,21 +23,33 @@ type CouponCurrency struct {
func (c CouponCurrency) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "currency", "price", "coupon_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CouponCurrency object to a map representation for JSON marshaling.
func (c CouponCurrency) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
- if c.Id != nil {
- structMap["id"] = c.Id
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
+ if c.Id.IsValueSet() {
+ if c.Id.Value() != nil {
+ structMap["id"] = c.Id.Value()
+ } else {
+ structMap["id"] = nil
+ }
}
if c.Currency != nil {
structMap["currency"] = c.Currency
}
- if c.Price != nil {
- structMap["price"] = c.Price
+ if c.Price.IsValueSet() {
+ if c.Price.Value() != nil {
+ structMap["price"] = c.Price.Value()
+ } else {
+ structMap["price"] = nil
+ }
}
if c.CouponId != nil {
structMap["coupon_id"] = c.CouponId
@@ -53,12 +65,12 @@ func (c *CouponCurrency) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "currency", "price", "coupon_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "currency", "price", "coupon_id")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = temp.Id
c.Currency = temp.Currency
c.Price = temp.Price
@@ -68,8 +80,8 @@ func (c *CouponCurrency) UnmarshalJSON(input []byte) error {
// tempCouponCurrency is a temporary struct used for validating the fields of CouponCurrency.
type tempCouponCurrency struct {
- Id *int `json:"id,omitempty"`
- Currency *string `json:"currency,omitempty"`
- Price *int `json:"price,omitempty"`
- CouponId *int `json:"coupon_id,omitempty"`
+ Id Optional[int] `json:"id"`
+ Currency *string `json:"currency,omitempty"`
+ Price Optional[float64] `json:"price"`
+ CouponId *int `json:"coupon_id,omitempty"`
}
diff --git a/models/coupon_currency_request.go b/models/coupon_currency_request.go
index 9c37cd4b..84b00474 100644
--- a/models/coupon_currency_request.go
+++ b/models/coupon_currency_request.go
@@ -14,7 +14,7 @@ import (
// CouponCurrencyRequest represents a CouponCurrencyRequest struct.
type CouponCurrencyRequest struct {
CurrencyPrices []UpdateCouponCurrency `json:"currency_prices"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CouponCurrencyRequest.
@@ -22,13 +22,17 @@ type CouponCurrencyRequest struct {
func (c CouponCurrencyRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "currency_prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CouponCurrencyRequest object to a map representation for JSON marshaling.
func (c CouponCurrencyRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["currency_prices"] = c.CurrencyPrices
return structMap
}
@@ -45,12 +49,12 @@ func (c *CouponCurrencyRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currency_prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currency_prices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.CurrencyPrices = *temp.CurrencyPrices
return nil
}
diff --git a/models/coupon_currency_response.go b/models/coupon_currency_response.go
index fc7219e6..12055c8c 100644
--- a/models/coupon_currency_response.go
+++ b/models/coupon_currency_response.go
@@ -11,8 +11,8 @@ import (
// CouponCurrencyResponse represents a CouponCurrencyResponse struct.
type CouponCurrencyResponse struct {
- CurrencyPrices []CouponCurrency `json:"currency_prices,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CurrencyPrices []CouponCurrency `json:"currency_prices,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CouponCurrencyResponse.
@@ -20,13 +20,17 @@ type CouponCurrencyResponse struct {
func (c CouponCurrencyResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "currency_prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CouponCurrencyResponse object to a map representation for JSON marshaling.
func (c CouponCurrencyResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.CurrencyPrices != nil {
structMap["currency_prices"] = c.CurrencyPrices
}
@@ -41,12 +45,12 @@ func (c *CouponCurrencyResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currency_prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currency_prices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.CurrencyPrices = temp.CurrencyPrices
return nil
}
diff --git a/models/coupon_payload.go b/models/coupon_payload.go
new file mode 100644
index 00000000..448bd21f
--- /dev/null
+++ b/models/coupon_payload.go
@@ -0,0 +1,156 @@
+/*
+Package advancedbilling
+
+This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
+*/
+package models
+
+import (
+ "encoding/json"
+ "log"
+ "time"
+)
+
+// CouponPayload represents a CouponPayload struct.
+type CouponPayload struct {
+ // Required when creating a new coupon. This name is not displayed to customers and is limited to 255 characters.
+ Name *string `json:"name,omitempty"`
+ // Required when creating a new coupon. The code is limited to 255 characters. May contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
+ Code *string `json:"code,omitempty"`
+ // Required when creating a new coupon. A description of the coupon that can be displayed to customers in transactions and on statements. The description is limited to 255 characters.
+ Description *string `json:"description,omitempty"`
+ // Required when creating a new percentage coupon. Can't be used together with amount_in_cents. Percentage discount
+ Percentage *CouponPayloadPercentage `json:"percentage,omitempty"`
+ // Required when creating a new flat amount coupon. Can't be used together with percentage. Flat USD discount
+ AmountInCents *int64 `json:"amount_in_cents,omitempty"`
+ // If set to true, discount is not limited (credits will carry forward to next billing). Can't be used together with restrictions.
+ AllowNegativeBalance *bool `json:"allow_negative_balance,omitempty"`
+ Recurring *bool `json:"recurring,omitempty"`
+ // After the end of the given day, this coupon code will be invalid for new signups. Recurring discounts started before this date will continue to recur even after this date.
+ EndDate *time.Time `json:"end_date,omitempty"`
+ ProductFamilyId *string `json:"product_family_id,omitempty"`
+ // A stackable coupon can be combined with other coupons on a Subscription.
+ Stackable *bool `json:"stackable,omitempty"`
+ // Applicable only to stackable coupons. For `compound`, Percentage-based discounts will be calculated against the remaining price, after prior discounts have been calculated. For `full-price`, Percentage-based discounts will always be calculated against the original item price, before other discounts are applied.
+ CompoundingStrategy *CompoundingStrategy `json:"compounding_strategy,omitempty"`
+ ExcludeMidPeriodAllocations *bool `json:"exclude_mid_period_allocations,omitempty"`
+ ApplyOnCancelAtEndOfPeriod *bool `json:"apply_on_cancel_at_end_of_period,omitempty"`
+ ApplyOnSubscriptionExpiration *bool `json:"apply_on_subscription_expiration,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
+}
+
+// MarshalJSON implements the json.Marshaler interface for CouponPayload.
+// It customizes the JSON marshaling process for CouponPayload objects.
+func (c CouponPayload) MarshalJSON() (
+ []byte,
+ error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "name", "code", "description", "percentage", "amount_in_cents", "allow_negative_balance", "recurring", "end_date", "product_family_id", "stackable", "compounding_strategy", "exclude_mid_period_allocations", "apply_on_cancel_at_end_of_period", "apply_on_subscription_expiration"); err != nil {
+ return []byte{}, err
+ }
+ return json.Marshal(c.toMap())
+}
+
+// toMap converts the CouponPayload object to a map representation for JSON marshaling.
+func (c CouponPayload) toMap() map[string]any {
+ structMap := make(map[string]any)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
+ if c.Name != nil {
+ structMap["name"] = c.Name
+ }
+ if c.Code != nil {
+ structMap["code"] = c.Code
+ }
+ if c.Description != nil {
+ structMap["description"] = c.Description
+ }
+ if c.Percentage != nil {
+ structMap["percentage"] = c.Percentage.toMap()
+ }
+ if c.AmountInCents != nil {
+ structMap["amount_in_cents"] = c.AmountInCents
+ }
+ if c.AllowNegativeBalance != nil {
+ structMap["allow_negative_balance"] = c.AllowNegativeBalance
+ }
+ if c.Recurring != nil {
+ structMap["recurring"] = c.Recurring
+ }
+ if c.EndDate != nil {
+ structMap["end_date"] = c.EndDate.Format(DEFAULT_DATE)
+ }
+ if c.ProductFamilyId != nil {
+ structMap["product_family_id"] = c.ProductFamilyId
+ }
+ if c.Stackable != nil {
+ structMap["stackable"] = c.Stackable
+ }
+ if c.CompoundingStrategy != nil {
+ structMap["compounding_strategy"] = c.CompoundingStrategy
+ }
+ if c.ExcludeMidPeriodAllocations != nil {
+ structMap["exclude_mid_period_allocations"] = c.ExcludeMidPeriodAllocations
+ }
+ if c.ApplyOnCancelAtEndOfPeriod != nil {
+ structMap["apply_on_cancel_at_end_of_period"] = c.ApplyOnCancelAtEndOfPeriod
+ }
+ if c.ApplyOnSubscriptionExpiration != nil {
+ structMap["apply_on_subscription_expiration"] = c.ApplyOnSubscriptionExpiration
+ }
+ return structMap
+}
+
+// UnmarshalJSON implements the json.Unmarshaler interface for CouponPayload.
+// It customizes the JSON unmarshaling process for CouponPayload objects.
+func (c *CouponPayload) UnmarshalJSON(input []byte) error {
+ var temp tempCouponPayload
+ err := json.Unmarshal(input, &temp)
+ if err != nil {
+ return err
+ }
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "code", "description", "percentage", "amount_in_cents", "allow_negative_balance", "recurring", "end_date", "product_family_id", "stackable", "compounding_strategy", "exclude_mid_period_allocations", "apply_on_cancel_at_end_of_period", "apply_on_subscription_expiration")
+ if err != nil {
+ return err
+ }
+ c.AdditionalProperties = additionalProperties
+
+ c.Name = temp.Name
+ c.Code = temp.Code
+ c.Description = temp.Description
+ c.Percentage = temp.Percentage
+ c.AmountInCents = temp.AmountInCents
+ c.AllowNegativeBalance = temp.AllowNegativeBalance
+ c.Recurring = temp.Recurring
+ if temp.EndDate != nil {
+ EndDateVal, err := time.Parse(DEFAULT_DATE, *temp.EndDate)
+ if err != nil {
+ log.Fatalf("Cannot Parse end_date as % s format.", DEFAULT_DATE)
+ }
+ c.EndDate = &EndDateVal
+ }
+ c.ProductFamilyId = temp.ProductFamilyId
+ c.Stackable = temp.Stackable
+ c.CompoundingStrategy = temp.CompoundingStrategy
+ c.ExcludeMidPeriodAllocations = temp.ExcludeMidPeriodAllocations
+ c.ApplyOnCancelAtEndOfPeriod = temp.ApplyOnCancelAtEndOfPeriod
+ c.ApplyOnSubscriptionExpiration = temp.ApplyOnSubscriptionExpiration
+ return nil
+}
+
+// tempCouponPayload is a temporary struct used for validating the fields of CouponPayload.
+type tempCouponPayload struct {
+ Name *string `json:"name,omitempty"`
+ Code *string `json:"code,omitempty"`
+ Description *string `json:"description,omitempty"`
+ Percentage *CouponPayloadPercentage `json:"percentage,omitempty"`
+ AmountInCents *int64 `json:"amount_in_cents,omitempty"`
+ AllowNegativeBalance *bool `json:"allow_negative_balance,omitempty"`
+ Recurring *bool `json:"recurring,omitempty"`
+ EndDate *string `json:"end_date,omitempty"`
+ ProductFamilyId *string `json:"product_family_id,omitempty"`
+ Stackable *bool `json:"stackable,omitempty"`
+ CompoundingStrategy *CompoundingStrategy `json:"compounding_strategy,omitempty"`
+ ExcludeMidPeriodAllocations *bool `json:"exclude_mid_period_allocations,omitempty"`
+ ApplyOnCancelAtEndOfPeriod *bool `json:"apply_on_cancel_at_end_of_period,omitempty"`
+ ApplyOnSubscriptionExpiration *bool `json:"apply_on_subscription_expiration,omitempty"`
+}
diff --git a/models/coupon_payload_percentage.go b/models/coupon_payload_percentage.go
new file mode 100644
index 00000000..26042aa8
--- /dev/null
+++ b/models/coupon_payload_percentage.go
@@ -0,0 +1,96 @@
+/*
+Package advancedbilling
+
+This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
+*/
+package models
+
+import (
+ "encoding/json"
+ "errors"
+ "strings"
+)
+
+// CouponPayloadPercentage represents a CouponPayloadPercentage struct.
+// This is a container for one-of cases.
+type CouponPayloadPercentage struct {
+ value any
+ isString bool
+ isPrecision bool
+}
+
+// String converts the CouponPayloadPercentage object to a string representation.
+func (c CouponPayloadPercentage) String() string {
+ if bytes, err := json.Marshal(c.value); err == nil {
+ return strings.Trim(string(bytes), "\"")
+ }
+ return ""
+}
+
+// MarshalJSON implements the json.Marshaler interface for CouponPayloadPercentage.
+// It customizes the JSON marshaling process for CouponPayloadPercentage objects.
+func (c CouponPayloadPercentage) MarshalJSON() (
+ []byte,
+ error) {
+ if c.value == nil {
+ return nil, errors.New("No underlying type is set. Please use any of the `models.CouponPayloadPercentageContainer.From*` functions to initialize the CouponPayloadPercentage object.")
+ }
+ return json.Marshal(c.toMap())
+}
+
+// toMap converts the CouponPayloadPercentage object to a map representation for JSON marshaling.
+func (c *CouponPayloadPercentage) toMap() any {
+ switch obj := c.value.(type) {
+ case *string:
+ return *obj
+ case *float64:
+ return *obj
+ }
+ return nil
+}
+
+// UnmarshalJSON implements the json.Unmarshaler interface for CouponPayloadPercentage.
+// It customizes the JSON unmarshaling process for CouponPayloadPercentage objects.
+func (c *CouponPayloadPercentage) UnmarshalJSON(input []byte) error {
+ result, err := UnmarshallOneOf(input,
+ NewTypeHolder(new(string), false, &c.isString),
+ NewTypeHolder(new(float64), false, &c.isPrecision),
+ )
+
+ c.value = result
+ return err
+}
+
+func (c *CouponPayloadPercentage) AsString() (
+ *string,
+ bool) {
+ if !c.isString {
+ return nil, false
+ }
+ return c.value.(*string), true
+}
+
+func (c *CouponPayloadPercentage) AsPrecision() (
+ *float64,
+ bool) {
+ if !c.isPrecision {
+ return nil, false
+ }
+ return c.value.(*float64), true
+}
+
+// internalCouponPayloadPercentage represents a couponPayloadPercentage struct.
+// This is a container for one-of cases.
+type internalCouponPayloadPercentage struct {}
+
+var CouponPayloadPercentageContainer internalCouponPayloadPercentage
+
+// The internalCouponPayloadPercentage instance, wrapping the provided string value.
+func (c *internalCouponPayloadPercentage) FromString(val string) CouponPayloadPercentage {
+ return CouponPayloadPercentage{value: &val}
+}
+
+// The internalCouponPayloadPercentage instance, wrapping the provided float64 value.
+func (c *internalCouponPayloadPercentage) FromPrecision(val float64) CouponPayloadPercentage {
+ return CouponPayloadPercentage{value: &val}
+}
diff --git a/models/coupon_request.go b/models/coupon_request.go
new file mode 100644
index 00000000..4f688a57
--- /dev/null
+++ b/models/coupon_request.go
@@ -0,0 +1,75 @@
+/*
+Package advancedbilling
+
+This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
+*/
+package models
+
+import (
+ "encoding/json"
+)
+
+// CouponRequest represents a CouponRequest struct.
+type CouponRequest struct {
+ Coupon *CouponPayload `json:"coupon,omitempty"`
+ // An object where the keys are product_ids and the values are booleans indicating if the coupon should be applicable to the product
+ RestrictedProducts map[string]bool `json:"restricted_products,omitempty"`
+ // An object where the keys are component_ids and the values are booleans indicating if the coupon should be applicable to the component
+ RestrictedComponents map[string]bool `json:"restricted_components,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
+}
+
+// MarshalJSON implements the json.Marshaler interface for CouponRequest.
+// It customizes the JSON marshaling process for CouponRequest objects.
+func (c CouponRequest) MarshalJSON() (
+ []byte,
+ error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "coupon", "restricted_products", "restricted_components"); err != nil {
+ return []byte{}, err
+ }
+ return json.Marshal(c.toMap())
+}
+
+// toMap converts the CouponRequest object to a map representation for JSON marshaling.
+func (c CouponRequest) toMap() map[string]any {
+ structMap := make(map[string]any)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
+ if c.Coupon != nil {
+ structMap["coupon"] = c.Coupon.toMap()
+ }
+ if c.RestrictedProducts != nil {
+ structMap["restricted_products"] = c.RestrictedProducts
+ }
+ if c.RestrictedComponents != nil {
+ structMap["restricted_components"] = c.RestrictedComponents
+ }
+ return structMap
+}
+
+// UnmarshalJSON implements the json.Unmarshaler interface for CouponRequest.
+// It customizes the JSON unmarshaling process for CouponRequest objects.
+func (c *CouponRequest) UnmarshalJSON(input []byte) error {
+ var temp tempCouponRequest
+ err := json.Unmarshal(input, &temp)
+ if err != nil {
+ return err
+ }
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "coupon", "restricted_products", "restricted_components")
+ if err != nil {
+ return err
+ }
+ c.AdditionalProperties = additionalProperties
+
+ c.Coupon = temp.Coupon
+ c.RestrictedProducts = temp.RestrictedProducts
+ c.RestrictedComponents = temp.RestrictedComponents
+ return nil
+}
+
+// tempCouponRequest is a temporary struct used for validating the fields of CouponRequest.
+type tempCouponRequest struct {
+ Coupon *CouponPayload `json:"coupon,omitempty"`
+ RestrictedProducts map[string]bool `json:"restricted_products,omitempty"`
+ RestrictedComponents map[string]bool `json:"restricted_components,omitempty"`
+}
diff --git a/models/coupon_response.go b/models/coupon_response.go
index 1c359cb4..3718d143 100644
--- a/models/coupon_response.go
+++ b/models/coupon_response.go
@@ -11,8 +11,8 @@ import (
// CouponResponse represents a CouponResponse struct.
type CouponResponse struct {
- Coupon *Coupon `json:"coupon,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Coupon *Coupon `json:"coupon,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CouponResponse.
@@ -20,13 +20,17 @@ type CouponResponse struct {
func (c CouponResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "coupon"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CouponResponse object to a map representation for JSON marshaling.
func (c CouponResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Coupon != nil {
structMap["coupon"] = c.Coupon.toMap()
}
@@ -41,12 +45,12 @@ func (c *CouponResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "coupon")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "coupon")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Coupon = temp.Coupon
return nil
}
diff --git a/models/coupon_restriction.go b/models/coupon_restriction.go
index 097a9900..f5b0d0ef 100644
--- a/models/coupon_restriction.go
+++ b/models/coupon_restriction.go
@@ -11,12 +11,12 @@ import (
// CouponRestriction represents a CouponRestriction struct.
type CouponRestriction struct {
- Id *int `json:"id,omitempty"`
- ItemType *RestrictionType `json:"item_type,omitempty"`
- ItemId *int `json:"item_id,omitempty"`
- Name *string `json:"name,omitempty"`
- Handle Optional[string] `json:"handle"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ ItemType *RestrictionType `json:"item_type,omitempty"`
+ ItemId *int `json:"item_id,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Handle Optional[string] `json:"handle"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CouponRestriction.
@@ -24,13 +24,17 @@ type CouponRestriction struct {
func (c CouponRestriction) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "item_type", "item_id", "name", "handle"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CouponRestriction object to a map representation for JSON marshaling.
func (c CouponRestriction) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Id != nil {
structMap["id"] = c.Id
}
@@ -61,12 +65,12 @@ func (c *CouponRestriction) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "item_type", "item_id", "name", "handle")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "item_type", "item_id", "name", "handle")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = temp.Id
c.ItemType = temp.ItemType
c.ItemId = temp.ItemId
diff --git a/models/coupon_subcodes.go b/models/coupon_subcodes.go
index be0a0cd6..ccfb17b5 100644
--- a/models/coupon_subcodes.go
+++ b/models/coupon_subcodes.go
@@ -11,8 +11,8 @@ import (
// CouponSubcodes represents a CouponSubcodes struct.
type CouponSubcodes struct {
- Codes []string `json:"codes,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Codes []string `json:"codes,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CouponSubcodes.
@@ -20,13 +20,17 @@ type CouponSubcodes struct {
func (c CouponSubcodes) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "codes"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CouponSubcodes object to a map representation for JSON marshaling.
func (c CouponSubcodes) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Codes != nil {
structMap["codes"] = c.Codes
}
@@ -41,12 +45,12 @@ func (c *CouponSubcodes) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "codes")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "codes")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Codes = temp.Codes
return nil
}
diff --git a/models/coupon_subcodes_response.go b/models/coupon_subcodes_response.go
index 6f4eaabd..18395deb 100644
--- a/models/coupon_subcodes_response.go
+++ b/models/coupon_subcodes_response.go
@@ -11,10 +11,10 @@ import (
// CouponSubcodesResponse represents a CouponSubcodesResponse struct.
type CouponSubcodesResponse struct {
- CreatedCodes []string `json:"created_codes,omitempty"`
- DuplicateCodes []string `json:"duplicate_codes,omitempty"`
- InvalidCodes []string `json:"invalid_codes,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CreatedCodes []string `json:"created_codes,omitempty"`
+ DuplicateCodes []string `json:"duplicate_codes,omitempty"`
+ InvalidCodes []string `json:"invalid_codes,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CouponSubcodesResponse.
@@ -22,13 +22,17 @@ type CouponSubcodesResponse struct {
func (c CouponSubcodesResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "created_codes", "duplicate_codes", "invalid_codes"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CouponSubcodesResponse object to a map representation for JSON marshaling.
func (c CouponSubcodesResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.CreatedCodes != nil {
structMap["created_codes"] = c.CreatedCodes
}
@@ -49,12 +53,12 @@ func (c *CouponSubcodesResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "created_codes", "duplicate_codes", "invalid_codes")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "created_codes", "duplicate_codes", "invalid_codes")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.CreatedCodes = temp.CreatedCodes
c.DuplicateCodes = temp.DuplicateCodes
c.InvalidCodes = temp.InvalidCodes
diff --git a/models/coupon_usage.go b/models/coupon_usage.go
index 709e3fb4..e459f557 100644
--- a/models/coupon_usage.go
+++ b/models/coupon_usage.go
@@ -12,20 +12,20 @@ import (
// CouponUsage represents a CouponUsage struct.
type CouponUsage struct {
// The Chargify id of the product
- Id *int `json:"id,omitempty"`
+ Id *int `json:"id,omitempty"`
// Name of the product
- Name *string `json:"name,omitempty"`
+ Name *string `json:"name,omitempty"`
// Number of times the coupon has been applied
- Signups *int `json:"signups,omitempty"`
+ Signups *int `json:"signups,omitempty"`
// Dollar amount of customer savings as a result of the coupon.
- Savings Optional[int] `json:"savings"`
+ Savings Optional[int] `json:"savings"`
// Dollar amount of customer savings as a result of the coupon.
- SavingsInCents Optional[int64] `json:"savings_in_cents"`
+ SavingsInCents Optional[int64] `json:"savings_in_cents"`
// Total revenue of the all subscriptions that have received a discount from this coupon.
- Revenue Optional[int] `json:"revenue"`
+ Revenue Optional[int] `json:"revenue"`
// Total revenue of the all subscriptions that have received a discount from this coupon.
- RevenueInCents *int64 `json:"revenue_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ RevenueInCents *int64 `json:"revenue_in_cents,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CouponUsage.
@@ -33,13 +33,17 @@ type CouponUsage struct {
func (c CouponUsage) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "name", "signups", "savings", "savings_in_cents", "revenue", "revenue_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CouponUsage object to a map representation for JSON marshaling.
func (c CouponUsage) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Id != nil {
structMap["id"] = c.Id
}
@@ -84,12 +88,12 @@ func (c *CouponUsage) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "name", "signups", "savings", "savings_in_cents", "revenue", "revenue_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "name", "signups", "savings", "savings_in_cents", "revenue", "revenue_in_cents")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = temp.Id
c.Name = temp.Name
c.Signups = temp.Signups
diff --git a/models/create_allocation.go b/models/create_allocation.go
index bf24fbdf..4d5da4e4 100644
--- a/models/create_allocation.go
+++ b/models/create_allocation.go
@@ -38,7 +38,7 @@ type CreateAllocation struct {
PricePointId Optional[CreateAllocationPricePointId] `json:"price_point_id"`
// This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled
BillingSchedule *BillingSchedule `json:"billing_schedule,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateAllocation.
@@ -46,13 +46,17 @@ type CreateAllocation struct {
func (c CreateAllocation) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "quantity", "component_id", "memo", "proration_downgrade_scheme", "proration_upgrade_scheme", "accrue_charge", "downgrade_credit", "upgrade_charge", "initiate_dunning", "price_point_id", "billing_schedule"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateAllocation object to a map representation for JSON marshaling.
func (c CreateAllocation) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["quantity"] = c.Quantity
if c.ComponentId != nil {
structMap["component_id"] = c.ComponentId
@@ -111,12 +115,12 @@ func (c *CreateAllocation) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "quantity", "component_id", "memo", "proration_downgrade_scheme", "proration_upgrade_scheme", "accrue_charge", "downgrade_credit", "upgrade_charge", "initiate_dunning", "price_point_id", "billing_schedule")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "quantity", "component_id", "memo", "proration_downgrade_scheme", "proration_upgrade_scheme", "accrue_charge", "downgrade_credit", "upgrade_charge", "initiate_dunning", "price_point_id", "billing_schedule")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Quantity = *temp.Quantity
c.ComponentId = temp.ComponentId
c.Memo = temp.Memo
diff --git a/models/create_allocation_request.go b/models/create_allocation_request.go
index bcb2cb3a..dfb06c60 100644
--- a/models/create_allocation_request.go
+++ b/models/create_allocation_request.go
@@ -13,8 +13,8 @@ import (
// CreateAllocationRequest represents a CreateAllocationRequest struct.
type CreateAllocationRequest struct {
- Allocation CreateAllocation `json:"allocation"`
- AdditionalProperties map[string]any `json:"_"`
+ Allocation CreateAllocation `json:"allocation"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateAllocationRequest.
@@ -22,13 +22,17 @@ type CreateAllocationRequest struct {
func (c CreateAllocationRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "allocation"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateAllocationRequest object to a map representation for JSON marshaling.
func (c CreateAllocationRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["allocation"] = c.Allocation.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateAllocationRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "allocation")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "allocation")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Allocation = *temp.Allocation
return nil
}
diff --git a/models/create_component_price_point.go b/models/create_component_price_point.go
index 7dbd1a11..c2e88c16 100644
--- a/models/create_component_price_point.go
+++ b/models/create_component_price_point.go
@@ -18,15 +18,15 @@ type CreateComponentPricePoint struct {
// 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"`
Prices []Price `json:"prices"`
- // 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.
+ // 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. Setting not supported when creating price points in bulk.
UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
- // Whether or not the price point includes tax
+ // Whether or not the price point includes tax. Setting not supported when creating price points in bulk.
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.
IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateComponentPricePoint.
@@ -34,13 +34,17 @@ type CreateComponentPricePoint struct {
func (c CreateComponentPricePoint) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "name", "handle", "pricing_scheme", "prices", "use_site_exchange_rate", "tax_included", "interval", "interval_unit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateComponentPricePoint object to a map representation for JSON marshaling.
func (c CreateComponentPricePoint) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["name"] = c.Name
if c.Handle != nil {
structMap["handle"] = c.Handle
@@ -78,12 +82,12 @@ func (c *CreateComponentPricePoint) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "handle", "pricing_scheme", "prices", "use_site_exchange_rate", "tax_included", "interval", "interval_unit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "handle", "pricing_scheme", "prices", "use_site_exchange_rate", "tax_included", "interval", "interval_unit")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Name = *temp.Name
c.Handle = temp.Handle
c.PricingScheme = *temp.PricingScheme
diff --git a/models/create_component_price_point_request.go b/models/create_component_price_point_request.go
index f5db99b2..d0ae63b0 100644
--- a/models/create_component_price_point_request.go
+++ b/models/create_component_price_point_request.go
@@ -14,7 +14,7 @@ import (
// CreateComponentPricePointRequest represents a CreateComponentPricePointRequest struct.
type CreateComponentPricePointRequest struct {
PricePoint CreateComponentPricePointRequestPricePoint `json:"price_point"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateComponentPricePointRequest.
@@ -22,13 +22,17 @@ type CreateComponentPricePointRequest struct {
func (c CreateComponentPricePointRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "price_point"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateComponentPricePointRequest object to a map representation for JSON marshaling.
func (c CreateComponentPricePointRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["price_point"] = c.PricePoint.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateComponentPricePointRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_point")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_point")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.PricePoint = *temp.PricePoint
return nil
}
diff --git a/models/create_component_price_points_request.go b/models/create_component_price_points_request.go
index f3a1a79d..a8f86b54 100644
--- a/models/create_component_price_points_request.go
+++ b/models/create_component_price_points_request.go
@@ -14,7 +14,7 @@ import (
// CreateComponentPricePointsRequest represents a CreateComponentPricePointsRequest struct.
type CreateComponentPricePointsRequest struct {
PricePoints []CreateComponentPricePointsRequestPricePoints `json:"price_points"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateComponentPricePointsRequest.
@@ -22,13 +22,17 @@ type CreateComponentPricePointsRequest struct {
func (c CreateComponentPricePointsRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "price_points"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateComponentPricePointsRequest object to a map representation for JSON marshaling.
func (c CreateComponentPricePointsRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["price_points"] = c.PricePoints
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateComponentPricePointsRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_points")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_points")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.PricePoints = *temp.PricePoints
return nil
}
diff --git a/models/create_credit_note_event.go b/models/create_credit_note_event.go
index 577c1ff1..3ee02332 100644
--- a/models/create_credit_note_event.go
+++ b/models/create_credit_note_event.go
@@ -15,13 +15,13 @@ import (
// CreateCreditNoteEvent represents a CreateCreditNoteEvent struct.
type CreateCreditNoteEvent struct {
- Id int64 `json:"id"`
- Timestamp time.Time `json:"timestamp"`
- Invoice Invoice `json:"invoice"`
- EventType InvoiceEventType `json:"event_type"`
+ Id int64 `json:"id"`
+ Timestamp time.Time `json:"timestamp"`
+ Invoice Invoice `json:"invoice"`
+ EventType InvoiceEventType `json:"event_type"`
// Example schema for an `create_credit_note` event
- EventData CreditNote `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ EventData CreditNote `json:"event_data"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateCreditNoteEvent.
@@ -29,13 +29,17 @@ type CreateCreditNoteEvent struct {
func (c CreateCreditNoteEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateCreditNoteEvent object to a map representation for JSON marshaling.
func (c CreateCreditNoteEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["id"] = c.Id
structMap["timestamp"] = c.Timestamp.Format(time.RFC3339)
structMap["invoice"] = c.Invoice.toMap()
@@ -56,12 +60,12 @@ func (c *CreateCreditNoteEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/create_currency_price.go b/models/create_currency_price.go
index afe8d61a..81a66916 100644
--- a/models/create_currency_price.go
+++ b/models/create_currency_price.go
@@ -12,12 +12,12 @@ import (
// CreateCurrencyPrice represents a CreateCurrencyPrice struct.
type CreateCurrencyPrice struct {
// ISO code for a currency defined on the site level
- Currency *string `json:"currency,omitempty"`
+ Currency *string `json:"currency,omitempty"`
// Price for the price level in this currency
- Price *float64 `json:"price,omitempty"`
+ Price *float64 `json:"price,omitempty"`
// ID of the price that this corresponds with
- PriceId *int `json:"price_id,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PriceId *int `json:"price_id,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateCurrencyPrice.
@@ -25,13 +25,17 @@ type CreateCurrencyPrice struct {
func (c CreateCurrencyPrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "currency", "price", "price_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateCurrencyPrice object to a map representation for JSON marshaling.
func (c CreateCurrencyPrice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Currency != nil {
structMap["currency"] = c.Currency
}
@@ -52,12 +56,12 @@ func (c *CreateCurrencyPrice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currency", "price", "price_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currency", "price", "price_id")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Currency = temp.Currency
c.Price = temp.Price
c.PriceId = temp.PriceId
diff --git a/models/create_currency_prices_request.go b/models/create_currency_prices_request.go
index 8e1af897..ca4e5f8d 100644
--- a/models/create_currency_prices_request.go
+++ b/models/create_currency_prices_request.go
@@ -13,8 +13,8 @@ import (
// CreateCurrencyPricesRequest represents a CreateCurrencyPricesRequest struct.
type CreateCurrencyPricesRequest struct {
- CurrencyPrices []CreateCurrencyPrice `json:"currency_prices"`
- AdditionalProperties map[string]any `json:"_"`
+ CurrencyPrices []CreateCurrencyPrice `json:"currency_prices"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateCurrencyPricesRequest.
@@ -22,13 +22,17 @@ type CreateCurrencyPricesRequest struct {
func (c CreateCurrencyPricesRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "currency_prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateCurrencyPricesRequest object to a map representation for JSON marshaling.
func (c CreateCurrencyPricesRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["currency_prices"] = c.CurrencyPrices
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateCurrencyPricesRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currency_prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currency_prices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.CurrencyPrices = *temp.CurrencyPrices
return nil
}
diff --git a/models/create_customer.go b/models/create_customer.go
index b1012f8c..f626090f 100644
--- a/models/create_customer.go
+++ b/models/create_customer.go
@@ -13,29 +13,29 @@ import (
// CreateCustomer represents a CreateCustomer struct.
type CreateCustomer struct {
- FirstName string `json:"first_name"`
- LastName string `json:"last_name"`
- Email string `json:"email"`
- CcEmails *string `json:"cc_emails,omitempty"`
- Organization *string `json:"organization,omitempty"`
- Reference *string `json:"reference,omitempty"`
- Address *string `json:"address,omitempty"`
- Address2 *string `json:"address_2,omitempty"`
- City *string `json:"city,omitempty"`
- State *string `json:"state,omitempty"`
- Zip *string `json:"zip,omitempty"`
- Country *string `json:"country,omitempty"`
- Phone *string `json:"phone,omitempty"`
+ FirstName string `json:"first_name"`
+ LastName string `json:"last_name"`
+ Email string `json:"email"`
+ CcEmails *string `json:"cc_emails,omitempty"`
+ Organization *string `json:"organization,omitempty"`
+ Reference *string `json:"reference,omitempty"`
+ Address *string `json:"address,omitempty"`
+ Address2 *string `json:"address_2,omitempty"`
+ City *string `json:"city,omitempty"`
+ State *string `json:"state,omitempty"`
+ Zip *string `json:"zip,omitempty"`
+ Country *string `json:"country,omitempty"`
+ Phone *string `json:"phone,omitempty"`
// Set a specific language on a customer record.
- Locale *string `json:"locale,omitempty"`
- VatNumber *string `json:"vat_number,omitempty"`
- TaxExempt *bool `json:"tax_exempt,omitempty"`
- TaxExemptReason *string `json:"tax_exempt_reason,omitempty"`
+ Locale *string `json:"locale,omitempty"`
+ VatNumber *string `json:"vat_number,omitempty"`
+ TaxExempt *bool `json:"tax_exempt,omitempty"`
+ TaxExemptReason *string `json:"tax_exempt_reason,omitempty"`
// The parent ID in Chargify if applicable. Parent is another Customer object.
- ParentId Optional[int] `json:"parent_id"`
+ ParentId Optional[int] `json:"parent_id"`
// The Salesforce ID of the customer
- SalesforceId Optional[string] `json:"salesforce_id"`
- AdditionalProperties map[string]any `json:"_"`
+ SalesforceId Optional[string] `json:"salesforce_id"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateCustomer.
@@ -43,13 +43,17 @@ type CreateCustomer struct {
func (c CreateCustomer) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "locale", "vat_number", "tax_exempt", "tax_exempt_reason", "parent_id", "salesforce_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateCustomer object to a map representation for JSON marshaling.
func (c CreateCustomer) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["first_name"] = c.FirstName
structMap["last_name"] = c.LastName
structMap["email"] = c.Email
@@ -124,12 +128,12 @@ func (c *CreateCustomer) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "locale", "vat_number", "tax_exempt", "tax_exempt_reason", "parent_id", "salesforce_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "locale", "vat_number", "tax_exempt", "tax_exempt_reason", "parent_id", "salesforce_id")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.FirstName = *temp.FirstName
c.LastName = *temp.LastName
c.Email = *temp.Email
diff --git a/models/create_customer_request.go b/models/create_customer_request.go
index 68ae6f2e..c22a4f66 100644
--- a/models/create_customer_request.go
+++ b/models/create_customer_request.go
@@ -13,8 +13,8 @@ import (
// CreateCustomerRequest represents a CreateCustomerRequest struct.
type CreateCustomerRequest struct {
- Customer CreateCustomer `json:"customer"`
- AdditionalProperties map[string]any `json:"_"`
+ Customer CreateCustomer `json:"customer"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateCustomerRequest.
@@ -22,13 +22,17 @@ type CreateCustomerRequest struct {
func (c CreateCustomerRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "customer"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateCustomerRequest object to a map representation for JSON marshaling.
func (c CreateCustomerRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["customer"] = c.Customer.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateCustomerRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "customer")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "customer")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Customer = *temp.Customer
return nil
}
diff --git a/models/create_debit_note_event.go b/models/create_debit_note_event.go
index 316c7dfd..1dd84c52 100644
--- a/models/create_debit_note_event.go
+++ b/models/create_debit_note_event.go
@@ -15,13 +15,13 @@ import (
// CreateDebitNoteEvent represents a CreateDebitNoteEvent struct.
type CreateDebitNoteEvent struct {
- Id int64 `json:"id"`
- Timestamp time.Time `json:"timestamp"`
- Invoice Invoice `json:"invoice"`
- EventType InvoiceEventType `json:"event_type"`
+ Id int64 `json:"id"`
+ Timestamp time.Time `json:"timestamp"`
+ Invoice Invoice `json:"invoice"`
+ EventType InvoiceEventType `json:"event_type"`
// Example schema for an `create_debit_note` event
- EventData DebitNote `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ EventData DebitNote `json:"event_data"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateDebitNoteEvent.
@@ -29,13 +29,17 @@ type CreateDebitNoteEvent struct {
func (c CreateDebitNoteEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateDebitNoteEvent object to a map representation for JSON marshaling.
func (c CreateDebitNoteEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["id"] = c.Id
structMap["timestamp"] = c.Timestamp.Format(time.RFC3339)
structMap["invoice"] = c.Invoice.toMap()
@@ -56,12 +60,12 @@ func (c *CreateDebitNoteEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/create_ebb_component.go b/models/create_ebb_component.go
index 9704cb24..f50efc98 100644
--- a/models/create_ebb_component.go
+++ b/models/create_ebb_component.go
@@ -13,8 +13,8 @@ import (
// CreateEBBComponent represents a CreateEBBComponent struct.
type CreateEBBComponent struct {
- EventBasedComponent EBBComponent `json:"event_based_component"`
- AdditionalProperties map[string]any `json:"_"`
+ EventBasedComponent EBBComponent `json:"event_based_component"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateEBBComponent.
@@ -22,13 +22,17 @@ type CreateEBBComponent struct {
func (c CreateEBBComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "event_based_component"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateEBBComponent object to a map representation for JSON marshaling.
func (c CreateEBBComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["event_based_component"] = c.EventBasedComponent.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateEBBComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "event_based_component")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "event_based_component")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.EventBasedComponent = *temp.EventBasedComponent
return nil
}
diff --git a/models/create_invoice.go b/models/create_invoice.go
index 60f844a0..580a9676 100644
--- a/models/create_invoice.go
+++ b/models/create_invoice.go
@@ -13,22 +13,22 @@ import (
// CreateInvoice represents a CreateInvoice struct.
type CreateInvoice struct {
- LineItems []CreateInvoiceItem `json:"line_items,omitempty"`
- IssueDate *time.Time `json:"issue_date,omitempty"`
+ LineItems []CreateInvoiceItem `json:"line_items,omitempty"`
+ IssueDate *time.Time `json:"issue_date,omitempty"`
// By default, invoices will be created with a due date matching the date of invoice creation. If a different due date is desired, the net_terms parameter can be sent indicating the number of days in advance the due date should be.
- NetTerms *int `json:"net_terms,omitempty"`
- PaymentInstructions *string `json:"payment_instructions,omitempty"`
+ NetTerms *int `json:"net_terms,omitempty"`
+ PaymentInstructions *string `json:"payment_instructions,omitempty"`
// A custom memo can be sent to override the site's default.
- Memo *string `json:"memo,omitempty"`
+ Memo *string `json:"memo,omitempty"`
// Overrides the defaults for the site
- SellerAddress *CreateInvoiceAddress `json:"seller_address,omitempty"`
+ SellerAddress *CreateInvoiceAddress `json:"seller_address,omitempty"`
// Overrides the default for the customer
- BillingAddress *CreateInvoiceAddress `json:"billing_address,omitempty"`
+ BillingAddress *CreateInvoiceAddress `json:"billing_address,omitempty"`
// Overrides the default for the customer
- ShippingAddress *CreateInvoiceAddress `json:"shipping_address,omitempty"`
- Coupons []CreateInvoiceCoupon `json:"coupons,omitempty"`
- Status *CreateInvoiceStatus `json:"status,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ShippingAddress *CreateInvoiceAddress `json:"shipping_address,omitempty"`
+ Coupons []CreateInvoiceCoupon `json:"coupons,omitempty"`
+ Status *CreateInvoiceStatus `json:"status,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateInvoice.
@@ -36,13 +36,17 @@ type CreateInvoice struct {
func (c CreateInvoice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "line_items", "issue_date", "net_terms", "payment_instructions", "memo", "seller_address", "billing_address", "shipping_address", "coupons", "status"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateInvoice object to a map representation for JSON marshaling.
func (c CreateInvoice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.LineItems != nil {
structMap["line_items"] = c.LineItems
}
@@ -84,12 +88,12 @@ func (c *CreateInvoice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "line_items", "issue_date", "net_terms", "payment_instructions", "memo", "seller_address", "billing_address", "shipping_address", "coupons", "status")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "line_items", "issue_date", "net_terms", "payment_instructions", "memo", "seller_address", "billing_address", "shipping_address", "coupons", "status")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.LineItems = temp.LineItems
if temp.IssueDate != nil {
IssueDateVal, err := time.Parse(DEFAULT_DATE, *temp.IssueDate)
diff --git a/models/create_invoice_address.go b/models/create_invoice_address.go
index ba387b18..be550f40 100644
--- a/models/create_invoice_address.go
+++ b/models/create_invoice_address.go
@@ -12,16 +12,16 @@ import (
// CreateInvoiceAddress represents a CreateInvoiceAddress struct.
// Overrides the default address.
type CreateInvoiceAddress struct {
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- Phone *string `json:"phone,omitempty"`
- Address *string `json:"address,omitempty"`
- Address2 *string `json:"address_2,omitempty"`
- City *string `json:"city,omitempty"`
- State *string `json:"state,omitempty"`
- Zip *string `json:"zip,omitempty"`
- Country *string `json:"country,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ FirstName *string `json:"first_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
+ Phone *string `json:"phone,omitempty"`
+ Address *string `json:"address,omitempty"`
+ Address2 *string `json:"address_2,omitempty"`
+ City *string `json:"city,omitempty"`
+ State *string `json:"state,omitempty"`
+ Zip *string `json:"zip,omitempty"`
+ Country *string `json:"country,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateInvoiceAddress.
@@ -29,13 +29,17 @@ type CreateInvoiceAddress struct {
func (c CreateInvoiceAddress) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "first_name", "last_name", "phone", "address", "address_2", "city", "state", "zip", "country"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateInvoiceAddress object to a map representation for JSON marshaling.
func (c CreateInvoiceAddress) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.FirstName != nil {
structMap["first_name"] = c.FirstName
}
@@ -74,12 +78,12 @@ func (c *CreateInvoiceAddress) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "first_name", "last_name", "phone", "address", "address_2", "city", "state", "zip", "country")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "first_name", "last_name", "phone", "address", "address_2", "city", "state", "zip", "country")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.FirstName = temp.FirstName
c.LastName = temp.LastName
c.Phone = temp.Phone
diff --git a/models/create_invoice_coupon.go b/models/create_invoice_coupon.go
index 73c467d5..76998f33 100644
--- a/models/create_invoice_coupon.go
+++ b/models/create_invoice_coupon.go
@@ -16,8 +16,9 @@ type CreateInvoiceCoupon struct {
Amount *CreateInvoiceCouponAmount `json:"amount,omitempty"`
Description *string `json:"description,omitempty"`
ProductFamilyId *CreateInvoiceCouponProductFamilyId `json:"product_family_id,omitempty"`
+ // Applicable only to stackable coupons. For `compound`, Percentage-based discounts will be calculated against the remaining price, after prior discounts have been calculated. For `full-price`, Percentage-based discounts will always be calculated against the original item price, before other discounts are applied.
CompoundingStrategy *CompoundingStrategy `json:"compounding_strategy,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateInvoiceCoupon.
@@ -25,13 +26,17 @@ type CreateInvoiceCoupon struct {
func (c CreateInvoiceCoupon) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "code", "percentage", "amount", "description", "product_family_id", "compounding_strategy"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateInvoiceCoupon object to a map representation for JSON marshaling.
func (c CreateInvoiceCoupon) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Code != nil {
structMap["code"] = c.Code
}
@@ -61,12 +66,12 @@ func (c *CreateInvoiceCoupon) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "code", "percentage", "amount", "description", "product_family_id", "compounding_strategy")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "code", "percentage", "amount", "description", "product_family_id", "compounding_strategy")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Code = temp.Code
c.Percentage = temp.Percentage
c.Amount = temp.Amount
diff --git a/models/create_invoice_item.go b/models/create_invoice_item.go
index 20505ca8..74ebb66a 100644
--- a/models/create_invoice_item.go
+++ b/models/create_invoice_item.go
@@ -32,7 +32,7 @@ type CreateInvoiceItem struct {
PricePointId *CreateInvoiceItemPricePointId `json:"price_point_id,omitempty"`
ProductPricePointId *CreateInvoiceItemProductPricePointId `json:"product_price_point_id,omitempty"`
Description *string `json:"description,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateInvoiceItem.
@@ -40,13 +40,17 @@ type CreateInvoiceItem struct {
func (c CreateInvoiceItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "title", "quantity", "unit_price", "taxable", "tax_code", "period_range_start", "period_range_end", "product_id", "component_id", "price_point_id", "product_price_point_id", "description"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateInvoiceItem object to a map representation for JSON marshaling.
func (c CreateInvoiceItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Title != nil {
structMap["title"] = c.Title
}
@@ -94,12 +98,12 @@ func (c *CreateInvoiceItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "title", "quantity", "unit_price", "taxable", "tax_code", "period_range_start", "period_range_end", "product_id", "component_id", "price_point_id", "product_price_point_id", "description")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "title", "quantity", "unit_price", "taxable", "tax_code", "period_range_start", "period_range_end", "product_id", "component_id", "price_point_id", "product_price_point_id", "description")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Title = temp.Title
c.Quantity = temp.Quantity
c.UnitPrice = temp.UnitPrice
diff --git a/models/create_invoice_payment.go b/models/create_invoice_payment.go
index bfcf2d02..4a48d3a3 100644
--- a/models/create_invoice_payment.go
+++ b/models/create_invoice_payment.go
@@ -26,7 +26,7 @@ type CreateInvoicePayment struct {
// Date reflecting when the payment was received from a customer. Must be in the past. Applicable only to
// `external` payments.
ReceivedOn *time.Time `json:"received_on,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateInvoicePayment.
@@ -34,13 +34,17 @@ type CreateInvoicePayment struct {
func (c CreateInvoicePayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "amount", "memo", "method", "details", "payment_profile_id", "received_on"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateInvoicePayment object to a map representation for JSON marshaling.
func (c CreateInvoicePayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Amount != nil {
structMap["amount"] = c.Amount.toMap()
}
@@ -70,12 +74,12 @@ func (c *CreateInvoicePayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "amount", "memo", "method", "details", "payment_profile_id", "received_on")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "amount", "memo", "method", "details", "payment_profile_id", "received_on")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Amount = temp.Amount
c.Memo = temp.Memo
c.Method = temp.Method
diff --git a/models/create_invoice_payment_application.go b/models/create_invoice_payment_application.go
index d0aa618b..b5405a84 100644
--- a/models/create_invoice_payment_application.go
+++ b/models/create_invoice_payment_application.go
@@ -14,10 +14,10 @@ import (
// CreateInvoicePaymentApplication represents a CreateInvoicePaymentApplication struct.
type CreateInvoicePaymentApplication struct {
// Unique identifier for the invoice. It has the prefix "inv_" followed by alphanumeric characters.
- InvoiceUid string `json:"invoice_uid"`
+ InvoiceUid string `json:"invoice_uid"`
// Dollar amount of the invoice payment (eg. "10.50" => $10.50).
- Amount string `json:"amount"`
- AdditionalProperties map[string]any `json:"_"`
+ Amount string `json:"amount"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateInvoicePaymentApplication.
@@ -25,13 +25,17 @@ type CreateInvoicePaymentApplication struct {
func (c CreateInvoicePaymentApplication) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "invoice_uid", "amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateInvoicePaymentApplication object to a map representation for JSON marshaling.
func (c CreateInvoicePaymentApplication) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["invoice_uid"] = c.InvoiceUid
structMap["amount"] = c.Amount
return structMap
@@ -49,12 +53,12 @@ func (c *CreateInvoicePaymentApplication) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "invoice_uid", "amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "invoice_uid", "amount")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.InvoiceUid = *temp.InvoiceUid
c.Amount = *temp.Amount
return nil
diff --git a/models/create_invoice_payment_request.go b/models/create_invoice_payment_request.go
index 3a75d655..75b67300 100644
--- a/models/create_invoice_payment_request.go
+++ b/models/create_invoice_payment_request.go
@@ -13,10 +13,10 @@ import (
// CreateInvoicePaymentRequest represents a CreateInvoicePaymentRequest struct.
type CreateInvoicePaymentRequest struct {
- Payment CreateInvoicePayment `json:"payment"`
+ Payment CreateInvoicePayment `json:"payment"`
// The type of payment to be applied to an Invoice. Defaults to external.
- Type *InvoicePaymentType `json:"type,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Type *InvoicePaymentType `json:"type,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateInvoicePaymentRequest.
@@ -24,13 +24,17 @@ type CreateInvoicePaymentRequest struct {
func (c CreateInvoicePaymentRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "payment", "type"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateInvoicePaymentRequest object to a map representation for JSON marshaling.
func (c CreateInvoicePaymentRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["payment"] = c.Payment.toMap()
if c.Type != nil {
structMap["type"] = c.Type
@@ -50,12 +54,12 @@ func (c *CreateInvoicePaymentRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payment", "type")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payment", "type")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Payment = *temp.Payment
c.Type = temp.Type
return nil
diff --git a/models/create_invoice_request.go b/models/create_invoice_request.go
index 20707aa8..cfa946f4 100644
--- a/models/create_invoice_request.go
+++ b/models/create_invoice_request.go
@@ -13,8 +13,8 @@ import (
// CreateInvoiceRequest represents a CreateInvoiceRequest struct.
type CreateInvoiceRequest struct {
- Invoice CreateInvoice `json:"invoice"`
- AdditionalProperties map[string]any `json:"_"`
+ Invoice CreateInvoice `json:"invoice"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateInvoiceRequest.
@@ -22,13 +22,17 @@ type CreateInvoiceRequest struct {
func (c CreateInvoiceRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "invoice"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateInvoiceRequest object to a map representation for JSON marshaling.
func (c CreateInvoiceRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["invoice"] = c.Invoice.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateInvoiceRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "invoice")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "invoice")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Invoice = *temp.Invoice
return nil
}
diff --git a/models/create_metadata.go b/models/create_metadata.go
index a0f25477..9e86d586 100644
--- a/models/create_metadata.go
+++ b/models/create_metadata.go
@@ -11,9 +11,9 @@ import (
// CreateMetadata represents a CreateMetadata struct.
type CreateMetadata struct {
- Name *string `json:"name,omitempty"`
- Value *string `json:"value,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Name *string `json:"name,omitempty"`
+ Value *string `json:"value,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateMetadata.
@@ -21,13 +21,17 @@ type CreateMetadata struct {
func (c CreateMetadata) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "name", "value"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateMetadata object to a map representation for JSON marshaling.
func (c CreateMetadata) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Name != nil {
structMap["name"] = c.Name
}
@@ -45,12 +49,12 @@ func (c *CreateMetadata) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "value")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "value")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Name = temp.Name
c.Value = temp.Value
return nil
diff --git a/models/create_metadata_request.go b/models/create_metadata_request.go
index b1a4a11a..56d6c322 100644
--- a/models/create_metadata_request.go
+++ b/models/create_metadata_request.go
@@ -13,8 +13,8 @@ import (
// CreateMetadataRequest represents a CreateMetadataRequest struct.
type CreateMetadataRequest struct {
- Metadata []CreateMetadata `json:"metadata"`
- AdditionalProperties map[string]any `json:"_"`
+ Metadata []CreateMetadata `json:"metadata"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateMetadataRequest.
@@ -22,13 +22,17 @@ type CreateMetadataRequest struct {
func (c CreateMetadataRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "metadata"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateMetadataRequest object to a map representation for JSON marshaling.
func (c CreateMetadataRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["metadata"] = c.Metadata
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateMetadataRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "metadata")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "metadata")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Metadata = *temp.Metadata
return nil
}
diff --git a/models/create_metafield.go b/models/create_metafield.go
index 14cc4d5e..52b2562d 100644
--- a/models/create_metafield.go
+++ b/models/create_metafield.go
@@ -11,14 +11,14 @@ import (
// CreateMetafield represents a CreateMetafield struct.
type CreateMetafield struct {
- Name *string `json:"name,omitempty"`
+ Name *string `json:"name,omitempty"`
// Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings.
- Scope *MetafieldScope `json:"scope,omitempty"`
+ Scope *MetafieldScope `json:"scope,omitempty"`
// Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text'
- InputType *MetafieldInput `json:"input_type,omitempty"`
+ InputType *MetafieldInput `json:"input_type,omitempty"`
// Only applicable when input_type is radio or dropdown. Empty strings will not be submitted.
- Enum []string `json:"enum,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Enum []string `json:"enum,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateMetafield.
@@ -26,13 +26,17 @@ type CreateMetafield struct {
func (c CreateMetafield) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "name", "scope", "input_type", "enum"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateMetafield object to a map representation for JSON marshaling.
func (c CreateMetafield) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Name != nil {
structMap["name"] = c.Name
}
@@ -56,12 +60,12 @@ func (c *CreateMetafield) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "scope", "input_type", "enum")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "scope", "input_type", "enum")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Name = temp.Name
c.Scope = temp.Scope
c.InputType = temp.InputType
diff --git a/models/create_metafields_request.go b/models/create_metafields_request.go
index 47136cef..73f02ec9 100644
--- a/models/create_metafields_request.go
+++ b/models/create_metafields_request.go
@@ -14,7 +14,7 @@ import (
// CreateMetafieldsRequest represents a CreateMetafieldsRequest struct.
type CreateMetafieldsRequest struct {
Metafields CreateMetafieldsRequestMetafields `json:"metafields"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateMetafieldsRequest.
@@ -22,13 +22,17 @@ type CreateMetafieldsRequest struct {
func (c CreateMetafieldsRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "metafields"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateMetafieldsRequest object to a map representation for JSON marshaling.
func (c CreateMetafieldsRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["metafields"] = c.Metafields.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateMetafieldsRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "metafields")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "metafields")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Metafields = *temp.Metafields
return nil
}
diff --git a/models/create_metered_component.go b/models/create_metered_component.go
index b0245b4d..bc50bc41 100644
--- a/models/create_metered_component.go
+++ b/models/create_metered_component.go
@@ -13,8 +13,8 @@ import (
// CreateMeteredComponent represents a CreateMeteredComponent struct.
type CreateMeteredComponent struct {
- MeteredComponent MeteredComponent `json:"metered_component"`
- AdditionalProperties map[string]any `json:"_"`
+ MeteredComponent MeteredComponent `json:"metered_component"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateMeteredComponent.
@@ -22,13 +22,17 @@ type CreateMeteredComponent struct {
func (c CreateMeteredComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "metered_component"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateMeteredComponent object to a map representation for JSON marshaling.
func (c CreateMeteredComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["metered_component"] = c.MeteredComponent.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateMeteredComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "metered_component")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "metered_component")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.MeteredComponent = *temp.MeteredComponent
return nil
}
diff --git a/models/create_multi_invoice_payment.go b/models/create_multi_invoice_payment.go
index e701277d..dfac31c8 100644
--- a/models/create_multi_invoice_payment.go
+++ b/models/create_multi_invoice_payment.go
@@ -24,7 +24,7 @@ type CreateMultiInvoicePayment struct {
// Date reflecting when the payment was received from a customer. Must be in the past.
ReceivedOn *string `json:"received_on,omitempty"`
Applications []CreateInvoicePaymentApplication `json:"applications"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateMultiInvoicePayment.
@@ -32,13 +32,17 @@ type CreateMultiInvoicePayment struct {
func (c CreateMultiInvoicePayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "memo", "details", "method", "amount", "received_on", "applications"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateMultiInvoicePayment object to a map representation for JSON marshaling.
func (c CreateMultiInvoicePayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Memo != nil {
structMap["memo"] = c.Memo
}
@@ -68,12 +72,12 @@ func (c *CreateMultiInvoicePayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "memo", "details", "method", "amount", "received_on", "applications")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "memo", "details", "method", "amount", "received_on", "applications")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Memo = temp.Memo
c.Details = temp.Details
c.Method = temp.Method
diff --git a/models/create_multi_invoice_payment_request.go b/models/create_multi_invoice_payment_request.go
index 7e25a7f8..6cd80d53 100644
--- a/models/create_multi_invoice_payment_request.go
+++ b/models/create_multi_invoice_payment_request.go
@@ -14,7 +14,7 @@ import (
// CreateMultiInvoicePaymentRequest represents a CreateMultiInvoicePaymentRequest struct.
type CreateMultiInvoicePaymentRequest struct {
Payment CreateMultiInvoicePayment `json:"payment"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateMultiInvoicePaymentRequest.
@@ -22,13 +22,17 @@ type CreateMultiInvoicePaymentRequest struct {
func (c CreateMultiInvoicePaymentRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "payment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateMultiInvoicePaymentRequest object to a map representation for JSON marshaling.
func (c CreateMultiInvoicePaymentRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["payment"] = c.Payment.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateMultiInvoicePaymentRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payment")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Payment = *temp.Payment
return nil
}
diff --git a/models/create_offer.go b/models/create_offer.go
index 33e3740e..bee35bf4 100644
--- a/models/create_offer.go
+++ b/models/create_offer.go
@@ -20,7 +20,7 @@ type CreateOffer struct {
ProductPricePointId *int `json:"product_price_point_id,omitempty"`
Components []CreateOfferComponent `json:"components,omitempty"`
Coupons []string `json:"coupons,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateOffer.
@@ -28,13 +28,17 @@ type CreateOffer struct {
func (c CreateOffer) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "name", "handle", "description", "product_id", "product_price_point_id", "components", "coupons"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateOffer object to a map representation for JSON marshaling.
func (c CreateOffer) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["name"] = c.Name
structMap["handle"] = c.Handle
if c.Description != nil {
@@ -65,12 +69,12 @@ func (c *CreateOffer) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "handle", "description", "product_id", "product_price_point_id", "components", "coupons")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "handle", "description", "product_id", "product_price_point_id", "components", "coupons")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Name = *temp.Name
c.Handle = *temp.Handle
c.Description = temp.Description
diff --git a/models/create_offer_component.go b/models/create_offer_component.go
index 97ab91e8..1fb4e6b3 100644
--- a/models/create_offer_component.go
+++ b/models/create_offer_component.go
@@ -11,10 +11,10 @@ import (
// CreateOfferComponent represents a CreateOfferComponent struct.
type CreateOfferComponent struct {
- ComponentId *int `json:"component_id,omitempty"`
- PricePointId *int `json:"price_point_id,omitempty"`
- StartingQuantity *int `json:"starting_quantity,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ComponentId *int `json:"component_id,omitempty"`
+ PricePointId *int `json:"price_point_id,omitempty"`
+ StartingQuantity *int `json:"starting_quantity,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateOfferComponent.
@@ -22,13 +22,17 @@ type CreateOfferComponent struct {
func (c CreateOfferComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "component_id", "price_point_id", "starting_quantity"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateOfferComponent object to a map representation for JSON marshaling.
func (c CreateOfferComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.ComponentId != nil {
structMap["component_id"] = c.ComponentId
}
@@ -49,12 +53,12 @@ func (c *CreateOfferComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component_id", "price_point_id", "starting_quantity")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component_id", "price_point_id", "starting_quantity")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ComponentId = temp.ComponentId
c.PricePointId = temp.PricePointId
c.StartingQuantity = temp.StartingQuantity
diff --git a/models/create_offer_request.go b/models/create_offer_request.go
index ae4a27e0..098d6779 100644
--- a/models/create_offer_request.go
+++ b/models/create_offer_request.go
@@ -13,8 +13,8 @@ import (
// CreateOfferRequest represents a CreateOfferRequest struct.
type CreateOfferRequest struct {
- Offer CreateOffer `json:"offer"`
- AdditionalProperties map[string]any `json:"_"`
+ Offer CreateOffer `json:"offer"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateOfferRequest.
@@ -22,13 +22,17 @@ type CreateOfferRequest struct {
func (c CreateOfferRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "offer"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateOfferRequest object to a map representation for JSON marshaling.
func (c CreateOfferRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["offer"] = c.Offer.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateOfferRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "offer")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "offer")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Offer = *temp.Offer
return nil
}
diff --git a/models/create_on_off_component.go b/models/create_on_off_component.go
index 1e847f1f..c2b5d1fb 100644
--- a/models/create_on_off_component.go
+++ b/models/create_on_off_component.go
@@ -13,8 +13,8 @@ import (
// CreateOnOffComponent represents a CreateOnOffComponent struct.
type CreateOnOffComponent struct {
- OnOffComponent OnOffComponent `json:"on_off_component"`
- AdditionalProperties map[string]any `json:"_"`
+ OnOffComponent OnOffComponent `json:"on_off_component"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateOnOffComponent.
@@ -22,13 +22,17 @@ type CreateOnOffComponent struct {
func (c CreateOnOffComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "on_off_component"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateOnOffComponent object to a map representation for JSON marshaling.
func (c CreateOnOffComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["on_off_component"] = c.OnOffComponent.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateOnOffComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "on_off_component")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "on_off_component")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.OnOffComponent = *temp.OnOffComponent
return nil
}
diff --git a/models/create_or_update_coupon.go b/models/create_or_update_coupon.go
deleted file mode 100644
index 39349feb..00000000
--- a/models/create_or_update_coupon.go
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-Package advancedbilling
-
-This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
-*/
-package models
-
-import (
- "encoding/json"
-)
-
-// CreateOrUpdateCoupon represents a CreateOrUpdateCoupon struct.
-type CreateOrUpdateCoupon struct {
- Coupon *CreateOrUpdateCouponCoupon `json:"coupon,omitempty"`
- // An object where the keys are product_ids and the values are booleans indicating if the coupon should be applicable to the product
- RestrictedProducts map[string]bool `json:"restricted_products,omitempty"`
- // An object where the keys are component_ids and the values are booleans indicating if the coupon should be applicable to the component
- RestrictedComponents map[string]bool `json:"restricted_components,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for CreateOrUpdateCoupon.
-// It customizes the JSON marshaling process for CreateOrUpdateCoupon objects.
-func (c CreateOrUpdateCoupon) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(c.toMap())
-}
-
-// toMap converts the CreateOrUpdateCoupon object to a map representation for JSON marshaling.
-func (c CreateOrUpdateCoupon) toMap() map[string]any {
- structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
- if c.Coupon != nil {
- structMap["coupon"] = c.Coupon.toMap()
- }
- if c.RestrictedProducts != nil {
- structMap["restricted_products"] = c.RestrictedProducts
- }
- if c.RestrictedComponents != nil {
- structMap["restricted_components"] = c.RestrictedComponents
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for CreateOrUpdateCoupon.
-// It customizes the JSON unmarshaling process for CreateOrUpdateCoupon objects.
-func (c *CreateOrUpdateCoupon) UnmarshalJSON(input []byte) error {
- var temp tempCreateOrUpdateCoupon
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
- additionalProperties, err := UnmarshalAdditionalProperties(input, "coupon", "restricted_products", "restricted_components")
- if err != nil {
- return err
- }
-
- c.AdditionalProperties = additionalProperties
- c.Coupon = temp.Coupon
- c.RestrictedProducts = temp.RestrictedProducts
- c.RestrictedComponents = temp.RestrictedComponents
- return nil
-}
-
-// tempCreateOrUpdateCoupon is a temporary struct used for validating the fields of CreateOrUpdateCoupon.
-type tempCreateOrUpdateCoupon struct {
- Coupon *CreateOrUpdateCouponCoupon `json:"coupon,omitempty"`
- RestrictedProducts map[string]bool `json:"restricted_products,omitempty"`
- RestrictedComponents map[string]bool `json:"restricted_components,omitempty"`
-}
diff --git a/models/create_or_update_coupon_coupon.go b/models/create_or_update_coupon_coupon.go
deleted file mode 100644
index 8daf20aa..00000000
--- a/models/create_or_update_coupon_coupon.go
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-Package advancedbilling
-
-This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
-*/
-package models
-
-import (
- "encoding/json"
- "errors"
- "strings"
-)
-
-// CreateOrUpdateCouponCoupon represents a CreateOrUpdateCouponCoupon struct.
-// This is a container for one-of cases.
-type CreateOrUpdateCouponCoupon struct {
- value any
- isCreateOrUpdatePercentageCoupon bool
- isCreateOrUpdateFlatAmountCoupon bool
-}
-
-// String converts the CreateOrUpdateCouponCoupon object to a string representation.
-func (c CreateOrUpdateCouponCoupon) String() string {
- if bytes, err := json.Marshal(c.value); err == nil {
- return strings.Trim(string(bytes), "\"")
- }
- return ""
-}
-
-// MarshalJSON implements the json.Marshaler interface for CreateOrUpdateCouponCoupon.
-// It customizes the JSON marshaling process for CreateOrUpdateCouponCoupon objects.
-func (c CreateOrUpdateCouponCoupon) MarshalJSON() (
- []byte,
- error) {
- if c.value == nil {
- return nil, errors.New("No underlying type is set. Please use any of the `models.CreateOrUpdateCouponCouponContainer.From*` functions to initialize the CreateOrUpdateCouponCoupon object.")
- }
- return json.Marshal(c.toMap())
-}
-
-// toMap converts the CreateOrUpdateCouponCoupon object to a map representation for JSON marshaling.
-func (c *CreateOrUpdateCouponCoupon) toMap() any {
- switch obj := c.value.(type) {
- case *CreateOrUpdatePercentageCoupon:
- return obj.toMap()
- case *CreateOrUpdateFlatAmountCoupon:
- return obj.toMap()
- }
- return nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for CreateOrUpdateCouponCoupon.
-// It customizes the JSON unmarshaling process for CreateOrUpdateCouponCoupon objects.
-func (c *CreateOrUpdateCouponCoupon) UnmarshalJSON(input []byte) error {
- result, err := UnmarshallOneOf(input,
- NewTypeHolder(&CreateOrUpdatePercentageCoupon{}, false, &c.isCreateOrUpdatePercentageCoupon),
- NewTypeHolder(&CreateOrUpdateFlatAmountCoupon{}, false, &c.isCreateOrUpdateFlatAmountCoupon),
- )
-
- c.value = result
- return err
-}
-
-func (c *CreateOrUpdateCouponCoupon) AsCreateOrUpdatePercentageCoupon() (
- *CreateOrUpdatePercentageCoupon,
- bool) {
- if !c.isCreateOrUpdatePercentageCoupon {
- return nil, false
- }
- return c.value.(*CreateOrUpdatePercentageCoupon), true
-}
-
-func (c *CreateOrUpdateCouponCoupon) AsCreateOrUpdateFlatAmountCoupon() (
- *CreateOrUpdateFlatAmountCoupon,
- bool) {
- if !c.isCreateOrUpdateFlatAmountCoupon {
- return nil, false
- }
- return c.value.(*CreateOrUpdateFlatAmountCoupon), true
-}
-
-// internalCreateOrUpdateCouponCoupon represents a createOrUpdateCouponCoupon struct.
-// This is a container for one-of cases.
-type internalCreateOrUpdateCouponCoupon struct {}
-
-var CreateOrUpdateCouponCouponContainer internalCreateOrUpdateCouponCoupon
-
-// The internalCreateOrUpdateCouponCoupon instance, wrapping the provided CreateOrUpdatePercentageCoupon value.
-func (c *internalCreateOrUpdateCouponCoupon) FromCreateOrUpdatePercentageCoupon(val CreateOrUpdatePercentageCoupon) CreateOrUpdateCouponCoupon {
- return CreateOrUpdateCouponCoupon{value: &val}
-}
-
-// The internalCreateOrUpdateCouponCoupon instance, wrapping the provided CreateOrUpdateFlatAmountCoupon value.
-func (c *internalCreateOrUpdateCouponCoupon) FromCreateOrUpdateFlatAmountCoupon(val CreateOrUpdateFlatAmountCoupon) CreateOrUpdateCouponCoupon {
- return CreateOrUpdateCouponCoupon{value: &val}
-}
diff --git a/models/create_or_update_endpoint.go b/models/create_or_update_endpoint.go
index 9f0d6937..e6b44090 100644
--- a/models/create_or_update_endpoint.go
+++ b/models/create_or_update_endpoint.go
@@ -14,9 +14,9 @@ import (
// CreateOrUpdateEndpoint represents a CreateOrUpdateEndpoint struct.
// Used to Create or Update Endpoint
type CreateOrUpdateEndpoint struct {
- Url string `json:"url"`
- WebhookSubscriptions []WebhookSubscription `json:"webhook_subscriptions"`
- AdditionalProperties map[string]any `json:"_"`
+ Url string `json:"url"`
+ WebhookSubscriptions []WebhookSubscription `json:"webhook_subscriptions"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateOrUpdateEndpoint.
@@ -24,13 +24,17 @@ type CreateOrUpdateEndpoint struct {
func (c CreateOrUpdateEndpoint) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "url", "webhook_subscriptions"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateOrUpdateEndpoint object to a map representation for JSON marshaling.
func (c CreateOrUpdateEndpoint) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["url"] = c.Url
structMap["webhook_subscriptions"] = c.WebhookSubscriptions
return structMap
@@ -48,12 +52,12 @@ func (c *CreateOrUpdateEndpoint) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "url", "webhook_subscriptions")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "url", "webhook_subscriptions")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Url = *temp.Url
c.WebhookSubscriptions = *temp.WebhookSubscriptions
return nil
diff --git a/models/create_or_update_endpoint_request.go b/models/create_or_update_endpoint_request.go
index 444aa6b8..f8eecf5a 100644
--- a/models/create_or_update_endpoint_request.go
+++ b/models/create_or_update_endpoint_request.go
@@ -16,7 +16,7 @@ import (
type CreateOrUpdateEndpointRequest struct {
// Used to Create or Update Endpoint
Endpoint CreateOrUpdateEndpoint `json:"endpoint"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateOrUpdateEndpointRequest.
@@ -24,13 +24,17 @@ type CreateOrUpdateEndpointRequest struct {
func (c CreateOrUpdateEndpointRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "endpoint"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateOrUpdateEndpointRequest object to a map representation for JSON marshaling.
func (c CreateOrUpdateEndpointRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["endpoint"] = c.Endpoint.toMap()
return structMap
}
@@ -47,12 +51,12 @@ func (c *CreateOrUpdateEndpointRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "endpoint")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "endpoint")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Endpoint = *temp.Endpoint
return nil
}
diff --git a/models/create_or_update_flat_amount_coupon.go b/models/create_or_update_flat_amount_coupon.go
deleted file mode 100644
index 251e5d17..00000000
--- a/models/create_or_update_flat_amount_coupon.go
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
-Package advancedbilling
-
-This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
-*/
-package models
-
-import (
- "encoding/json"
- "errors"
- "log"
- "strings"
- "time"
-)
-
-// CreateOrUpdateFlatAmountCoupon represents a CreateOrUpdateFlatAmountCoupon struct.
-type CreateOrUpdateFlatAmountCoupon struct {
- // the name of the coupon
- Name string `json:"name"`
- // may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
- Code string `json:"code"`
- Description *string `json:"description,omitempty"`
- AmountInCents int64 `json:"amount_in_cents"`
- AllowNegativeBalance *bool `json:"allow_negative_balance,omitempty"`
- Recurring *bool `json:"recurring,omitempty"`
- EndDate *time.Time `json:"end_date,omitempty"`
- ProductFamilyId *string `json:"product_family_id,omitempty"`
- Stackable *bool `json:"stackable,omitempty"`
- CompoundingStrategy *CompoundingStrategy `json:"compounding_strategy,omitempty"`
- ExcludeMidPeriodAllocations *bool `json:"exclude_mid_period_allocations,omitempty"`
- ApplyOnCancelAtEndOfPeriod *bool `json:"apply_on_cancel_at_end_of_period,omitempty"`
- ApplyOnSubscriptionExpiration *bool `json:"apply_on_subscription_expiration,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for CreateOrUpdateFlatAmountCoupon.
-// It customizes the JSON marshaling process for CreateOrUpdateFlatAmountCoupon objects.
-func (c CreateOrUpdateFlatAmountCoupon) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(c.toMap())
-}
-
-// toMap converts the CreateOrUpdateFlatAmountCoupon object to a map representation for JSON marshaling.
-func (c CreateOrUpdateFlatAmountCoupon) toMap() map[string]any {
- structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
- structMap["name"] = c.Name
- structMap["code"] = c.Code
- if c.Description != nil {
- structMap["description"] = c.Description
- }
- structMap["amount_in_cents"] = c.AmountInCents
- if c.AllowNegativeBalance != nil {
- structMap["allow_negative_balance"] = c.AllowNegativeBalance
- }
- if c.Recurring != nil {
- structMap["recurring"] = c.Recurring
- }
- if c.EndDate != nil {
- structMap["end_date"] = c.EndDate.Format(time.RFC3339)
- }
- if c.ProductFamilyId != nil {
- structMap["product_family_id"] = c.ProductFamilyId
- }
- if c.Stackable != nil {
- structMap["stackable"] = c.Stackable
- }
- if c.CompoundingStrategy != nil {
- structMap["compounding_strategy"] = c.CompoundingStrategy
- }
- if c.ExcludeMidPeriodAllocations != nil {
- structMap["exclude_mid_period_allocations"] = c.ExcludeMidPeriodAllocations
- }
- if c.ApplyOnCancelAtEndOfPeriod != nil {
- structMap["apply_on_cancel_at_end_of_period"] = c.ApplyOnCancelAtEndOfPeriod
- }
- if c.ApplyOnSubscriptionExpiration != nil {
- structMap["apply_on_subscription_expiration"] = c.ApplyOnSubscriptionExpiration
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for CreateOrUpdateFlatAmountCoupon.
-// It customizes the JSON unmarshaling process for CreateOrUpdateFlatAmountCoupon objects.
-func (c *CreateOrUpdateFlatAmountCoupon) UnmarshalJSON(input []byte) error {
- var temp tempCreateOrUpdateFlatAmountCoupon
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
- err = temp.validate()
- if err != nil {
- return err
- }
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "code", "description", "amount_in_cents", "allow_negative_balance", "recurring", "end_date", "product_family_id", "stackable", "compounding_strategy", "exclude_mid_period_allocations", "apply_on_cancel_at_end_of_period", "apply_on_subscription_expiration")
- if err != nil {
- return err
- }
-
- c.AdditionalProperties = additionalProperties
- c.Name = *temp.Name
- c.Code = *temp.Code
- c.Description = temp.Description
- c.AmountInCents = *temp.AmountInCents
- c.AllowNegativeBalance = temp.AllowNegativeBalance
- c.Recurring = temp.Recurring
- if temp.EndDate != nil {
- EndDateVal, err := time.Parse(time.RFC3339, *temp.EndDate)
- if err != nil {
- log.Fatalf("Cannot Parse end_date as % s format.", time.RFC3339)
- }
- c.EndDate = &EndDateVal
- }
- c.ProductFamilyId = temp.ProductFamilyId
- c.Stackable = temp.Stackable
- c.CompoundingStrategy = temp.CompoundingStrategy
- c.ExcludeMidPeriodAllocations = temp.ExcludeMidPeriodAllocations
- c.ApplyOnCancelAtEndOfPeriod = temp.ApplyOnCancelAtEndOfPeriod
- c.ApplyOnSubscriptionExpiration = temp.ApplyOnSubscriptionExpiration
- return nil
-}
-
-// tempCreateOrUpdateFlatAmountCoupon is a temporary struct used for validating the fields of CreateOrUpdateFlatAmountCoupon.
-type tempCreateOrUpdateFlatAmountCoupon struct {
- Name *string `json:"name"`
- Code *string `json:"code"`
- Description *string `json:"description,omitempty"`
- AmountInCents *int64 `json:"amount_in_cents"`
- AllowNegativeBalance *bool `json:"allow_negative_balance,omitempty"`
- Recurring *bool `json:"recurring,omitempty"`
- EndDate *string `json:"end_date,omitempty"`
- ProductFamilyId *string `json:"product_family_id,omitempty"`
- Stackable *bool `json:"stackable,omitempty"`
- CompoundingStrategy *CompoundingStrategy `json:"compounding_strategy,omitempty"`
- ExcludeMidPeriodAllocations *bool `json:"exclude_mid_period_allocations,omitempty"`
- ApplyOnCancelAtEndOfPeriod *bool `json:"apply_on_cancel_at_end_of_period,omitempty"`
- ApplyOnSubscriptionExpiration *bool `json:"apply_on_subscription_expiration,omitempty"`
-}
-
-func (c *tempCreateOrUpdateFlatAmountCoupon) validate() error {
- var errs []string
- if c.Name == nil {
- errs = append(errs, "required field `name` is missing for type `Create or Update Flat Amount Coupon`")
- }
- if c.Code == nil {
- errs = append(errs, "required field `code` is missing for type `Create or Update Flat Amount Coupon`")
- }
- if c.AmountInCents == nil {
- errs = append(errs, "required field `amount_in_cents` is missing for type `Create or Update Flat Amount Coupon`")
- }
- if len(errs) == 0 {
- return nil
- }
- return errors.New(strings.Join (errs, "\n"))
-}
diff --git a/models/create_or_update_percentage_coupon.go b/models/create_or_update_percentage_coupon.go
deleted file mode 100644
index be1cfd6d..00000000
--- a/models/create_or_update_percentage_coupon.go
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
-Package advancedbilling
-
-This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
-*/
-package models
-
-import (
- "encoding/json"
- "errors"
- "log"
- "strings"
- "time"
-)
-
-// CreateOrUpdatePercentageCoupon represents a CreateOrUpdatePercentageCoupon struct.
-type CreateOrUpdatePercentageCoupon struct {
- // the name of the coupon
- Name string `json:"name"`
- // may contain uppercase alphanumeric characters and these special characters (which allow for email addresses to be used): “%”, “@”, “+”, “-”, “_”, and “.”
- Code string `json:"code"`
- Description *string `json:"description,omitempty"`
- Percentage CreateOrUpdatePercentageCouponPercentage `json:"percentage"`
- AllowNegativeBalance *bool `json:"allow_negative_balance,omitempty"`
- Recurring *bool `json:"recurring,omitempty"`
- EndDate *time.Time `json:"end_date,omitempty"`
- ProductFamilyId *string `json:"product_family_id,omitempty"`
- Stackable *bool `json:"stackable,omitempty"`
- CompoundingStrategy *CompoundingStrategy `json:"compounding_strategy,omitempty"`
- ExcludeMidPeriodAllocations *bool `json:"exclude_mid_period_allocations,omitempty"`
- ApplyOnCancelAtEndOfPeriod *bool `json:"apply_on_cancel_at_end_of_period,omitempty"`
- ApplyOnSubscriptionExpiration *bool `json:"apply_on_subscription_expiration,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for CreateOrUpdatePercentageCoupon.
-// It customizes the JSON marshaling process for CreateOrUpdatePercentageCoupon objects.
-func (c CreateOrUpdatePercentageCoupon) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(c.toMap())
-}
-
-// toMap converts the CreateOrUpdatePercentageCoupon object to a map representation for JSON marshaling.
-func (c CreateOrUpdatePercentageCoupon) toMap() map[string]any {
- structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
- structMap["name"] = c.Name
- structMap["code"] = c.Code
- if c.Description != nil {
- structMap["description"] = c.Description
- }
- structMap["percentage"] = c.Percentage.toMap()
- if c.AllowNegativeBalance != nil {
- structMap["allow_negative_balance"] = c.AllowNegativeBalance
- }
- if c.Recurring != nil {
- structMap["recurring"] = c.Recurring
- }
- if c.EndDate != nil {
- structMap["end_date"] = c.EndDate.Format(time.RFC3339)
- }
- if c.ProductFamilyId != nil {
- structMap["product_family_id"] = c.ProductFamilyId
- }
- if c.Stackable != nil {
- structMap["stackable"] = c.Stackable
- }
- if c.CompoundingStrategy != nil {
- structMap["compounding_strategy"] = c.CompoundingStrategy
- }
- if c.ExcludeMidPeriodAllocations != nil {
- structMap["exclude_mid_period_allocations"] = c.ExcludeMidPeriodAllocations
- }
- if c.ApplyOnCancelAtEndOfPeriod != nil {
- structMap["apply_on_cancel_at_end_of_period"] = c.ApplyOnCancelAtEndOfPeriod
- }
- if c.ApplyOnSubscriptionExpiration != nil {
- structMap["apply_on_subscription_expiration"] = c.ApplyOnSubscriptionExpiration
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for CreateOrUpdatePercentageCoupon.
-// It customizes the JSON unmarshaling process for CreateOrUpdatePercentageCoupon objects.
-func (c *CreateOrUpdatePercentageCoupon) UnmarshalJSON(input []byte) error {
- var temp tempCreateOrUpdatePercentageCoupon
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
- err = temp.validate()
- if err != nil {
- return err
- }
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "code", "description", "percentage", "allow_negative_balance", "recurring", "end_date", "product_family_id", "stackable", "compounding_strategy", "exclude_mid_period_allocations", "apply_on_cancel_at_end_of_period", "apply_on_subscription_expiration")
- if err != nil {
- return err
- }
-
- c.AdditionalProperties = additionalProperties
- c.Name = *temp.Name
- c.Code = *temp.Code
- c.Description = temp.Description
- c.Percentage = *temp.Percentage
- c.AllowNegativeBalance = temp.AllowNegativeBalance
- c.Recurring = temp.Recurring
- if temp.EndDate != nil {
- EndDateVal, err := time.Parse(time.RFC3339, *temp.EndDate)
- if err != nil {
- log.Fatalf("Cannot Parse end_date as % s format.", time.RFC3339)
- }
- c.EndDate = &EndDateVal
- }
- c.ProductFamilyId = temp.ProductFamilyId
- c.Stackable = temp.Stackable
- c.CompoundingStrategy = temp.CompoundingStrategy
- c.ExcludeMidPeriodAllocations = temp.ExcludeMidPeriodAllocations
- c.ApplyOnCancelAtEndOfPeriod = temp.ApplyOnCancelAtEndOfPeriod
- c.ApplyOnSubscriptionExpiration = temp.ApplyOnSubscriptionExpiration
- return nil
-}
-
-// tempCreateOrUpdatePercentageCoupon is a temporary struct used for validating the fields of CreateOrUpdatePercentageCoupon.
-type tempCreateOrUpdatePercentageCoupon struct {
- Name *string `json:"name"`
- Code *string `json:"code"`
- Description *string `json:"description,omitempty"`
- Percentage *CreateOrUpdatePercentageCouponPercentage `json:"percentage"`
- AllowNegativeBalance *bool `json:"allow_negative_balance,omitempty"`
- Recurring *bool `json:"recurring,omitempty"`
- EndDate *string `json:"end_date,omitempty"`
- ProductFamilyId *string `json:"product_family_id,omitempty"`
- Stackable *bool `json:"stackable,omitempty"`
- CompoundingStrategy *CompoundingStrategy `json:"compounding_strategy,omitempty"`
- ExcludeMidPeriodAllocations *bool `json:"exclude_mid_period_allocations,omitempty"`
- ApplyOnCancelAtEndOfPeriod *bool `json:"apply_on_cancel_at_end_of_period,omitempty"`
- ApplyOnSubscriptionExpiration *bool `json:"apply_on_subscription_expiration,omitempty"`
-}
-
-func (c *tempCreateOrUpdatePercentageCoupon) validate() error {
- var errs []string
- if c.Name == nil {
- errs = append(errs, "required field `name` is missing for type `Create or Update Percentage Coupon`")
- }
- if c.Code == nil {
- errs = append(errs, "required field `code` is missing for type `Create or Update Percentage Coupon`")
- }
- if c.Percentage == nil {
- errs = append(errs, "required field `percentage` is missing for type `Create or Update Percentage Coupon`")
- }
- if len(errs) == 0 {
- return nil
- }
- return errors.New(strings.Join (errs, "\n"))
-}
diff --git a/models/create_or_update_percentage_coupon_percentage.go b/models/create_or_update_percentage_coupon_percentage.go
deleted file mode 100644
index 420ffbdc..00000000
--- a/models/create_or_update_percentage_coupon_percentage.go
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
-Package advancedbilling
-
-This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
-*/
-package models
-
-import (
- "encoding/json"
- "errors"
- "strings"
-)
-
-// CreateOrUpdatePercentageCouponPercentage represents a CreateOrUpdatePercentageCouponPercentage struct.
-// This is a container for one-of cases.
-type CreateOrUpdatePercentageCouponPercentage struct {
- value any
- isString bool
- isPrecision bool
-}
-
-// String converts the CreateOrUpdatePercentageCouponPercentage object to a string representation.
-func (c CreateOrUpdatePercentageCouponPercentage) String() string {
- if bytes, err := json.Marshal(c.value); err == nil {
- return strings.Trim(string(bytes), "\"")
- }
- return ""
-}
-
-// MarshalJSON implements the json.Marshaler interface for CreateOrUpdatePercentageCouponPercentage.
-// It customizes the JSON marshaling process for CreateOrUpdatePercentageCouponPercentage objects.
-func (c CreateOrUpdatePercentageCouponPercentage) MarshalJSON() (
- []byte,
- error) {
- if c.value == nil {
- return nil, errors.New("No underlying type is set. Please use any of the `models.CreateOrUpdatePercentageCouponPercentageContainer.From*` functions to initialize the CreateOrUpdatePercentageCouponPercentage object.")
- }
- return json.Marshal(c.toMap())
-}
-
-// toMap converts the CreateOrUpdatePercentageCouponPercentage object to a map representation for JSON marshaling.
-func (c *CreateOrUpdatePercentageCouponPercentage) toMap() any {
- switch obj := c.value.(type) {
- case *string:
- return *obj
- case *float64:
- return *obj
- }
- return nil
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for CreateOrUpdatePercentageCouponPercentage.
-// It customizes the JSON unmarshaling process for CreateOrUpdatePercentageCouponPercentage objects.
-func (c *CreateOrUpdatePercentageCouponPercentage) UnmarshalJSON(input []byte) error {
- result, err := UnmarshallOneOf(input,
- NewTypeHolder(new(string), false, &c.isString),
- NewTypeHolder(new(float64), false, &c.isPrecision),
- )
-
- c.value = result
- return err
-}
-
-func (c *CreateOrUpdatePercentageCouponPercentage) AsString() (
- *string,
- bool) {
- if !c.isString {
- return nil, false
- }
- return c.value.(*string), true
-}
-
-func (c *CreateOrUpdatePercentageCouponPercentage) AsPrecision() (
- *float64,
- bool) {
- if !c.isPrecision {
- return nil, false
- }
- return c.value.(*float64), true
-}
-
-// internalCreateOrUpdatePercentageCouponPercentage represents a createOrUpdatePercentageCouponPercentage struct.
-// This is a container for one-of cases.
-type internalCreateOrUpdatePercentageCouponPercentage struct {}
-
-var CreateOrUpdatePercentageCouponPercentageContainer internalCreateOrUpdatePercentageCouponPercentage
-
-// The internalCreateOrUpdatePercentageCouponPercentage instance, wrapping the provided string value.
-func (c *internalCreateOrUpdatePercentageCouponPercentage) FromString(val string) CreateOrUpdatePercentageCouponPercentage {
- return CreateOrUpdatePercentageCouponPercentage{value: &val}
-}
-
-// The internalCreateOrUpdatePercentageCouponPercentage instance, wrapping the provided float64 value.
-func (c *internalCreateOrUpdatePercentageCouponPercentage) FromPrecision(val float64) CreateOrUpdatePercentageCouponPercentage {
- return CreateOrUpdatePercentageCouponPercentage{value: &val}
-}
diff --git a/models/create_or_update_product.go b/models/create_or_update_product.go
index af7de9fd..c84a0288 100644
--- a/models/create_or_update_product.go
+++ b/models/create_or_update_product.go
@@ -43,7 +43,7 @@ type CreateOrUpdateProduct struct {
AutoCreateSignupPage *bool `json:"auto_create_signup_page,omitempty"`
// A string representing the tax code related to the product type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters.
TaxCode *string `json:"tax_code,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateOrUpdateProduct.
@@ -51,13 +51,17 @@ type CreateOrUpdateProduct struct {
func (c CreateOrUpdateProduct) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "name", "handle", "description", "accounting_code", "require_credit_card", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "trial_type", "expiration_interval", "expiration_interval_unit", "auto_create_signup_page", "tax_code"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateOrUpdateProduct object to a map representation for JSON marshaling.
func (c CreateOrUpdateProduct) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["name"] = c.Name
if c.Handle != nil {
structMap["handle"] = c.Handle
@@ -119,12 +123,12 @@ func (c *CreateOrUpdateProduct) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "handle", "description", "accounting_code", "require_credit_card", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "trial_type", "expiration_interval", "expiration_interval_unit", "auto_create_signup_page", "tax_code")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "handle", "description", "accounting_code", "require_credit_card", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "trial_type", "expiration_interval", "expiration_interval_unit", "auto_create_signup_page", "tax_code")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Name = *temp.Name
c.Handle = temp.Handle
c.Description = *temp.Description
diff --git a/models/create_or_update_product_request.go b/models/create_or_update_product_request.go
index 708d6a26..4ccde23f 100644
--- a/models/create_or_update_product_request.go
+++ b/models/create_or_update_product_request.go
@@ -13,8 +13,8 @@ import (
// CreateOrUpdateProductRequest represents a CreateOrUpdateProductRequest struct.
type CreateOrUpdateProductRequest struct {
- Product CreateOrUpdateProduct `json:"product"`
- AdditionalProperties map[string]any `json:"_"`
+ Product CreateOrUpdateProduct `json:"product"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateOrUpdateProductRequest.
@@ -22,13 +22,17 @@ type CreateOrUpdateProductRequest struct {
func (c CreateOrUpdateProductRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "product"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateOrUpdateProductRequest object to a map representation for JSON marshaling.
func (c CreateOrUpdateProductRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["product"] = c.Product.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateOrUpdateProductRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Product = *temp.Product
return nil
}
diff --git a/models/create_or_update_segment_price.go b/models/create_or_update_segment_price.go
index 6bb9bedb..a11047a1 100644
--- a/models/create_or_update_segment_price.go
+++ b/models/create_or_update_segment_price.go
@@ -17,7 +17,7 @@ type CreateOrUpdateSegmentPrice struct {
EndingQuantity *int `json:"ending_quantity,omitempty"`
// The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065
UnitPrice CreateOrUpdateSegmentPriceUnitPrice `json:"unit_price"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateOrUpdateSegmentPrice.
@@ -25,13 +25,17 @@ type CreateOrUpdateSegmentPrice struct {
func (c CreateOrUpdateSegmentPrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "starting_quantity", "ending_quantity", "unit_price"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateOrUpdateSegmentPrice object to a map representation for JSON marshaling.
func (c CreateOrUpdateSegmentPrice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.StartingQuantity != nil {
structMap["starting_quantity"] = c.StartingQuantity
}
@@ -54,12 +58,12 @@ func (c *CreateOrUpdateSegmentPrice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "starting_quantity", "ending_quantity", "unit_price")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "starting_quantity", "ending_quantity", "unit_price")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.StartingQuantity = temp.StartingQuantity
c.EndingQuantity = temp.EndingQuantity
c.UnitPrice = *temp.UnitPrice
diff --git a/models/create_payment.go b/models/create_payment.go
index 7d697f44..46841a0b 100644
--- a/models/create_payment.go
+++ b/models/create_payment.go
@@ -18,7 +18,7 @@ type CreatePayment struct {
PaymentDetails string `json:"payment_details"`
// The type of payment method used. Defaults to other.
PaymentMethod InvoicePaymentMethodType `json:"payment_method"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreatePayment.
@@ -26,13 +26,17 @@ type CreatePayment struct {
func (c CreatePayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "amount", "memo", "payment_details", "payment_method"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreatePayment object to a map representation for JSON marshaling.
func (c CreatePayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["amount"] = c.Amount
structMap["memo"] = c.Memo
structMap["payment_details"] = c.PaymentDetails
@@ -52,12 +56,12 @@ func (c *CreatePayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "amount", "memo", "payment_details", "payment_method")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "amount", "memo", "payment_details", "payment_method")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Amount = *temp.Amount
c.Memo = *temp.Memo
c.PaymentDetails = *temp.PaymentDetails
diff --git a/models/create_payment_profile.go b/models/create_payment_profile.go
index 49067bff..b62e6dbd 100644
--- a/models/create_payment_profile.go
+++ b/models/create_payment_profile.go
@@ -72,7 +72,7 @@ type CreatePaymentProfile struct {
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"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreatePaymentProfile.
@@ -80,13 +80,17 @@ type CreatePaymentProfile struct {
func (c CreatePaymentProfile) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "chargify_token", "id", "payment_type", "first_name", "last_name", "masked_card_number", "full_number", "card_type", "expiration_month", "expiration_year", "billing_address", "billing_address_2", "billing_city", "billing_state", "billing_country", "billing_zip", "current_vault", "vault_token", "customer_vault_token", "customer_id", "paypal_email", "payment_method_nonce", "gateway_handle", "cvv", "bank_name", "bank_iban", "bank_routing_number", "bank_account_number", "bank_branch_code", "bank_account_type", "bank_account_holder_type", "last_four"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreatePaymentProfile object to a map representation for JSON marshaling.
func (c CreatePaymentProfile) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.ChargifyToken != nil {
structMap["chargify_token"] = c.ChargifyToken
}
@@ -198,12 +202,12 @@ func (c *CreatePaymentProfile) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "chargify_token", "id", "payment_type", "first_name", "last_name", "masked_card_number", "full_number", "card_type", "expiration_month", "expiration_year", "billing_address", "billing_address_2", "billing_city", "billing_state", "billing_country", "billing_zip", "current_vault", "vault_token", "customer_vault_token", "customer_id", "paypal_email", "payment_method_nonce", "gateway_handle", "cvv", "bank_name", "bank_iban", "bank_routing_number", "bank_account_number", "bank_branch_code", "bank_account_type", "bank_account_holder_type", "last_four")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "chargify_token", "id", "payment_type", "first_name", "last_name", "masked_card_number", "full_number", "card_type", "expiration_month", "expiration_year", "billing_address", "billing_address_2", "billing_city", "billing_state", "billing_country", "billing_zip", "current_vault", "vault_token", "customer_vault_token", "customer_id", "paypal_email", "payment_method_nonce", "gateway_handle", "cvv", "bank_name", "bank_iban", "bank_routing_number", "bank_account_number", "bank_branch_code", "bank_account_type", "bank_account_holder_type", "last_four")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ChargifyToken = temp.ChargifyToken
c.Id = temp.Id
c.PaymentType = temp.PaymentType
diff --git a/models/create_payment_profile_request.go b/models/create_payment_profile_request.go
index d6ce312d..5271d456 100644
--- a/models/create_payment_profile_request.go
+++ b/models/create_payment_profile_request.go
@@ -13,8 +13,8 @@ import (
// CreatePaymentProfileRequest represents a CreatePaymentProfileRequest struct.
type CreatePaymentProfileRequest struct {
- PaymentProfile CreatePaymentProfile `json:"payment_profile"`
- AdditionalProperties map[string]any `json:"_"`
+ PaymentProfile CreatePaymentProfile `json:"payment_profile"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreatePaymentProfileRequest.
@@ -22,13 +22,17 @@ type CreatePaymentProfileRequest struct {
func (c CreatePaymentProfileRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "payment_profile"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreatePaymentProfileRequest object to a map representation for JSON marshaling.
func (c CreatePaymentProfileRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["payment_profile"] = c.PaymentProfile.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreatePaymentProfileRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payment_profile")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payment_profile")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.PaymentProfile = *temp.PaymentProfile
return nil
}
diff --git a/models/create_prepaid_component.go b/models/create_prepaid_component.go
index ed18ae6c..444f9037 100644
--- a/models/create_prepaid_component.go
+++ b/models/create_prepaid_component.go
@@ -13,8 +13,8 @@ import (
// CreatePrepaidComponent represents a CreatePrepaidComponent struct.
type CreatePrepaidComponent struct {
- PrepaidUsageComponent PrepaidUsageComponent `json:"prepaid_usage_component"`
- AdditionalProperties map[string]any `json:"_"`
+ PrepaidUsageComponent PrepaidUsageComponent `json:"prepaid_usage_component"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreatePrepaidComponent.
@@ -22,13 +22,17 @@ type CreatePrepaidComponent struct {
func (c CreatePrepaidComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "prepaid_usage_component"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreatePrepaidComponent object to a map representation for JSON marshaling.
func (c CreatePrepaidComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["prepaid_usage_component"] = c.PrepaidUsageComponent.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreatePrepaidComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prepaid_usage_component")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prepaid_usage_component")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.PrepaidUsageComponent = *temp.PrepaidUsageComponent
return nil
}
diff --git a/models/create_prepaid_usage_component_price_point.go b/models/create_prepaid_usage_component_price_point.go
index ea807714..8e66002c 100644
--- a/models/create_prepaid_usage_component_price_point.go
+++ b/models/create_prepaid_usage_component_price_point.go
@@ -21,15 +21,15 @@ type CreatePrepaidUsageComponentPricePoint struct {
OveragePricing OveragePricing `json:"overage_pricing"`
// 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"`
- // Boolean which controls whether or not remaining units should be rolled over to the next period
+ // (only for prepaid usage components) Boolean which controls whether or not remaining units should be rolled over to the next period
RolloverPrepaidRemainder *bool `json:"rollover_prepaid_remainder,omitempty"`
- // Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period
+ // (only for prepaid usage components) Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period
RenewPrepaidAllocation *bool `json:"renew_prepaid_allocation,omitempty"`
// (only for prepaid usage components where rollover_prepaid_remainder is true) The number of `expiration_interval_unit`s after which rollover amounts should expire
ExpirationInterval *float64 `json:"expiration_interval,omitempty"`
- // A string representing the expiration interval unit for this component, either month or day
+ // (only for prepaid usage components where rollover_prepaid_remainder is true) A string representing the expiration interval unit for this component, either month or day
ExpirationIntervalUnit Optional[ExpirationIntervalUnit] `json:"expiration_interval_unit"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreatePrepaidUsageComponentPricePoint.
@@ -37,13 +37,17 @@ type CreatePrepaidUsageComponentPricePoint struct {
func (c CreatePrepaidUsageComponentPricePoint) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "name", "handle", "pricing_scheme", "prices", "overage_pricing", "use_site_exchange_rate", "rollover_prepaid_remainder", "renew_prepaid_allocation", "expiration_interval", "expiration_interval_unit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreatePrepaidUsageComponentPricePoint object to a map representation for JSON marshaling.
func (c CreatePrepaidUsageComponentPricePoint) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["name"] = c.Name
if c.Handle != nil {
structMap["handle"] = c.Handle
@@ -85,12 +89,12 @@ func (c *CreatePrepaidUsageComponentPricePoint) UnmarshalJSON(input []byte) erro
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "handle", "pricing_scheme", "prices", "overage_pricing", "use_site_exchange_rate", "rollover_prepaid_remainder", "renew_prepaid_allocation", "expiration_interval", "expiration_interval_unit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "handle", "pricing_scheme", "prices", "overage_pricing", "use_site_exchange_rate", "rollover_prepaid_remainder", "renew_prepaid_allocation", "expiration_interval", "expiration_interval_unit")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Name = *temp.Name
c.Handle = temp.Handle
c.PricingScheme = *temp.PricingScheme
diff --git a/models/create_prepayment.go b/models/create_prepayment.go
index 76732a29..e8bb939f 100644
--- a/models/create_prepayment.go
+++ b/models/create_prepayment.go
@@ -19,7 +19,7 @@ type CreatePrepayment struct {
// :- When the `method` specified is `"credit_card_on_file"`, the prepayment amount will be collected using the default credit card payment profile and applied to the prepayment account balance. This is especially useful for manual replenishment of prepaid subscriptions.
Method CreatePrepaymentMethod `json:"method"`
PaymentProfileId *int `json:"payment_profile_id,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreatePrepayment.
@@ -27,13 +27,17 @@ type CreatePrepayment struct {
func (c CreatePrepayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "amount", "details", "memo", "method", "payment_profile_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreatePrepayment object to a map representation for JSON marshaling.
func (c CreatePrepayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["amount"] = c.Amount
structMap["details"] = c.Details
structMap["memo"] = c.Memo
@@ -56,12 +60,12 @@ func (c *CreatePrepayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "amount", "details", "memo", "method", "payment_profile_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "amount", "details", "memo", "method", "payment_profile_id")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Amount = *temp.Amount
c.Details = *temp.Details
c.Memo = *temp.Memo
diff --git a/models/create_prepayment_request.go b/models/create_prepayment_request.go
index a497f661..bf7069ab 100644
--- a/models/create_prepayment_request.go
+++ b/models/create_prepayment_request.go
@@ -13,8 +13,8 @@ import (
// CreatePrepaymentRequest represents a CreatePrepaymentRequest struct.
type CreatePrepaymentRequest struct {
- Prepayment CreatePrepayment `json:"prepayment"`
- AdditionalProperties map[string]any `json:"_"`
+ Prepayment CreatePrepayment `json:"prepayment"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreatePrepaymentRequest.
@@ -22,13 +22,17 @@ type CreatePrepaymentRequest struct {
func (c CreatePrepaymentRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "prepayment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreatePrepaymentRequest object to a map representation for JSON marshaling.
func (c CreatePrepaymentRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["prepayment"] = c.Prepayment.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreatePrepaymentRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prepayment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prepayment")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Prepayment = *temp.Prepayment
return nil
}
diff --git a/models/create_prepayment_response.go b/models/create_prepayment_response.go
index b40bec52..84167aa2 100644
--- a/models/create_prepayment_response.go
+++ b/models/create_prepayment_response.go
@@ -13,8 +13,8 @@ import (
// CreatePrepaymentResponse represents a CreatePrepaymentResponse struct.
type CreatePrepaymentResponse struct {
- Prepayment CreatedPrepayment `json:"prepayment"`
- AdditionalProperties map[string]any `json:"_"`
+ Prepayment CreatedPrepayment `json:"prepayment"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreatePrepaymentResponse.
@@ -22,13 +22,17 @@ type CreatePrepaymentResponse struct {
func (c CreatePrepaymentResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "prepayment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreatePrepaymentResponse object to a map representation for JSON marshaling.
func (c CreatePrepaymentResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["prepayment"] = c.Prepayment.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreatePrepaymentResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prepayment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prepayment")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Prepayment = *temp.Prepayment
return nil
}
diff --git a/models/create_product_currency_price.go b/models/create_product_currency_price.go
index 200fcd8c..1a5c3e34 100644
--- a/models/create_product_currency_price.go
+++ b/models/create_product_currency_price.go
@@ -14,12 +14,12 @@ import (
// CreateProductCurrencyPrice represents a CreateProductCurrencyPrice struct.
type CreateProductCurrencyPrice struct {
// ISO code for one of the site level currencies.
- Currency string `json:"currency"`
+ Currency string `json:"currency"`
// Price for the given role.
- Price int `json:"price"`
+ Price int `json:"price"`
// Role for the price.
- Role CurrencyPriceRole `json:"role"`
- AdditionalProperties map[string]any `json:"_"`
+ Role CurrencyPriceRole `json:"role"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateProductCurrencyPrice.
@@ -27,13 +27,17 @@ type CreateProductCurrencyPrice struct {
func (c CreateProductCurrencyPrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "currency", "price", "role"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateProductCurrencyPrice object to a map representation for JSON marshaling.
func (c CreateProductCurrencyPrice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["currency"] = c.Currency
structMap["price"] = c.Price
structMap["role"] = c.Role
@@ -52,12 +56,12 @@ func (c *CreateProductCurrencyPrice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currency", "price", "role")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currency", "price", "role")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Currency = *temp.Currency
c.Price = *temp.Price
c.Role = *temp.Role
diff --git a/models/create_product_currency_prices_request.go b/models/create_product_currency_prices_request.go
index 13ba77de..6cc10688 100644
--- a/models/create_product_currency_prices_request.go
+++ b/models/create_product_currency_prices_request.go
@@ -14,7 +14,7 @@ import (
// CreateProductCurrencyPricesRequest represents a CreateProductCurrencyPricesRequest struct.
type CreateProductCurrencyPricesRequest struct {
CurrencyPrices []CreateProductCurrencyPrice `json:"currency_prices"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateProductCurrencyPricesRequest.
@@ -22,13 +22,17 @@ type CreateProductCurrencyPricesRequest struct {
func (c CreateProductCurrencyPricesRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "currency_prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateProductCurrencyPricesRequest object to a map representation for JSON marshaling.
func (c CreateProductCurrencyPricesRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["currency_prices"] = c.CurrencyPrices
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateProductCurrencyPricesRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currency_prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currency_prices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.CurrencyPrices = *temp.CurrencyPrices
return nil
}
diff --git a/models/create_product_family.go b/models/create_product_family.go
index 4331d1b9..ccf427c7 100644
--- a/models/create_product_family.go
+++ b/models/create_product_family.go
@@ -13,10 +13,10 @@ import (
// CreateProductFamily represents a CreateProductFamily struct.
type CreateProductFamily struct {
- Name string `json:"name"`
- Handle Optional[string] `json:"handle"`
- Description Optional[string] `json:"description"`
- AdditionalProperties map[string]any `json:"_"`
+ Name string `json:"name"`
+ Handle Optional[string] `json:"handle"`
+ Description Optional[string] `json:"description"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateProductFamily.
@@ -24,13 +24,17 @@ type CreateProductFamily struct {
func (c CreateProductFamily) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "name", "handle", "description"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateProductFamily object to a map representation for JSON marshaling.
func (c CreateProductFamily) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["name"] = c.Name
if c.Handle.IsValueSet() {
if c.Handle.Value() != nil {
@@ -61,12 +65,12 @@ func (c *CreateProductFamily) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "handle", "description")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "handle", "description")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Name = *temp.Name
c.Handle = temp.Handle
c.Description = temp.Description
diff --git a/models/create_product_family_request.go b/models/create_product_family_request.go
index 7cf418d1..508472fc 100644
--- a/models/create_product_family_request.go
+++ b/models/create_product_family_request.go
@@ -13,8 +13,8 @@ import (
// CreateProductFamilyRequest represents a CreateProductFamilyRequest struct.
type CreateProductFamilyRequest struct {
- ProductFamily CreateProductFamily `json:"product_family"`
- AdditionalProperties map[string]any `json:"_"`
+ ProductFamily CreateProductFamily `json:"product_family"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateProductFamilyRequest.
@@ -22,13 +22,17 @@ type CreateProductFamilyRequest struct {
func (c CreateProductFamilyRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "product_family"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateProductFamilyRequest object to a map representation for JSON marshaling.
func (c CreateProductFamilyRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["product_family"] = c.ProductFamily.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateProductFamilyRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product_family")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product_family")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ProductFamily = *temp.ProductFamily
return nil
}
diff --git a/models/create_product_price_point.go b/models/create_product_price_point.go
index feb46a9b..11ebb0c0 100644
--- a/models/create_product_price_point.go
+++ b/models/create_product_price_point.go
@@ -39,7 +39,7 @@ type CreateProductPricePoint struct {
ExpirationIntervalUnit Optional[ExpirationIntervalUnit] `json:"expiration_interval_unit"`
// Whether or not to use the site's exchange rate or define your own pricing when your site has multiple currencies defined.
UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateProductPricePoint.
@@ -47,13 +47,17 @@ type CreateProductPricePoint struct {
func (c CreateProductPricePoint) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "name", "handle", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "trial_type", "initial_charge_in_cents", "initial_charge_after_trial", "expiration_interval", "expiration_interval_unit", "use_site_exchange_rate"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateProductPricePoint object to a map representation for JSON marshaling.
func (c CreateProductPricePoint) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["name"] = c.Name
if c.Handle != nil {
structMap["handle"] = c.Handle
@@ -107,12 +111,12 @@ func (c *CreateProductPricePoint) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "handle", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "trial_type", "initial_charge_in_cents", "initial_charge_after_trial", "expiration_interval", "expiration_interval_unit", "use_site_exchange_rate")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "handle", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "trial_type", "initial_charge_in_cents", "initial_charge_after_trial", "expiration_interval", "expiration_interval_unit", "use_site_exchange_rate")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Name = *temp.Name
c.Handle = temp.Handle
c.PriceInCents = *temp.PriceInCents
diff --git a/models/create_product_price_point_request.go b/models/create_product_price_point_request.go
index 216af13e..0f61de05 100644
--- a/models/create_product_price_point_request.go
+++ b/models/create_product_price_point_request.go
@@ -14,7 +14,7 @@ import (
// CreateProductPricePointRequest represents a CreateProductPricePointRequest struct.
type CreateProductPricePointRequest struct {
PricePoint CreateProductPricePoint `json:"price_point"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateProductPricePointRequest.
@@ -22,13 +22,17 @@ type CreateProductPricePointRequest struct {
func (c CreateProductPricePointRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "price_point"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateProductPricePointRequest object to a map representation for JSON marshaling.
func (c CreateProductPricePointRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["price_point"] = c.PricePoint.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateProductPricePointRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_point")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_point")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.PricePoint = *temp.PricePoint
return nil
}
diff --git a/models/create_quantity_based_component.go b/models/create_quantity_based_component.go
index 65eb9474..e67ac4a1 100644
--- a/models/create_quantity_based_component.go
+++ b/models/create_quantity_based_component.go
@@ -14,7 +14,7 @@ import (
// CreateQuantityBasedComponent represents a CreateQuantityBasedComponent struct.
type CreateQuantityBasedComponent struct {
QuantityBasedComponent QuantityBasedComponent `json:"quantity_based_component"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateQuantityBasedComponent.
@@ -22,13 +22,17 @@ type CreateQuantityBasedComponent struct {
func (c CreateQuantityBasedComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "quantity_based_component"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateQuantityBasedComponent object to a map representation for JSON marshaling.
func (c CreateQuantityBasedComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["quantity_based_component"] = c.QuantityBasedComponent.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateQuantityBasedComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "quantity_based_component")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "quantity_based_component")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.QuantityBasedComponent = *temp.QuantityBasedComponent
return nil
}
diff --git a/models/create_reason_code.go b/models/create_reason_code.go
index 9cee32f3..99d6ea51 100644
--- a/models/create_reason_code.go
+++ b/models/create_reason_code.go
@@ -14,12 +14,12 @@ import (
// CreateReasonCode represents a CreateReasonCode struct.
type CreateReasonCode struct {
// The unique identifier for the ReasonCode
- Code string `json:"code"`
+ Code string `json:"code"`
// The friendly summary of what the code signifies
- Description string `json:"description"`
+ Description string `json:"description"`
// The order that code appears in lists
- Position *int `json:"position,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Position *int `json:"position,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateReasonCode.
@@ -27,13 +27,17 @@ type CreateReasonCode struct {
func (c CreateReasonCode) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "code", "description", "position"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateReasonCode object to a map representation for JSON marshaling.
func (c CreateReasonCode) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["code"] = c.Code
structMap["description"] = c.Description
if c.Position != nil {
@@ -54,12 +58,12 @@ func (c *CreateReasonCode) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "code", "description", "position")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "code", "description", "position")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Code = *temp.Code
c.Description = *temp.Description
c.Position = temp.Position
diff --git a/models/create_reason_code_request.go b/models/create_reason_code_request.go
index e307f2cf..78c10966 100644
--- a/models/create_reason_code_request.go
+++ b/models/create_reason_code_request.go
@@ -13,8 +13,8 @@ import (
// CreateReasonCodeRequest represents a CreateReasonCodeRequest struct.
type CreateReasonCodeRequest struct {
- ReasonCode CreateReasonCode `json:"reason_code"`
- AdditionalProperties map[string]any `json:"_"`
+ ReasonCode CreateReasonCode `json:"reason_code"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateReasonCodeRequest.
@@ -22,13 +22,17 @@ type CreateReasonCodeRequest struct {
func (c CreateReasonCodeRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "reason_code"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateReasonCodeRequest object to a map representation for JSON marshaling.
func (c CreateReasonCodeRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["reason_code"] = c.ReasonCode.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateReasonCodeRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "reason_code")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "reason_code")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ReasonCode = *temp.ReasonCode
return nil
}
diff --git a/models/create_segment.go b/models/create_segment.go
index f303f44e..0ecfc289 100644
--- a/models/create_segment.go
+++ b/models/create_segment.go
@@ -24,7 +24,7 @@ type CreateSegment struct {
// 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"`
Prices []CreateOrUpdateSegmentPrice `json:"prices,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateSegment.
@@ -32,13 +32,17 @@ type CreateSegment struct {
func (c CreateSegment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "segment_property_1_value", "segment_property_2_value", "segment_property_3_value", "segment_property_4_value", "pricing_scheme", "prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateSegment object to a map representation for JSON marshaling.
func (c CreateSegment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.SegmentProperty1Value != nil {
structMap["segment_property_1_value"] = c.SegmentProperty1Value.toMap()
}
@@ -70,12 +74,12 @@ func (c *CreateSegment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "segment_property_1_value", "segment_property_2_value", "segment_property_3_value", "segment_property_4_value", "pricing_scheme", "prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "segment_property_1_value", "segment_property_2_value", "segment_property_3_value", "segment_property_4_value", "pricing_scheme", "prices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.SegmentProperty1Value = temp.SegmentProperty1Value
c.SegmentProperty2Value = temp.SegmentProperty2Value
c.SegmentProperty3Value = temp.SegmentProperty3Value
diff --git a/models/create_segment_request.go b/models/create_segment_request.go
index 83059535..997eac28 100644
--- a/models/create_segment_request.go
+++ b/models/create_segment_request.go
@@ -13,8 +13,8 @@ import (
// CreateSegmentRequest represents a CreateSegmentRequest struct.
type CreateSegmentRequest struct {
- Segment CreateSegment `json:"segment"`
- AdditionalProperties map[string]any `json:"_"`
+ Segment CreateSegment `json:"segment"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateSegmentRequest.
@@ -22,13 +22,17 @@ type CreateSegmentRequest struct {
func (c CreateSegmentRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "segment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateSegmentRequest object to a map representation for JSON marshaling.
func (c CreateSegmentRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["segment"] = c.Segment.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateSegmentRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "segment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "segment")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Segment = *temp.Segment
return nil
}
diff --git a/models/create_subscription.go b/models/create_subscription.go
index 8a416099..4afa15b8 100644
--- a/models/create_subscription.go
+++ b/models/create_subscription.go
@@ -99,12 +99,12 @@ type CreateSubscription struct {
// (Optional) If passed, the proof of the authorized ACH agreement terms will be persisted.
AchAgreement *ACHAgreement `json:"ach_agreement,omitempty"`
// Enable Communication Delay feature, making sure no communication (email or SMS) is sent to the Customer between 9PM and 8AM in time zone set by the `dunning_communication_delay_time_zone` attribute.
- DunningCommunicationDelayEnabled Optional[bool] `json:"dunning_communication_delay_enabled"`
+ DunningCommunicationDelayEnabled *bool `json:"dunning_communication_delay_enabled,omitempty"`
// Time zone for the Dunning Communication Delay feature.
DunningCommunicationDelayTimeZone Optional[string] `json:"dunning_communication_delay_time_zone"`
// Valid only for the Subscription Preview endpoint. When set to `true` it skips calculating taxes for the current and next billing manifests.
SkipBillingManifestTaxes *bool `json:"skip_billing_manifest_taxes,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateSubscription.
@@ -112,13 +112,17 @@ type CreateSubscription struct {
func (c CreateSubscription) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "product_handle", "product_id", "product_price_point_handle", "product_price_point_id", "custom_price", "coupon_code", "coupon_codes", "payment_collection_method", "receives_invoice_emails", "net_terms", "customer_id", "next_billing_at", "initial_billing_at", "stored_credential_transaction_id", "sales_rep_id", "payment_profile_id", "reference", "customer_attributes", "payment_profile_attributes", "credit_card_attributes", "bank_account_attributes", "components", "calendar_billing", "metafields", "customer_reference", "group", "ref", "cancellation_message", "cancellation_method", "currency", "expires_at", "expiration_tracks_next_billing_change", "agreement_terms", "authorizer_first_name", "authorizer_last_name", "calendar_billing_first_charge", "reason_code", "product_change_delayed", "offer_id", "prepaid_configuration", "previous_billing_at", "import_mrr", "canceled_at", "activated_at", "agreement_acceptance", "ach_agreement", "dunning_communication_delay_enabled", "dunning_communication_delay_time_zone", "skip_billing_manifest_taxes"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateSubscription object to a map representation for JSON marshaling.
func (c CreateSubscription) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.ProductHandle != nil {
structMap["product_handle"] = c.ProductHandle
}
@@ -257,12 +261,8 @@ func (c CreateSubscription) toMap() map[string]any {
if c.AchAgreement != nil {
structMap["ach_agreement"] = c.AchAgreement.toMap()
}
- if c.DunningCommunicationDelayEnabled.IsValueSet() {
- if c.DunningCommunicationDelayEnabled.Value() != nil {
- structMap["dunning_communication_delay_enabled"] = c.DunningCommunicationDelayEnabled.Value()
- } else {
- structMap["dunning_communication_delay_enabled"] = nil
- }
+ if c.DunningCommunicationDelayEnabled != nil {
+ structMap["dunning_communication_delay_enabled"] = c.DunningCommunicationDelayEnabled
}
if c.DunningCommunicationDelayTimeZone.IsValueSet() {
if c.DunningCommunicationDelayTimeZone.Value() != nil {
@@ -285,12 +285,12 @@ func (c *CreateSubscription) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product_handle", "product_id", "product_price_point_handle", "product_price_point_id", "custom_price", "coupon_code", "coupon_codes", "payment_collection_method", "receives_invoice_emails", "net_terms", "customer_id", "next_billing_at", "initial_billing_at", "stored_credential_transaction_id", "sales_rep_id", "payment_profile_id", "reference", "customer_attributes", "payment_profile_attributes", "credit_card_attributes", "bank_account_attributes", "components", "calendar_billing", "metafields", "customer_reference", "group", "ref", "cancellation_message", "cancellation_method", "currency", "expires_at", "expiration_tracks_next_billing_change", "agreement_terms", "authorizer_first_name", "authorizer_last_name", "calendar_billing_first_charge", "reason_code", "product_change_delayed", "offer_id", "prepaid_configuration", "previous_billing_at", "import_mrr", "canceled_at", "activated_at", "agreement_acceptance", "ach_agreement", "dunning_communication_delay_enabled", "dunning_communication_delay_time_zone", "skip_billing_manifest_taxes")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product_handle", "product_id", "product_price_point_handle", "product_price_point_id", "custom_price", "coupon_code", "coupon_codes", "payment_collection_method", "receives_invoice_emails", "net_terms", "customer_id", "next_billing_at", "initial_billing_at", "stored_credential_transaction_id", "sales_rep_id", "payment_profile_id", "reference", "customer_attributes", "payment_profile_attributes", "credit_card_attributes", "bank_account_attributes", "components", "calendar_billing", "metafields", "customer_reference", "group", "ref", "cancellation_message", "cancellation_method", "currency", "expires_at", "expiration_tracks_next_billing_change", "agreement_terms", "authorizer_first_name", "authorizer_last_name", "calendar_billing_first_charge", "reason_code", "product_change_delayed", "offer_id", "prepaid_configuration", "previous_billing_at", "import_mrr", "canceled_at", "activated_at", "agreement_acceptance", "ach_agreement", "dunning_communication_delay_enabled", "dunning_communication_delay_time_zone", "skip_billing_manifest_taxes")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ProductHandle = temp.ProductHandle
c.ProductId = temp.ProductId
c.ProductPricePointHandle = temp.ProductPricePointHandle
@@ -427,7 +427,7 @@ type tempCreateSubscription struct {
ActivatedAt *string `json:"activated_at,omitempty"`
AgreementAcceptance *AgreementAcceptance `json:"agreement_acceptance,omitempty"`
AchAgreement *ACHAgreement `json:"ach_agreement,omitempty"`
- DunningCommunicationDelayEnabled Optional[bool] `json:"dunning_communication_delay_enabled"`
+ DunningCommunicationDelayEnabled *bool `json:"dunning_communication_delay_enabled,omitempty"`
DunningCommunicationDelayTimeZone Optional[string] `json:"dunning_communication_delay_time_zone"`
SkipBillingManifestTaxes *bool `json:"skip_billing_manifest_taxes,omitempty"`
}
diff --git a/models/create_subscription_component.go b/models/create_subscription_component.go
index 7e31ff47..be0415ac 100644
--- a/models/create_subscription_component.go
+++ b/models/create_subscription_component.go
@@ -23,7 +23,7 @@ type CreateSubscriptionComponent struct {
PricePointId *CreateSubscriptionComponentPricePointId `json:"price_point_id,omitempty"`
// Create or update custom pricing unique to the subscription. Used in place of `price_point_id`.
CustomPrice *ComponentCustomPrice `json:"custom_price,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateSubscriptionComponent.
@@ -31,13 +31,17 @@ type CreateSubscriptionComponent struct {
func (c CreateSubscriptionComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "component_id", "enabled", "unit_balance", "allocated_quantity", "quantity", "price_point_id", "custom_price"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateSubscriptionComponent object to a map representation for JSON marshaling.
func (c CreateSubscriptionComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.ComponentId != nil {
structMap["component_id"] = c.ComponentId.toMap()
}
@@ -70,12 +74,12 @@ func (c *CreateSubscriptionComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component_id", "enabled", "unit_balance", "allocated_quantity", "quantity", "price_point_id", "custom_price")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component_id", "enabled", "unit_balance", "allocated_quantity", "quantity", "price_point_id", "custom_price")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.ComponentId = temp.ComponentId
c.Enabled = temp.Enabled
c.UnitBalance = temp.UnitBalance
diff --git a/models/create_subscription_group.go b/models/create_subscription_group.go
index 5afd7542..537e7696 100644
--- a/models/create_subscription_group.go
+++ b/models/create_subscription_group.go
@@ -13,9 +13,9 @@ import (
// CreateSubscriptionGroup represents a CreateSubscriptionGroup struct.
type CreateSubscriptionGroup struct {
- SubscriptionId int `json:"subscription_id"`
- MemberIds []int `json:"member_ids,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ SubscriptionId int `json:"subscription_id"`
+ MemberIds []int `json:"member_ids,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateSubscriptionGroup.
@@ -23,13 +23,17 @@ type CreateSubscriptionGroup struct {
func (c CreateSubscriptionGroup) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "subscription_id", "member_ids"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateSubscriptionGroup object to a map representation for JSON marshaling.
func (c CreateSubscriptionGroup) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["subscription_id"] = c.SubscriptionId
if c.MemberIds != nil {
structMap["member_ids"] = c.MemberIds
@@ -49,12 +53,12 @@ func (c *CreateSubscriptionGroup) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_id", "member_ids")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_id", "member_ids")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.SubscriptionId = *temp.SubscriptionId
c.MemberIds = temp.MemberIds
return nil
diff --git a/models/create_subscription_group_request.go b/models/create_subscription_group_request.go
index 36573568..fa582a61 100644
--- a/models/create_subscription_group_request.go
+++ b/models/create_subscription_group_request.go
@@ -14,7 +14,7 @@ import (
// CreateSubscriptionGroupRequest represents a CreateSubscriptionGroupRequest struct.
type CreateSubscriptionGroupRequest struct {
SubscriptionGroup CreateSubscriptionGroup `json:"subscription_group"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateSubscriptionGroupRequest.
@@ -22,13 +22,17 @@ type CreateSubscriptionGroupRequest struct {
func (c CreateSubscriptionGroupRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "subscription_group"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateSubscriptionGroupRequest object to a map representation for JSON marshaling.
func (c CreateSubscriptionGroupRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["subscription_group"] = c.SubscriptionGroup.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateSubscriptionGroupRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_group")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_group")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.SubscriptionGroup = *temp.SubscriptionGroup
return nil
}
diff --git a/models/create_subscription_request.go b/models/create_subscription_request.go
index 8a7decec..432ddcc3 100644
--- a/models/create_subscription_request.go
+++ b/models/create_subscription_request.go
@@ -13,8 +13,8 @@ import (
// CreateSubscriptionRequest represents a CreateSubscriptionRequest struct.
type CreateSubscriptionRequest struct {
- Subscription CreateSubscription `json:"subscription"`
- AdditionalProperties map[string]any `json:"_"`
+ Subscription CreateSubscription `json:"subscription"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateSubscriptionRequest.
@@ -22,13 +22,17 @@ type CreateSubscriptionRequest struct {
func (c CreateSubscriptionRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "subscription"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateSubscriptionRequest object to a map representation for JSON marshaling.
func (c CreateSubscriptionRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["subscription"] = c.Subscription.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateSubscriptionRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Subscription = *temp.Subscription
return nil
}
diff --git a/models/create_usage.go b/models/create_usage.go
index 42576e87..79dce9f6 100644
--- a/models/create_usage.go
+++ b/models/create_usage.go
@@ -12,12 +12,12 @@ import (
// CreateUsage represents a CreateUsage struct.
type CreateUsage struct {
// integer by default or decimal number if fractional quantities are enabled for the component
- Quantity *float64 `json:"quantity,omitempty"`
- PricePointId *string `json:"price_point_id,omitempty"`
- Memo *string `json:"memo,omitempty"`
+ Quantity *float64 `json:"quantity,omitempty"`
+ PricePointId *string `json:"price_point_id,omitempty"`
+ Memo *string `json:"memo,omitempty"`
// This attribute is particularly useful when you need to align billing events for different components on distinct schedules within a subscription. Please note this only works for site with Multifrequency enabled
- BillingSchedule *BillingSchedule `json:"billing_schedule,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ BillingSchedule *BillingSchedule `json:"billing_schedule,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateUsage.
@@ -25,13 +25,17 @@ type CreateUsage struct {
func (c CreateUsage) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "quantity", "price_point_id", "memo", "billing_schedule"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateUsage object to a map representation for JSON marshaling.
func (c CreateUsage) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Quantity != nil {
structMap["quantity"] = c.Quantity
}
@@ -55,12 +59,12 @@ func (c *CreateUsage) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "quantity", "price_point_id", "memo", "billing_schedule")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "quantity", "price_point_id", "memo", "billing_schedule")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Quantity = temp.Quantity
c.PricePointId = temp.PricePointId
c.Memo = temp.Memo
diff --git a/models/create_usage_request.go b/models/create_usage_request.go
index 8c476b56..5d078949 100644
--- a/models/create_usage_request.go
+++ b/models/create_usage_request.go
@@ -13,8 +13,8 @@ import (
// CreateUsageRequest represents a CreateUsageRequest struct.
type CreateUsageRequest struct {
- Usage CreateUsage `json:"usage"`
- AdditionalProperties map[string]any `json:"_"`
+ Usage CreateUsage `json:"usage"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreateUsageRequest.
@@ -22,13 +22,17 @@ type CreateUsageRequest struct {
func (c CreateUsageRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "usage"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreateUsageRequest object to a map representation for JSON marshaling.
func (c CreateUsageRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["usage"] = c.Usage.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreateUsageRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "usage")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "usage")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Usage = *temp.Usage
return nil
}
diff --git a/models/created_prepayment.go b/models/created_prepayment.go
index 1716ff78..9ee5e821 100644
--- a/models/created_prepayment.go
+++ b/models/created_prepayment.go
@@ -13,14 +13,14 @@ import (
// CreatedPrepayment represents a CreatedPrepayment struct.
type CreatedPrepayment struct {
- Id *int64 `json:"id,omitempty"`
- SubscriptionId *int `json:"subscription_id,omitempty"`
- AmountInCents *int64 `json:"amount_in_cents,omitempty"`
- Memo *string `json:"memo,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- StartingBalanceInCents *int64 `json:"starting_balance_in_cents,omitempty"`
- EndingBalanceInCents *int64 `json:"ending_balance_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int64 `json:"id,omitempty"`
+ SubscriptionId *int `json:"subscription_id,omitempty"`
+ AmountInCents *int64 `json:"amount_in_cents,omitempty"`
+ Memo *string `json:"memo,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ StartingBalanceInCents *int64 `json:"starting_balance_in_cents,omitempty"`
+ EndingBalanceInCents *int64 `json:"ending_balance_in_cents,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreatedPrepayment.
@@ -28,13 +28,17 @@ type CreatedPrepayment struct {
func (c CreatedPrepayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "subscription_id", "amount_in_cents", "memo", "created_at", "starting_balance_in_cents", "ending_balance_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreatedPrepayment object to a map representation for JSON marshaling.
func (c CreatedPrepayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Id != nil {
structMap["id"] = c.Id
}
@@ -67,12 +71,12 @@ func (c *CreatedPrepayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "subscription_id", "amount_in_cents", "memo", "created_at", "starting_balance_in_cents", "ending_balance_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "subscription_id", "amount_in_cents", "memo", "created_at", "starting_balance_in_cents", "ending_balance_in_cents")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = temp.Id
c.SubscriptionId = temp.SubscriptionId
c.AmountInCents = temp.AmountInCents
diff --git a/models/credit_account_balance_changed.go b/models/credit_account_balance_changed.go
index 5feb20ea..17ea8db5 100644
--- a/models/credit_account_balance_changed.go
+++ b/models/credit_account_balance_changed.go
@@ -15,12 +15,12 @@ import (
// CreditAccountBalanceChanged represents a CreditAccountBalanceChanged struct.
type CreditAccountBalanceChanged struct {
- Reason string `json:"reason"`
- ServiceCreditAccountBalanceInCents int64 `json:"service_credit_account_balance_in_cents"`
- ServiceCreditBalanceChangeInCents int64 `json:"service_credit_balance_change_in_cents"`
- CurrencyCode string `json:"currency_code"`
- AtTime time.Time `json:"at_time"`
- AdditionalProperties map[string]any `json:"_"`
+ Reason string `json:"reason"`
+ ServiceCreditAccountBalanceInCents int64 `json:"service_credit_account_balance_in_cents"`
+ ServiceCreditBalanceChangeInCents int64 `json:"service_credit_balance_change_in_cents"`
+ CurrencyCode string `json:"currency_code"`
+ AtTime time.Time `json:"at_time"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreditAccountBalanceChanged.
@@ -28,13 +28,17 @@ type CreditAccountBalanceChanged struct {
func (c CreditAccountBalanceChanged) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "reason", "service_credit_account_balance_in_cents", "service_credit_balance_change_in_cents", "currency_code", "at_time"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreditAccountBalanceChanged object to a map representation for JSON marshaling.
func (c CreditAccountBalanceChanged) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["reason"] = c.Reason
structMap["service_credit_account_balance_in_cents"] = c.ServiceCreditAccountBalanceInCents
structMap["service_credit_balance_change_in_cents"] = c.ServiceCreditBalanceChangeInCents
@@ -55,12 +59,12 @@ func (c *CreditAccountBalanceChanged) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "reason", "service_credit_account_balance_in_cents", "service_credit_balance_change_in_cents", "currency_code", "at_time")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "reason", "service_credit_account_balance_in_cents", "service_credit_balance_change_in_cents", "currency_code", "at_time")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Reason = *temp.Reason
c.ServiceCreditAccountBalanceInCents = *temp.ServiceCreditAccountBalanceInCents
c.ServiceCreditBalanceChangeInCents = *temp.ServiceCreditBalanceChangeInCents
diff --git a/models/credit_card_attributes.go b/models/credit_card_attributes.go
index c0c38819..d226fd5b 100644
--- a/models/credit_card_attributes.go
+++ b/models/credit_card_attributes.go
@@ -11,10 +11,10 @@ import (
// CreditCardAttributes represents a CreditCardAttributes struct.
type CreditCardAttributes struct {
- FullNumber *string `json:"full_number,omitempty"`
- ExpirationMonth *string `json:"expiration_month,omitempty"`
- ExpirationYear *string `json:"expiration_year,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ FullNumber *string `json:"full_number,omitempty"`
+ ExpirationMonth *string `json:"expiration_month,omitempty"`
+ ExpirationYear *string `json:"expiration_year,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreditCardAttributes.
@@ -22,13 +22,17 @@ type CreditCardAttributes struct {
func (c CreditCardAttributes) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "full_number", "expiration_month", "expiration_year"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreditCardAttributes object to a map representation for JSON marshaling.
func (c CreditCardAttributes) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.FullNumber != nil {
structMap["full_number"] = c.FullNumber
}
@@ -49,12 +53,12 @@ func (c *CreditCardAttributes) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "full_number", "expiration_month", "expiration_year")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "full_number", "expiration_month", "expiration_year")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.FullNumber = temp.FullNumber
c.ExpirationMonth = temp.ExpirationMonth
c.ExpirationYear = temp.ExpirationYear
diff --git a/models/credit_card_payment_profile.go b/models/credit_card_payment_profile.go
index 908558ed..194cdf20 100644
--- a/models/credit_card_payment_profile.go
+++ b/models/credit_card_payment_profile.go
@@ -14,47 +14,47 @@ import (
// 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"`
+ Id *int `json:"id,omitempty"`
// The first name of the card holder.
- FirstName *string `json:"first_name,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
// The last name of the card holder.
- LastName *string `json:"last_name,omitempty"`
+ 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,omitempty"`
// The type of card used.
- CardType *CardType `json:"card_type,omitempty"`
+ CardType *CardType `json:"card_type,omitempty"`
// An integer representing the expiration month of the card(1 – 12).
- ExpirationMonth *int `json:"expiration_month,omitempty"`
+ ExpirationMonth *int `json:"expiration_month,omitempty"`
// An integer representing the 4-digit expiration year of the card(i.e. ‘2012’).
- ExpirationYear *int `json:"expiration_year,omitempty"`
+ ExpirationYear *int `json:"expiration_year,omitempty"`
// The Chargify-assigned id for the customer record to which the card belongs.
- CustomerId *int `json:"customer_id,omitempty"`
+ CustomerId *int `json:"customer_id,omitempty"`
// The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing.
- CurrentVault *CreditCardVault `json:"current_vault,omitempty"`
+ CurrentVault *CreditCardVault `json:"current_vault,omitempty"`
// The “token” provided by your vault storage for an already stored payment profile.
- VaultToken Optional[string] `json:"vault_token"`
+ VaultToken Optional[string] `json:"vault_token"`
// The current billing street address for the card.
- BillingAddress Optional[string] `json:"billing_address"`
+ BillingAddress Optional[string] `json:"billing_address"`
// The current billing address city for the card.
- BillingCity Optional[string] `json:"billing_city"`
+ BillingCity Optional[string] `json:"billing_city"`
// The current billing address state for the card.
- BillingState Optional[string] `json:"billing_state"`
+ BillingState Optional[string] `json:"billing_state"`
// The current billing address zip code for the card.
- BillingZip Optional[string] `json:"billing_zip"`
+ BillingZip Optional[string] `json:"billing_zip"`
// The current billing address country for the card.
- BillingCountry Optional[string] `json:"billing_country"`
+ 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"`
+ CustomerVaultToken Optional[string] `json:"customer_vault_token"`
// The current billing street address, second line, for the card.
- BillingAddress2 Optional[string] `json:"billing_address_2"`
- PaymentType PaymentType `json:"payment_type"`
- Disabled *bool `json:"disabled,omitempty"`
+ BillingAddress2 Optional[string] `json:"billing_address_2"`
+ PaymentType PaymentType `json:"payment_type"`
+ Disabled *bool `json:"disabled,omitempty"`
// 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"`
+ 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"`
- AdditionalProperties map[string]any `json:"_"`
+ GatewayHandle Optional[string] `json:"gateway_handle"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreditCardPaymentProfile.
@@ -62,13 +62,17 @@ type CreditCardPaymentProfile struct {
func (c CreditCardPaymentProfile) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "first_name", "last_name", "masked_card_number", "card_type", "expiration_month", "expiration_year", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "payment_type", "disabled", "chargify_token", "site_gateway_setting_id", "gateway_handle"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreditCardPaymentProfile object to a map representation for JSON marshaling.
func (c CreditCardPaymentProfile) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Id != nil {
structMap["id"] = c.Id
}
@@ -188,12 +192,12 @@ func (c *CreditCardPaymentProfile) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "first_name", "last_name", "masked_card_number", "card_type", "expiration_month", "expiration_year", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "payment_type", "disabled", "chargify_token", "site_gateway_setting_id", "gateway_handle")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "first_name", "last_name", "masked_card_number", "card_type", "expiration_month", "expiration_year", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "payment_type", "disabled", "chargify_token", "site_gateway_setting_id", "gateway_handle")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = temp.Id
c.FirstName = temp.FirstName
c.LastName = temp.LastName
diff --git a/models/credit_note.go b/models/credit_note.go
index a7005709..94991ef2 100644
--- a/models/credit_note.go
+++ b/models/credit_note.go
@@ -67,7 +67,7 @@ type CreditNote struct {
Refunds []InvoiceRefund `json:"refunds,omitempty"`
// An array of origin invoices for the credit note. Learn more about [Origin Invoice from our docs](https://maxio.zendesk.com/hc/en-us/articles/24252261284749-Credit-Notes-Proration#origin-invoices)
OriginInvoices []OriginInvoice `json:"origin_invoices,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreditNote.
@@ -75,13 +75,17 @@ type CreditNote struct {
func (c CreditNote) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "issue_date", "applied_date", "status", "currency", "memo", "seller", "customer", "billing_address", "shipping_address", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "applied_amount", "remaining_amount", "line_items", "discounts", "taxes", "applications", "refunds", "origin_invoices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreditNote object to a map representation for JSON marshaling.
func (c CreditNote) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Uid != nil {
structMap["uid"] = c.Uid
}
@@ -174,12 +178,12 @@ func (c *CreditNote) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "issue_date", "applied_date", "status", "currency", "memo", "seller", "customer", "billing_address", "shipping_address", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "applied_amount", "remaining_amount", "line_items", "discounts", "taxes", "applications", "refunds", "origin_invoices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "issue_date", "applied_date", "status", "currency", "memo", "seller", "customer", "billing_address", "shipping_address", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "applied_amount", "remaining_amount", "line_items", "discounts", "taxes", "applications", "refunds", "origin_invoices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Uid = temp.Uid
c.SiteId = temp.SiteId
c.CustomerId = temp.CustomerId
diff --git a/models/credit_note_application.go b/models/credit_note_application.go
index 5394322c..2a2889aa 100644
--- a/models/credit_note_application.go
+++ b/models/credit_note_application.go
@@ -13,12 +13,12 @@ import (
// CreditNoteApplication represents a CreditNoteApplication struct.
type CreditNoteApplication struct {
- Uid *string `json:"uid,omitempty"`
- TransactionTime *time.Time `json:"transaction_time,omitempty"`
- InvoiceUid *string `json:"invoice_uid,omitempty"`
- Memo *string `json:"memo,omitempty"`
- AppliedAmount *string `json:"applied_amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Uid *string `json:"uid,omitempty"`
+ TransactionTime *time.Time `json:"transaction_time,omitempty"`
+ InvoiceUid *string `json:"invoice_uid,omitempty"`
+ Memo *string `json:"memo,omitempty"`
+ AppliedAmount *string `json:"applied_amount,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreditNoteApplication.
@@ -26,13 +26,17 @@ type CreditNoteApplication struct {
func (c CreditNoteApplication) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "uid", "transaction_time", "invoice_uid", "memo", "applied_amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreditNoteApplication object to a map representation for JSON marshaling.
func (c CreditNoteApplication) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Uid != nil {
structMap["uid"] = c.Uid
}
@@ -59,12 +63,12 @@ func (c *CreditNoteApplication) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "transaction_time", "invoice_uid", "memo", "applied_amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "transaction_time", "invoice_uid", "memo", "applied_amount")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Uid = temp.Uid
if temp.TransactionTime != nil {
TransactionTimeVal, err := time.Parse(time.RFC3339, *temp.TransactionTime)
diff --git a/models/credit_note_line_item.go b/models/credit_note_line_item.go
index e9d2473b..65709113 100644
--- a/models/credit_note_line_item.go
+++ b/models/credit_note_line_item.go
@@ -14,47 +14,47 @@ import (
// CreditNoteLineItem represents a CreditNoteLineItem struct.
type CreditNoteLineItem struct {
// Unique identifier for the line item. Useful when cross-referencing the line against individual discounts in the `discounts` or `taxes` lists.
- Uid *string `json:"uid,omitempty"`
+ Uid *string `json:"uid,omitempty"`
// A short descriptor for the credit given by this line.
- Title *string `json:"title,omitempty"`
+ Title *string `json:"title,omitempty"`
// Detailed description for the credit given by this line. May include proration details in plain text.
// Note: this string may contain line breaks that are hints for the best display format on the credit note.
- Description *string `json:"description,omitempty"`
+ Description *string `json:"description,omitempty"`
// The quantity or count of units credited by the line item.
// This is a decimal number represented as a string. (See "About Decimal Numbers".)
- Quantity *string `json:"quantity,omitempty"`
+ Quantity *string `json:"quantity,omitempty"`
// The price per unit for the line item.
// When tiered pricing was used (i.e. not every unit was actually priced at the same price) this will be the blended average cost per unit and the `tiered_unit_price` field will be set to `true`.
- UnitPrice *string `json:"unit_price,omitempty"`
+ UnitPrice *string `json:"unit_price,omitempty"`
// The line subtotal, generally calculated as `quantity * unit_price`. This is the canonical amount of record for the line - when rounding differences are in play, `subtotal_amount` takes precedence over the value derived from `quantity * unit_price` (which may not have the proper precision to exactly equal this amount).
- SubtotalAmount *string `json:"subtotal_amount,omitempty"`
+ SubtotalAmount *string `json:"subtotal_amount,omitempty"`
// The approximate discount of just this line.
// The value is approximated in cases where rounding errors make it difficult to apportion exactly a total discount among many lines. Several lines may have been summed prior to applying the discount to arrive at `discount_amount` for the invoice - backing that out to the discount on a single line may introduce rounding or precision errors.
- DiscountAmount *string `json:"discount_amount,omitempty"`
+ DiscountAmount *string `json:"discount_amount,omitempty"`
// The approximate tax of just this line.
// The value is approximated in cases where rounding errors make it difficult to apportion exactly a total tax among many lines. Several lines may have been summed prior to applying the tax rate to arrive at `tax_amount` for the invoice - backing that out to the tax on a single line may introduce rounding or precision errors.
- TaxAmount *string `json:"tax_amount,omitempty"`
+ TaxAmount *string `json:"tax_amount,omitempty"`
// The non-canonical total amount for the line.
// `subtotal_amount` is the canonical amount for a line. The invoice `total_amount` is derived from the sum of the line `subtotal_amount`s and discounts or taxes applied thereafter. Therefore, due to rounding or precision errors, the sum of line `total_amount`s may not equal the invoice `total_amount`.
- TotalAmount *string `json:"total_amount,omitempty"`
+ TotalAmount *string `json:"total_amount,omitempty"`
// When `true`, indicates that the actual pricing scheme for the line was tiered, so the `unit_price` shown is the blended average for all units.
- TieredUnitPrice *bool `json:"tiered_unit_price,omitempty"`
+ TieredUnitPrice *bool `json:"tiered_unit_price,omitempty"`
// Start date for the period credited by this line. The format is `"YYYY-MM-DD"`.
- PeriodRangeStart *time.Time `json:"period_range_start,omitempty"`
+ PeriodRangeStart *time.Time `json:"period_range_start,omitempty"`
// End date for the period credited by this line. The format is `"YYYY-MM-DD"`.
- PeriodRangeEnd *time.Time `json:"period_range_end,omitempty"`
+ PeriodRangeEnd *time.Time `json:"period_range_end,omitempty"`
// The ID of the product being credited.
// This may be set even for component credits, so true product-only (non-component) credits will also have a nil `component_id`.
- ProductId *int `json:"product_id,omitempty"`
+ ProductId *int `json:"product_id,omitempty"`
// The version of the product being credited.
- ProductVersion *int `json:"product_version,omitempty"`
+ ProductVersion *int `json:"product_version,omitempty"`
// The ID of the component being credited. Will be `nil` for non-component credits.
- ComponentId Optional[int] `json:"component_id"`
+ ComponentId Optional[int] `json:"component_id"`
// The price point ID of the component being credited. Will be `nil` for non-component credits.
- PricePointId Optional[int] `json:"price_point_id"`
- BillingScheduleItemId Optional[int] `json:"billing_schedule_item_id"`
- CustomItem *bool `json:"custom_item,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PricePointId Optional[int] `json:"price_point_id"`
+ BillingScheduleItemId Optional[int] `json:"billing_schedule_item_id"`
+ CustomItem *bool `json:"custom_item,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreditNoteLineItem.
@@ -62,13 +62,17 @@ type CreditNoteLineItem struct {
func (c CreditNoteLineItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "uid", "title", "description", "quantity", "unit_price", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "tiered_unit_price", "period_range_start", "period_range_end", "product_id", "product_version", "component_id", "price_point_id", "billing_schedule_item_id", "custom_item"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreditNoteLineItem object to a map representation for JSON marshaling.
func (c CreditNoteLineItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Uid != nil {
structMap["uid"] = c.Uid
}
@@ -146,12 +150,12 @@ func (c *CreditNoteLineItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "title", "description", "quantity", "unit_price", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "tiered_unit_price", "period_range_start", "period_range_end", "product_id", "product_version", "component_id", "price_point_id", "billing_schedule_item_id", "custom_item")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "title", "description", "quantity", "unit_price", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "tiered_unit_price", "period_range_start", "period_range_end", "product_id", "product_version", "component_id", "price_point_id", "billing_schedule_item_id", "custom_item")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Uid = temp.Uid
c.Title = temp.Title
c.Description = temp.Description
diff --git a/models/credit_scheme_request.go b/models/credit_scheme_request.go
index 88994fba..ddb756d5 100644
--- a/models/credit_scheme_request.go
+++ b/models/credit_scheme_request.go
@@ -13,8 +13,8 @@ import (
// CreditSchemeRequest represents a CreditSchemeRequest struct.
type CreditSchemeRequest struct {
- CreditScheme CreditScheme `json:"credit_scheme"`
- AdditionalProperties map[string]any `json:"_"`
+ CreditScheme CreditScheme `json:"credit_scheme"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CreditSchemeRequest.
@@ -22,13 +22,17 @@ type CreditSchemeRequest struct {
func (c CreditSchemeRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "credit_scheme"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CreditSchemeRequest object to a map representation for JSON marshaling.
func (c CreditSchemeRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["credit_scheme"] = c.CreditScheme
return structMap
}
@@ -45,12 +49,12 @@ func (c *CreditSchemeRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "credit_scheme")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "credit_scheme")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.CreditScheme = *temp.CreditScheme
return nil
}
diff --git a/models/currency_price.go b/models/currency_price.go
index 10240531..cd6836ff 100644
--- a/models/currency_price.go
+++ b/models/currency_price.go
@@ -11,14 +11,16 @@ import (
// CurrencyPrice represents a CurrencyPrice struct.
type CurrencyPrice struct {
- Id *int `json:"id,omitempty"`
- Currency *string `json:"currency,omitempty"`
- Price *float64 `json:"price,omitempty"`
- FormattedPrice *string `json:"formatted_price,omitempty"`
- ProductPricePointId *int `json:"product_price_point_id,omitempty"`
+ Id *int `json:"id,omitempty"`
+ Currency *string `json:"currency,omitempty"`
+ Price *float64 `json:"price,omitempty"`
+ FormattedPrice *string `json:"formatted_price,omitempty"`
+ PriceId *int `json:"price_id,omitempty"`
+ PricePointId *int `json:"price_point_id,omitempty"`
+ ProductPricePointId *int `json:"product_price_point_id,omitempty"`
// Role for the price.
- Role *CurrencyPriceRole `json:"role,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Role *CurrencyPriceRole `json:"role,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CurrencyPrice.
@@ -26,13 +28,17 @@ type CurrencyPrice struct {
func (c CurrencyPrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "id", "currency", "price", "formatted_price", "price_id", "price_point_id", "product_price_point_id", "role"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CurrencyPrice object to a map representation for JSON marshaling.
func (c CurrencyPrice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Id != nil {
structMap["id"] = c.Id
}
@@ -45,6 +51,12 @@ func (c CurrencyPrice) toMap() map[string]any {
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
+ }
if c.ProductPricePointId != nil {
structMap["product_price_point_id"] = c.ProductPricePointId
}
@@ -62,16 +74,18 @@ func (c *CurrencyPrice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "currency", "price", "formatted_price", "product_price_point_id", "role")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "currency", "price", "formatted_price", "price_id", "price_point_id", "product_price_point_id", "role")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Id = temp.Id
c.Currency = temp.Currency
c.Price = temp.Price
c.FormattedPrice = temp.FormattedPrice
+ c.PriceId = temp.PriceId
+ c.PricePointId = temp.PricePointId
c.ProductPricePointId = temp.ProductPricePointId
c.Role = temp.Role
return nil
@@ -83,6 +97,8 @@ type tempCurrencyPrice struct {
Currency *string `json:"currency,omitempty"`
Price *float64 `json:"price,omitempty"`
FormattedPrice *string `json:"formatted_price,omitempty"`
+ PriceId *int `json:"price_id,omitempty"`
+ PricePointId *int `json:"price_point_id,omitempty"`
ProductPricePointId *int `json:"product_price_point_id,omitempty"`
Role *CurrencyPriceRole `json:"role,omitempty"`
}
diff --git a/models/currency_prices_response.go b/models/currency_prices_response.go
index fb48d32f..08cb5e89 100644
--- a/models/currency_prices_response.go
+++ b/models/currency_prices_response.go
@@ -13,8 +13,8 @@ import (
// CurrencyPricesResponse represents a CurrencyPricesResponse struct.
type CurrencyPricesResponse struct {
- CurrencyPrices []CurrencyPrice `json:"currency_prices"`
- AdditionalProperties map[string]any `json:"_"`
+ CurrencyPrices []CurrencyPrice `json:"currency_prices"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CurrencyPricesResponse.
@@ -22,13 +22,17 @@ type CurrencyPricesResponse struct {
func (c CurrencyPricesResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "currency_prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CurrencyPricesResponse object to a map representation for JSON marshaling.
func (c CurrencyPricesResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["currency_prices"] = c.CurrencyPrices
return structMap
}
@@ -45,12 +49,12 @@ func (c *CurrencyPricesResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currency_prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currency_prices")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.CurrencyPrices = *temp.CurrencyPrices
return nil
}
diff --git a/models/custom_field_value_change.go b/models/custom_field_value_change.go
index e595b1a6..f260ef36 100644
--- a/models/custom_field_value_change.go
+++ b/models/custom_field_value_change.go
@@ -13,14 +13,14 @@ import (
// CustomFieldValueChange represents a CustomFieldValueChange struct.
type CustomFieldValueChange struct {
- EventType string `json:"event_type"`
- MetafieldName string `json:"metafield_name"`
- MetafieldId int `json:"metafield_id"`
- OldValue *string `json:"old_value"`
- NewValue *string `json:"new_value"`
- ResourceType string `json:"resource_type"`
- ResourceId int `json:"resource_id"`
- AdditionalProperties map[string]any `json:"_"`
+ EventType string `json:"event_type"`
+ MetafieldName string `json:"metafield_name"`
+ MetafieldId int `json:"metafield_id"`
+ OldValue *string `json:"old_value"`
+ NewValue *string `json:"new_value"`
+ ResourceType string `json:"resource_type"`
+ ResourceId int `json:"resource_id"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CustomFieldValueChange.
@@ -28,13 +28,17 @@ type CustomFieldValueChange struct {
func (c CustomFieldValueChange) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "event_type", "metafield_name", "metafield_id", "old_value", "new_value", "resource_type", "resource_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CustomFieldValueChange object to a map representation for JSON marshaling.
func (c CustomFieldValueChange) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["event_type"] = c.EventType
structMap["metafield_name"] = c.MetafieldName
structMap["metafield_id"] = c.MetafieldId
@@ -65,12 +69,12 @@ func (c *CustomFieldValueChange) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "event_type", "metafield_name", "metafield_id", "old_value", "new_value", "resource_type", "resource_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "event_type", "metafield_name", "metafield_id", "old_value", "new_value", "resource_type", "resource_id")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.EventType = *temp.EventType
c.MetafieldName = *temp.MetafieldName
c.MetafieldId = *temp.MetafieldId
diff --git a/models/customer.go b/models/customer.go
index 1ac9fe1f..0bae1786 100644
--- a/models/customer.go
+++ b/models/customer.go
@@ -14,65 +14,65 @@ import (
// Customer represents a Customer struct.
type Customer struct {
// The first name of the customer
- FirstName *string `json:"first_name,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
// The last name of the customer
- LastName *string `json:"last_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
// The email address of the customer
- Email *string `json:"email,omitempty"`
+ Email *string `json:"email,omitempty"`
// A comma-separated list of emails that should be cc’d on all customer communications (i.e. “joe@example.com, sue@example.com”)
- CcEmails Optional[string] `json:"cc_emails"`
+ CcEmails Optional[string] `json:"cc_emails"`
// The organization of the customer. If no value, `null` or empty string is provided, `organization` will be populated with the customer's first and last name, separated with a space.
- Organization Optional[string] `json:"organization"`
+ Organization Optional[string] `json:"organization"`
// The unique identifier used within your own application for this customer
- Reference Optional[string] `json:"reference"`
+ Reference Optional[string] `json:"reference"`
// The customer ID in Chargify
- Id *int `json:"id,omitempty"`
+ Id *int `json:"id,omitempty"`
// The timestamp in which the customer object was created in Chargify
- CreatedAt *time.Time `json:"created_at,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
// The timestamp in which the customer object was last edited
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
+ UpdatedAt *time.Time `json:"updated_at,omitempty"`
// The customer’s shipping street address (i.e. “123 Main St.”)
- Address Optional[string] `json:"address"`
+ Address Optional[string] `json:"address"`
// Second line of the customer’s shipping address i.e. “Apt. 100”
- Address2 Optional[string] `json:"address_2"`
+ Address2 Optional[string] `json:"address_2"`
// The customer’s shipping address city (i.e. “Boston”)
- City Optional[string] `json:"city"`
+ City Optional[string] `json:"city"`
// The customer’s shipping address state (i.e. “MA”)
- State Optional[string] `json:"state"`
+ State Optional[string] `json:"state"`
// The customer's full name of state
- StateName Optional[string] `json:"state_name"`
+ StateName Optional[string] `json:"state_name"`
// The customer’s shipping address zip code (i.e. “12345”)
- Zip Optional[string] `json:"zip"`
+ Zip Optional[string] `json:"zip"`
// The customer shipping address country
- Country Optional[string] `json:"country"`
+ Country Optional[string] `json:"country"`
// The customer's full name of country
- CountryName Optional[string] `json:"country_name"`
+ CountryName Optional[string] `json:"country_name"`
// The phone number of the customer
- Phone Optional[string] `json:"phone"`
+ Phone Optional[string] `json:"phone"`
// Is the customer verified to use ACH as a payment method.
- Verified Optional[bool] `json:"verified"`
+ Verified Optional[bool] `json:"verified"`
// The timestamp of when the Billing Portal entry was created at for the customer
- PortalCustomerCreatedAt Optional[time.Time] `json:"portal_customer_created_at"`
+ PortalCustomerCreatedAt Optional[time.Time] `json:"portal_customer_created_at"`
// The timestamp of when the Billing Portal invite was last sent at
- PortalInviteLastSentAt Optional[time.Time] `json:"portal_invite_last_sent_at"`
+ PortalInviteLastSentAt Optional[time.Time] `json:"portal_invite_last_sent_at"`
// The timestamp of when the Billing Portal invite was last accepted
- PortalInviteLastAcceptedAt Optional[time.Time] `json:"portal_invite_last_accepted_at"`
+ PortalInviteLastAcceptedAt Optional[time.Time] `json:"portal_invite_last_accepted_at"`
// The tax exempt status for the customer. Acceptable values are true or 1 for true and false or 0 for false.
- TaxExempt *bool `json:"tax_exempt,omitempty"`
+ TaxExempt *bool `json:"tax_exempt,omitempty"`
// The VAT business identification number for the customer. This number is used to determine VAT tax opt out rules. It is not validated when added or updated on a customer record. Instead, it is validated via VIES before calculating taxes. Only valid business identification numbers will allow for VAT opt out.
- VatNumber Optional[string] `json:"vat_number"`
+ VatNumber Optional[string] `json:"vat_number"`
// The parent ID in Chargify if applicable. Parent is another Customer object.
- ParentId Optional[int] `json:"parent_id"`
+ ParentId Optional[int] `json:"parent_id"`
// The locale for the customer to identify language-region
- Locale Optional[string] `json:"locale"`
- DefaultSubscriptionGroupUid Optional[string] `json:"default_subscription_group_uid"`
+ Locale Optional[string] `json:"locale"`
+ DefaultSubscriptionGroupUid Optional[string] `json:"default_subscription_group_uid"`
// The Salesforce ID for the customer
- SalesforceId Optional[string] `json:"salesforce_id"`
+ SalesforceId Optional[string] `json:"salesforce_id"`
// The Tax Exemption Reason Code for the customer
- TaxExemptReason Optional[string] `json:"tax_exempt_reason"`
+ TaxExemptReason Optional[string] `json:"tax_exempt_reason"`
// The default auto-renewal profile ID for the customer
- DefaultAutoRenewalProfileId Optional[int] `json:"default_auto_renewal_profile_id"`
- AdditionalProperties map[string]any `json:"_"`
+ DefaultAutoRenewalProfileId Optional[int] `json:"default_auto_renewal_profile_id"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Customer.
@@ -80,13 +80,17 @@ type Customer struct {
func (c Customer) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "first_name", "last_name", "email", "cc_emails", "organization", "reference", "id", "created_at", "updated_at", "address", "address_2", "city", "state", "state_name", "zip", "country", "country_name", "phone", "verified", "portal_customer_created_at", "portal_invite_last_sent_at", "portal_invite_last_accepted_at", "tax_exempt", "vat_number", "parent_id", "locale", "default_subscription_group_uid", "salesforce_id", "tax_exempt_reason", "default_auto_renewal_profile_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the Customer object to a map representation for JSON marshaling.
func (c Customer) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.FirstName != nil {
structMap["first_name"] = c.FirstName
}
@@ -295,12 +299,12 @@ func (c *Customer) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "first_name", "last_name", "email", "cc_emails", "organization", "reference", "id", "created_at", "updated_at", "address", "address_2", "city", "state", "state_name", "zip", "country", "country_name", "phone", "verified", "portal_customer_created_at", "portal_invite_last_sent_at", "portal_invite_last_accepted_at", "tax_exempt", "vat_number", "parent_id", "locale", "default_subscription_group_uid", "salesforce_id", "tax_exempt_reason", "default_auto_renewal_profile_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "first_name", "last_name", "email", "cc_emails", "organization", "reference", "id", "created_at", "updated_at", "address", "address_2", "city", "state", "state_name", "zip", "country", "country_name", "phone", "verified", "portal_customer_created_at", "portal_invite_last_sent_at", "portal_invite_last_accepted_at", "tax_exempt", "vat_number", "parent_id", "locale", "default_subscription_group_uid", "salesforce_id", "tax_exempt_reason", "default_auto_renewal_profile_id")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.FirstName = temp.FirstName
c.LastName = temp.LastName
c.Email = temp.Email
diff --git a/models/customer_attributes.go b/models/customer_attributes.go
index 8402b8d9..1ad918d5 100644
--- a/models/customer_attributes.go
+++ b/models/customer_attributes.go
@@ -12,45 +12,45 @@ import (
// CustomerAttributes represents a CustomerAttributes struct.
type CustomerAttributes struct {
// The first name of the customer. Required when creating a customer via attributes.
- FirstName *string `json:"first_name,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
// The last name of the customer. Required when creating a customer via attributes.
- LastName *string `json:"last_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
// The email address of the customer. Required when creating a customer via attributes.
- Email *string `json:"email,omitempty"`
+ Email *string `json:"email,omitempty"`
// A list of emails that should be cc’d on all customer communications. Optional.
- CcEmails *string `json:"cc_emails,omitempty"`
+ CcEmails *string `json:"cc_emails,omitempty"`
// The organization/company of the customer. Optional.
- Organization *string `json:"organization,omitempty"`
+ Organization *string `json:"organization,omitempty"`
// A customer “reference”, or unique identifier from your app, stored in Chargify. Can be used so that you may reference your customer’s within Chargify using the same unique value you use in your application. Optional.
- Reference *string `json:"reference,omitempty"`
+ Reference *string `json:"reference,omitempty"`
// (Optional) The customer’s shipping street address (i.e. “123 Main St.”).
- Address *string `json:"address,omitempty"`
+ Address *string `json:"address,omitempty"`
// (Optional) Second line of the customer’s shipping address i.e. “Apt. 100”
- Address2 Optional[string] `json:"address_2"`
+ Address2 Optional[string] `json:"address_2"`
// (Optional) The customer’s shipping address city (i.e. “Boston”).
- City *string `json:"city,omitempty"`
+ City *string `json:"city,omitempty"`
// (Optional) The customer’s shipping address state (i.e. “MA”). 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.
- State *string `json:"state,omitempty"`
+ State *string `json:"state,omitempty"`
// (Optional) The customer’s shipping address zip code (i.e. “12345”).
- Zip *string `json:"zip,omitempty"`
+ Zip *string `json:"zip,omitempty"`
// (Optional) The customer shipping address country, required in [ISO_3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) format (i.e. “US”).
- Country *string `json:"country,omitempty"`
+ Country *string `json:"country,omitempty"`
// (Optional) The phone number of the customer.
- Phone *string `json:"phone,omitempty"`
- Verified *bool `json:"verified,omitempty"`
+ Phone *string `json:"phone,omitempty"`
+ Verified *bool `json:"verified,omitempty"`
// (Optional) The tax_exempt status of the customer. Acceptable values are true or 1 for true and false or 0 for false.
- TaxExempt *bool `json:"tax_exempt,omitempty"`
+ TaxExempt *bool `json:"tax_exempt,omitempty"`
// (Optional) Supplying the VAT number allows EU customer’s to opt-out of the Value Added Tax assuming the merchant address and customer billing address are not within the same EU country. It’s important to omit the country code from the VAT number upon entry. Otherwise, taxes will be assessed upon the purchase.
- VatNumber *string `json:"vat_number,omitempty"`
+ VatNumber *string `json:"vat_number,omitempty"`
// (Optional) A set of key/value pairs representing custom fields and their values. Metafields will be created “on-the-fly” in your site for a given key, if they have not been created yet.
- Metafields map[string]string `json:"metafields,omitempty"`
+ Metafields map[string]string `json:"metafields,omitempty"`
// The parent ID in Chargify if applicable. Parent is another Customer object.
- ParentId Optional[int] `json:"parent_id"`
+ ParentId Optional[int] `json:"parent_id"`
// (Optional) The Salesforce ID of the customer.
- SalesforceId Optional[string] `json:"salesforce_id"`
+ SalesforceId Optional[string] `json:"salesforce_id"`
// (Optional) The default auto-renewal profile ID for the customer
- DefaultAutoRenewalProfileId Optional[int] `json:"default_auto_renewal_profile_id"`
- AdditionalProperties map[string]any `json:"_"`
+ DefaultAutoRenewalProfileId Optional[int] `json:"default_auto_renewal_profile_id"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CustomerAttributes.
@@ -58,13 +58,17 @@ type CustomerAttributes struct {
func (c CustomerAttributes) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "verified", "tax_exempt", "vat_number", "metafields", "parent_id", "salesforce_id", "default_auto_renewal_profile_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CustomerAttributes object to a map representation for JSON marshaling.
func (c CustomerAttributes) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.FirstName != nil {
structMap["first_name"] = c.FirstName
}
@@ -152,12 +156,12 @@ func (c *CustomerAttributes) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "verified", "tax_exempt", "vat_number", "metafields", "parent_id", "salesforce_id", "default_auto_renewal_profile_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "verified", "tax_exempt", "vat_number", "metafields", "parent_id", "salesforce_id", "default_auto_renewal_profile_id")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.FirstName = temp.FirstName
c.LastName = temp.LastName
c.Email = temp.Email
diff --git a/models/customer_change.go b/models/customer_change.go
index e85fe264..8bfaca6b 100644
--- a/models/customer_change.go
+++ b/models/customer_change.go
@@ -15,7 +15,7 @@ type CustomerChange struct {
ShippingAddress Optional[AddressChange] `json:"shipping_address"`
BillingAddress Optional[AddressChange] `json:"billing_address"`
CustomFields Optional[CustomerCustomFieldsChange] `json:"custom_fields"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CustomerChange.
@@ -23,13 +23,17 @@ type CustomerChange struct {
func (c CustomerChange) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "payer", "shipping_address", "billing_address", "custom_fields"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CustomerChange object to a map representation for JSON marshaling.
func (c CustomerChange) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Payer.IsValueSet() {
if c.Payer.Value() != nil {
structMap["payer"] = c.Payer.Value().toMap()
@@ -69,12 +73,12 @@ func (c *CustomerChange) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payer", "shipping_address", "billing_address", "custom_fields")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payer", "shipping_address", "billing_address", "custom_fields")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Payer = temp.Payer
c.ShippingAddress = temp.ShippingAddress
c.BillingAddress = temp.BillingAddress
diff --git a/models/customer_changes_preview_response.go b/models/customer_changes_preview_response.go
index d2222b96..6a1b32f2 100644
--- a/models/customer_changes_preview_response.go
+++ b/models/customer_changes_preview_response.go
@@ -13,8 +13,8 @@ import (
// CustomerChangesPreviewResponse represents a CustomerChangesPreviewResponse struct.
type CustomerChangesPreviewResponse struct {
- Changes CustomerChange `json:"changes"`
- AdditionalProperties map[string]any `json:"_"`
+ Changes CustomerChange `json:"changes"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CustomerChangesPreviewResponse.
@@ -22,13 +22,17 @@ type CustomerChangesPreviewResponse struct {
func (c CustomerChangesPreviewResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "changes"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CustomerChangesPreviewResponse object to a map representation for JSON marshaling.
func (c CustomerChangesPreviewResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["changes"] = c.Changes.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CustomerChangesPreviewResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "changes")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "changes")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Changes = *temp.Changes
return nil
}
diff --git a/models/customer_custom_fields_change.go b/models/customer_custom_fields_change.go
index aa0d5a21..a66ad078 100644
--- a/models/customer_custom_fields_change.go
+++ b/models/customer_custom_fields_change.go
@@ -13,9 +13,9 @@ import (
// CustomerCustomFieldsChange represents a CustomerCustomFieldsChange struct.
type CustomerCustomFieldsChange struct {
- Before []InvoiceCustomField `json:"before"`
- After []InvoiceCustomField `json:"after"`
- AdditionalProperties map[string]any `json:"_"`
+ Before []InvoiceCustomField `json:"before"`
+ After []InvoiceCustomField `json:"after"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CustomerCustomFieldsChange.
@@ -23,13 +23,17 @@ type CustomerCustomFieldsChange struct {
func (c CustomerCustomFieldsChange) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "before", "after"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CustomerCustomFieldsChange object to a map representation for JSON marshaling.
func (c CustomerCustomFieldsChange) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["before"] = c.Before
structMap["after"] = c.After
return structMap
@@ -47,12 +51,12 @@ func (c *CustomerCustomFieldsChange) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "before", "after")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "before", "after")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Before = *temp.Before
c.After = *temp.After
return nil
diff --git a/models/customer_error.go b/models/customer_error.go
index e3fe6b81..897b39bb 100644
--- a/models/customer_error.go
+++ b/models/customer_error.go
@@ -11,8 +11,8 @@ import (
// CustomerError represents a CustomerError struct.
type CustomerError struct {
- Customer *string `json:"customer,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Customer *string `json:"customer,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CustomerError.
@@ -20,13 +20,17 @@ type CustomerError struct {
func (c CustomerError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "customer"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CustomerError object to a map representation for JSON marshaling.
func (c CustomerError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
if c.Customer != nil {
structMap["customer"] = c.Customer
}
@@ -41,12 +45,12 @@ func (c *CustomerError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "customer")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "customer")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Customer = temp.Customer
return nil
}
diff --git a/models/customer_payer_change.go b/models/customer_payer_change.go
index fca02913..8e88e48d 100644
--- a/models/customer_payer_change.go
+++ b/models/customer_payer_change.go
@@ -13,9 +13,9 @@ import (
// CustomerPayerChange represents a CustomerPayerChange struct.
type CustomerPayerChange struct {
- Before InvoicePayerChange `json:"before"`
- After InvoicePayerChange `json:"after"`
- AdditionalProperties map[string]any `json:"_"`
+ Before InvoicePayerChange `json:"before"`
+ After InvoicePayerChange `json:"after"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CustomerPayerChange.
@@ -23,13 +23,17 @@ type CustomerPayerChange struct {
func (c CustomerPayerChange) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "before", "after"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CustomerPayerChange object to a map representation for JSON marshaling.
func (c CustomerPayerChange) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["before"] = c.Before.toMap()
structMap["after"] = c.After.toMap()
return structMap
@@ -47,12 +51,12 @@ func (c *CustomerPayerChange) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "before", "after")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "before", "after")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Before = *temp.Before
c.After = *temp.After
return nil
diff --git a/models/customer_response.go b/models/customer_response.go
index ad5f521d..33daf186 100644
--- a/models/customer_response.go
+++ b/models/customer_response.go
@@ -13,8 +13,8 @@ import (
// CustomerResponse represents a CustomerResponse struct.
type CustomerResponse struct {
- Customer Customer `json:"customer"`
- AdditionalProperties map[string]any `json:"_"`
+ Customer Customer `json:"customer"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for CustomerResponse.
@@ -22,13 +22,17 @@ type CustomerResponse struct {
func (c CustomerResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(c.AdditionalProperties,
+ "customer"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(c.toMap())
}
// toMap converts the CustomerResponse object to a map representation for JSON marshaling.
func (c CustomerResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, c.AdditionalProperties)
+ MergeAdditionalProperties(structMap, c.AdditionalProperties)
structMap["customer"] = c.Customer.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (c *CustomerResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "customer")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "customer")
if err != nil {
return err
}
-
c.AdditionalProperties = additionalProperties
+
c.Customer = *temp.Customer
return nil
}
diff --git a/models/debit_note.go b/models/debit_note.go
index a371c80f..72d1767c 100644
--- a/models/debit_note.go
+++ b/models/debit_note.go
@@ -14,52 +14,52 @@ import (
// DebitNote represents a DebitNote struct.
type DebitNote struct {
// Unique identifier for the debit note. It is generated automatically by Chargify and has the prefix "db_" followed by alphanumeric characters.
- Uid *string `json:"uid,omitempty"`
+ Uid *string `json:"uid,omitempty"`
// ID of the site to which the debit note belongs.
- SiteId *int `json:"site_id,omitempty"`
+ SiteId *int `json:"site_id,omitempty"`
// ID of the customer to which the debit note belongs.
- CustomerId *int `json:"customer_id,omitempty"`
+ CustomerId *int `json:"customer_id,omitempty"`
// ID of the subscription that generated the debit note.
- SubscriptionId *int `json:"subscription_id,omitempty"`
+ SubscriptionId *int `json:"subscription_id,omitempty"`
// A unique, identifier that appears on the debit note and in places it is referenced.
- Number *int `json:"number,omitempty"`
+ Number *int `json:"number,omitempty"`
// A monotonically increasing number assigned to debit notes as they are created.
- SequenceNumber *int `json:"sequence_number,omitempty"`
+ SequenceNumber *int `json:"sequence_number,omitempty"`
// Unique identifier for the connected credit note. It is generated automatically by Chargify and has the prefix "cn_" followed by alphanumeric characters.
// While the UID is long and not appropriate to show to customers, the number is usually shorter and consumable by the customer and the merchant alike.
- OriginCreditNoteUid *string `json:"origin_credit_note_uid,omitempty"`
+ OriginCreditNoteUid *string `json:"origin_credit_note_uid,omitempty"`
// A unique, identifying string of the connected credit note.
- OriginCreditNoteNumber *string `json:"origin_credit_note_number,omitempty"`
+ OriginCreditNoteNumber *string `json:"origin_credit_note_number,omitempty"`
// Date the document was issued to the customer. This is the date that the document was made available for payment.
// The format is "YYYY-MM-DD".
- IssueDate *time.Time `json:"issue_date,omitempty"`
+ IssueDate *time.Time `json:"issue_date,omitempty"`
// Debit notes are applied to invoices to offset invoiced amounts - they adjust the amount due. This field is the date the debit note document became fully applied to the invoice.
// The format is "YYYY-MM-DD".
- AppliedDate *time.Time `json:"applied_date,omitempty"`
+ AppliedDate *time.Time `json:"applied_date,omitempty"`
// Date the document is due for payment. The format is "YYYY-MM-DD".
- DueDate *time.Time `json:"due_date,omitempty"`
+ DueDate *time.Time `json:"due_date,omitempty"`
// Current status of the debit note.
- Status *DebitNoteStatus `json:"status,omitempty"`
+ Status *DebitNoteStatus `json:"status,omitempty"`
// The memo printed on debit note, which is a description of the reason for the debit.
- Memo *string `json:"memo,omitempty"`
+ Memo *string `json:"memo,omitempty"`
// The role of the debit note.
- Role *DebitNoteRole `json:"role,omitempty"`
+ Role *DebitNoteRole `json:"role,omitempty"`
// The ISO 4217 currency code (3 character string) representing the currency of the credit note amount fields.
- Currency *string `json:"currency,omitempty"`
+ Currency *string `json:"currency,omitempty"`
// Information about the seller (merchant) listed on the masthead of the debit note.
- Seller *InvoiceSeller `json:"seller,omitempty"`
+ Seller *InvoiceSeller `json:"seller,omitempty"`
// Information about the customer who is owner or recipient the debited subscription.
- Customer *InvoiceCustomer `json:"customer,omitempty"`
+ Customer *InvoiceCustomer `json:"customer,omitempty"`
// The billing address of the debited subscription.
- BillingAddress *InvoiceAddress `json:"billing_address,omitempty"`
+ BillingAddress *InvoiceAddress `json:"billing_address,omitempty"`
// The shipping address of the debited subscription.
- ShippingAddress *InvoiceAddress `json:"shipping_address,omitempty"`
+ ShippingAddress *InvoiceAddress `json:"shipping_address,omitempty"`
// Line items on the debit note.
- LineItems []CreditNoteLineItem `json:"line_items,omitempty"`
- Discounts []InvoiceDiscount `json:"discounts,omitempty"`
- Taxes []InvoiceTax `json:"taxes,omitempty"`
- Refunds []InvoiceRefund `json:"refunds,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ LineItems []CreditNoteLineItem `json:"line_items,omitempty"`
+ Discounts []InvoiceDiscount `json:"discounts,omitempty"`
+ Taxes []InvoiceTax `json:"taxes,omitempty"`
+ Refunds []InvoiceRefund `json:"refunds,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for DebitNote.
@@ -67,13 +67,17 @@ type DebitNote struct {
func (d DebitNote) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(d.AdditionalProperties,
+ "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "origin_credit_note_uid", "origin_credit_note_number", "issue_date", "applied_date", "due_date", "status", "memo", "role", "currency", "seller", "customer", "billing_address", "shipping_address", "line_items", "discounts", "taxes", "refunds"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(d.toMap())
}
// toMap converts the DebitNote object to a map representation for JSON marshaling.
func (d DebitNote) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, d.AdditionalProperties)
+ MergeAdditionalProperties(structMap, d.AdditionalProperties)
if d.Uid != nil {
structMap["uid"] = d.Uid
}
@@ -154,12 +158,12 @@ func (d *DebitNote) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "origin_credit_note_uid", "origin_credit_note_number", "issue_date", "applied_date", "due_date", "status", "memo", "role", "currency", "seller", "customer", "billing_address", "shipping_address", "line_items", "discounts", "taxes", "refunds")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "origin_credit_note_uid", "origin_credit_note_number", "issue_date", "applied_date", "due_date", "status", "memo", "role", "currency", "seller", "customer", "billing_address", "shipping_address", "line_items", "discounts", "taxes", "refunds")
if err != nil {
return err
}
-
d.AdditionalProperties = additionalProperties
+
d.Uid = temp.Uid
d.SiteId = temp.SiteId
d.CustomerId = temp.CustomerId
diff --git a/models/deduct_service_credit.go b/models/deduct_service_credit.go
index b53e3129..c68f20d5 100644
--- a/models/deduct_service_credit.go
+++ b/models/deduct_service_credit.go
@@ -15,7 +15,7 @@ import (
type DeductServiceCredit struct {
Amount DeductServiceCreditAmount `json:"amount"`
Memo *string `json:"memo,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for DeductServiceCredit.
@@ -23,13 +23,17 @@ type DeductServiceCredit struct {
func (d DeductServiceCredit) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(d.AdditionalProperties,
+ "amount", "memo"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(d.toMap())
}
// toMap converts the DeductServiceCredit object to a map representation for JSON marshaling.
func (d DeductServiceCredit) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, d.AdditionalProperties)
+ MergeAdditionalProperties(structMap, d.AdditionalProperties)
structMap["amount"] = d.Amount.toMap()
if d.Memo != nil {
structMap["memo"] = d.Memo
@@ -49,12 +53,12 @@ func (d *DeductServiceCredit) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "amount", "memo")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "amount", "memo")
if err != nil {
return err
}
-
d.AdditionalProperties = additionalProperties
+
d.Amount = *temp.Amount
d.Memo = temp.Memo
return nil
diff --git a/models/deduct_service_credit_request.go b/models/deduct_service_credit_request.go
index 6f618407..c03ac629 100644
--- a/models/deduct_service_credit_request.go
+++ b/models/deduct_service_credit_request.go
@@ -13,8 +13,8 @@ import (
// DeductServiceCreditRequest represents a DeductServiceCreditRequest struct.
type DeductServiceCreditRequest struct {
- Deduction DeductServiceCredit `json:"deduction"`
- AdditionalProperties map[string]any `json:"_"`
+ Deduction DeductServiceCredit `json:"deduction"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for DeductServiceCreditRequest.
@@ -22,13 +22,17 @@ type DeductServiceCreditRequest struct {
func (d DeductServiceCreditRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(d.AdditionalProperties,
+ "deduction"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(d.toMap())
}
// toMap converts the DeductServiceCreditRequest object to a map representation for JSON marshaling.
func (d DeductServiceCreditRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, d.AdditionalProperties)
+ MergeAdditionalProperties(structMap, d.AdditionalProperties)
structMap["deduction"] = d.Deduction.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (d *DeductServiceCreditRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "deduction")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "deduction")
if err != nil {
return err
}
-
d.AdditionalProperties = additionalProperties
+
d.Deduction = *temp.Deduction
return nil
}
diff --git a/models/delayed_cancellation_response.go b/models/delayed_cancellation_response.go
index d893610a..956861f0 100644
--- a/models/delayed_cancellation_response.go
+++ b/models/delayed_cancellation_response.go
@@ -11,8 +11,8 @@ import (
// DelayedCancellationResponse represents a DelayedCancellationResponse struct.
type DelayedCancellationResponse struct {
- Message *string `json:"message,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Message *string `json:"message,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for DelayedCancellationResponse.
@@ -20,13 +20,17 @@ type DelayedCancellationResponse struct {
func (d DelayedCancellationResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(d.AdditionalProperties,
+ "message"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(d.toMap())
}
// toMap converts the DelayedCancellationResponse object to a map representation for JSON marshaling.
func (d DelayedCancellationResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, d.AdditionalProperties)
+ MergeAdditionalProperties(structMap, d.AdditionalProperties)
if d.Message != nil {
structMap["message"] = d.Message
}
@@ -41,12 +45,12 @@ func (d *DelayedCancellationResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "message")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "message")
if err != nil {
return err
}
-
d.AdditionalProperties = additionalProperties
+
d.Message = temp.Message
return nil
}
diff --git a/models/delete_subscription_group_response.go b/models/delete_subscription_group_response.go
index 1b85b8b1..6766c014 100644
--- a/models/delete_subscription_group_response.go
+++ b/models/delete_subscription_group_response.go
@@ -11,9 +11,9 @@ import (
// DeleteSubscriptionGroupResponse represents a DeleteSubscriptionGroupResponse struct.
type DeleteSubscriptionGroupResponse struct {
- Uid *string `json:"uid,omitempty"`
- Deleted *bool `json:"deleted,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Uid *string `json:"uid,omitempty"`
+ Deleted *bool `json:"deleted,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for DeleteSubscriptionGroupResponse.
@@ -21,13 +21,17 @@ type DeleteSubscriptionGroupResponse struct {
func (d DeleteSubscriptionGroupResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(d.AdditionalProperties,
+ "uid", "deleted"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(d.toMap())
}
// toMap converts the DeleteSubscriptionGroupResponse object to a map representation for JSON marshaling.
func (d DeleteSubscriptionGroupResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, d.AdditionalProperties)
+ MergeAdditionalProperties(structMap, d.AdditionalProperties)
if d.Uid != nil {
structMap["uid"] = d.Uid
}
@@ -45,12 +49,12 @@ func (d *DeleteSubscriptionGroupResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "deleted")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "deleted")
if err != nil {
return err
}
-
d.AdditionalProperties = additionalProperties
+
d.Uid = temp.Uid
d.Deleted = temp.Deleted
return nil
diff --git a/models/dunner_data.go b/models/dunner_data.go
index d5541050..081ce078 100644
--- a/models/dunner_data.go
+++ b/models/dunner_data.go
@@ -15,13 +15,13 @@ import (
// DunnerData represents a DunnerData struct.
type DunnerData struct {
- State string `json:"state"`
- SubscriptionId int `json:"subscription_id"`
- RevenueAtRiskInCents int64 `json:"revenue_at_risk_in_cents"`
- CreatedAt time.Time `json:"created_at"`
- Attempts int `json:"attempts"`
- LastAttemptedAt time.Time `json:"last_attempted_at"`
- AdditionalProperties map[string]any `json:"_"`
+ State string `json:"state"`
+ SubscriptionId int `json:"subscription_id"`
+ RevenueAtRiskInCents int64 `json:"revenue_at_risk_in_cents"`
+ CreatedAt time.Time `json:"created_at"`
+ Attempts int `json:"attempts"`
+ LastAttemptedAt time.Time `json:"last_attempted_at"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for DunnerData.
@@ -29,13 +29,17 @@ type DunnerData struct {
func (d DunnerData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(d.AdditionalProperties,
+ "state", "subscription_id", "revenue_at_risk_in_cents", "created_at", "attempts", "last_attempted_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(d.toMap())
}
// toMap converts the DunnerData object to a map representation for JSON marshaling.
func (d DunnerData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, d.AdditionalProperties)
+ MergeAdditionalProperties(structMap, d.AdditionalProperties)
structMap["state"] = d.State
structMap["subscription_id"] = d.SubscriptionId
structMap["revenue_at_risk_in_cents"] = d.RevenueAtRiskInCents
@@ -57,12 +61,12 @@ func (d *DunnerData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "state", "subscription_id", "revenue_at_risk_in_cents", "created_at", "attempts", "last_attempted_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "state", "subscription_id", "revenue_at_risk_in_cents", "created_at", "attempts", "last_attempted_at")
if err != nil {
return err
}
-
d.AdditionalProperties = additionalProperties
+
d.State = *temp.State
d.SubscriptionId = *temp.SubscriptionId
d.RevenueAtRiskInCents = *temp.RevenueAtRiskInCents
diff --git a/models/dunning_step_data.go b/models/dunning_step_data.go
index d5982056..49d1aa4c 100644
--- a/models/dunning_step_data.go
+++ b/models/dunning_step_data.go
@@ -13,15 +13,15 @@ import (
// DunningStepData represents a DunningStepData struct.
type DunningStepData struct {
- DayThreshold int `json:"day_threshold"`
- Action string `json:"action"`
- EmailBody Optional[string] `json:"email_body"`
- EmailSubject Optional[string] `json:"email_subject"`
- SendEmail bool `json:"send_email"`
- SendBccEmail bool `json:"send_bcc_email"`
- SendSms bool `json:"send_sms"`
- SmsBody Optional[string] `json:"sms_body"`
- AdditionalProperties map[string]any `json:"_"`
+ DayThreshold int `json:"day_threshold"`
+ Action string `json:"action"`
+ EmailBody Optional[string] `json:"email_body"`
+ EmailSubject Optional[string] `json:"email_subject"`
+ SendEmail bool `json:"send_email"`
+ SendBccEmail bool `json:"send_bcc_email"`
+ SendSms bool `json:"send_sms"`
+ SmsBody Optional[string] `json:"sms_body"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for DunningStepData.
@@ -29,13 +29,17 @@ type DunningStepData struct {
func (d DunningStepData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(d.AdditionalProperties,
+ "day_threshold", "action", "email_body", "email_subject", "send_email", "send_bcc_email", "send_sms", "sms_body"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(d.toMap())
}
// toMap converts the DunningStepData object to a map representation for JSON marshaling.
func (d DunningStepData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, d.AdditionalProperties)
+ MergeAdditionalProperties(structMap, d.AdditionalProperties)
structMap["day_threshold"] = d.DayThreshold
structMap["action"] = d.Action
if d.EmailBody.IsValueSet() {
@@ -77,12 +81,12 @@ func (d *DunningStepData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "day_threshold", "action", "email_body", "email_subject", "send_email", "send_bcc_email", "send_sms", "sms_body")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "day_threshold", "action", "email_body", "email_subject", "send_email", "send_bcc_email", "send_sms", "sms_body")
if err != nil {
return err
}
-
d.AdditionalProperties = additionalProperties
+
d.DayThreshold = *temp.DayThreshold
d.Action = *temp.Action
d.EmailBody = temp.EmailBody
diff --git a/models/dunning_step_reached.go b/models/dunning_step_reached.go
index 4a4a624a..10b58490 100644
--- a/models/dunning_step_reached.go
+++ b/models/dunning_step_reached.go
@@ -13,10 +13,10 @@ import (
// DunningStepReached represents a DunningStepReached struct.
type DunningStepReached struct {
- Dunner DunnerData `json:"dunner"`
- CurrentStep DunningStepData `json:"current_step"`
- NextStep DunningStepData `json:"next_step"`
- AdditionalProperties map[string]any `json:"_"`
+ Dunner DunnerData `json:"dunner"`
+ CurrentStep DunningStepData `json:"current_step"`
+ NextStep DunningStepData `json:"next_step"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for DunningStepReached.
@@ -24,13 +24,17 @@ type DunningStepReached struct {
func (d DunningStepReached) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(d.AdditionalProperties,
+ "dunner", "current_step", "next_step"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(d.toMap())
}
// toMap converts the DunningStepReached object to a map representation for JSON marshaling.
func (d DunningStepReached) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, d.AdditionalProperties)
+ MergeAdditionalProperties(structMap, d.AdditionalProperties)
structMap["dunner"] = d.Dunner.toMap()
structMap["current_step"] = d.CurrentStep.toMap()
structMap["next_step"] = d.NextStep.toMap()
@@ -49,12 +53,12 @@ func (d *DunningStepReached) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "dunner", "current_step", "next_step")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "dunner", "current_step", "next_step")
if err != nil {
return err
}
-
d.AdditionalProperties = additionalProperties
+
d.Dunner = *temp.Dunner
d.CurrentStep = *temp.CurrentStep
d.NextStep = *temp.NextStep
diff --git a/models/ebb_component.go b/models/ebb_component.go
index 05742c10..df0c8ce0 100644
--- a/models/ebb_component.go
+++ b/models/ebb_component.go
@@ -25,14 +25,8 @@ type EBBComponent struct {
Taxable *bool `json:"taxable,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"`
- // (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://help.chargify.com/products/product-components.html#general-price-bracket-rules) for an overview of how price brackets work for different pricing schemes.
+ // (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes.
Prices []Price `json:"prices,omitempty"`
- // The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
- // Available values: `full`, `prorated`, `none`.
- UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
- // The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
- // Available values: `full`, `prorated`, `none`.
- DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
PricePoints []ComponentPricePointItem `json:"price_points,omitempty"`
// The amount the customer will be charged per unit when the pricing scheme is “per_unit”. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065
UnitPrice *EBBComponentUnitPrice `json:"unit_price,omitempty"`
@@ -40,15 +34,13 @@ type EBBComponent struct {
TaxCode *string `json:"tax_code,omitempty"`
// (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices.
HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
- // deprecated May 2011 - use unit_price instead
- PriceInCents *string `json:"price_in_cents,omitempty"`
// The ID of an event based billing metric that will be attached to this component.
EventBasedBillingMetricId int `json:"event_based_billing_metric_id"`
// The numerical interval. i.e. an interval of ‘30’ coupled with an interval_unit of day would mean this component's default 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 component's default price point, either month or day. This property is only available for sites with Multifrequency enabled.
IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for EBBComponent.
@@ -56,13 +48,17 @@ type EBBComponent struct {
func (e EBBComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(e.AdditionalProperties,
+ "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "event_based_billing_metric_id", "interval", "interval_unit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(e.toMap())
}
// toMap converts the EBBComponent object to a map representation for JSON marshaling.
func (e EBBComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, e.AdditionalProperties)
+ MergeAdditionalProperties(structMap, e.AdditionalProperties)
structMap["name"] = e.Name
structMap["unit_name"] = e.UnitName
if e.Description != nil {
@@ -78,20 +74,6 @@ func (e EBBComponent) toMap() map[string]any {
if e.Prices != nil {
structMap["prices"] = e.Prices
}
- if e.UpgradeCharge.IsValueSet() {
- if e.UpgradeCharge.Value() != nil {
- structMap["upgrade_charge"] = e.UpgradeCharge.Value()
- } else {
- structMap["upgrade_charge"] = nil
- }
- }
- if e.DowngradeCredit.IsValueSet() {
- if e.DowngradeCredit.Value() != nil {
- structMap["downgrade_credit"] = e.DowngradeCredit.Value()
- } else {
- structMap["downgrade_credit"] = nil
- }
- }
if e.PricePoints != nil {
structMap["price_points"] = e.PricePoints
}
@@ -104,9 +86,6 @@ func (e EBBComponent) toMap() map[string]any {
if e.HideDateRangeOnInvoice != nil {
structMap["hide_date_range_on_invoice"] = e.HideDateRangeOnInvoice
}
- if e.PriceInCents != nil {
- structMap["price_in_cents"] = e.PriceInCents
- }
structMap["event_based_billing_metric_id"] = e.EventBasedBillingMetricId
if e.Interval != nil {
structMap["interval"] = e.Interval
@@ -133,12 +112,12 @@ func (e *EBBComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "upgrade_charge", "downgrade_credit", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "price_in_cents", "event_based_billing_metric_id", "interval", "interval_unit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "event_based_billing_metric_id", "interval", "interval_unit")
if err != nil {
return err
}
-
e.AdditionalProperties = additionalProperties
+
e.Name = *temp.Name
e.UnitName = *temp.UnitName
e.Description = temp.Description
@@ -146,13 +125,10 @@ func (e *EBBComponent) UnmarshalJSON(input []byte) error {
e.Taxable = temp.Taxable
e.PricingScheme = *temp.PricingScheme
e.Prices = temp.Prices
- e.UpgradeCharge = temp.UpgradeCharge
- e.DowngradeCredit = temp.DowngradeCredit
e.PricePoints = temp.PricePoints
e.UnitPrice = temp.UnitPrice
e.TaxCode = temp.TaxCode
e.HideDateRangeOnInvoice = temp.HideDateRangeOnInvoice
- e.PriceInCents = temp.PriceInCents
e.EventBasedBillingMetricId = *temp.EventBasedBillingMetricId
e.Interval = temp.Interval
e.IntervalUnit = temp.IntervalUnit
@@ -168,13 +144,10 @@ type tempEBBComponent struct {
Taxable *bool `json:"taxable,omitempty"`
PricingScheme *PricingScheme `json:"pricing_scheme"`
Prices []Price `json:"prices,omitempty"`
- UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
- DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
PricePoints []ComponentPricePointItem `json:"price_points,omitempty"`
UnitPrice *EBBComponentUnitPrice `json:"unit_price,omitempty"`
TaxCode *string `json:"tax_code,omitempty"`
HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
- PriceInCents *string `json:"price_in_cents,omitempty"`
EventBasedBillingMetricId *int `json:"event_based_billing_metric_id"`
Interval *int `json:"interval,omitempty"`
IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
diff --git a/models/ebb_event.go b/models/ebb_event.go
index c26ae411..00798486 100644
--- a/models/ebb_event.go
+++ b/models/ebb_event.go
@@ -11,8 +11,8 @@ import (
// EBBEvent represents a EBBEvent struct.
type EBBEvent struct {
- Chargify *ChargifyEBB `json:"chargify,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Chargify *ChargifyEBB `json:"chargify,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for EBBEvent.
@@ -20,13 +20,17 @@ type EBBEvent struct {
func (e EBBEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(e.AdditionalProperties,
+ "chargify"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(e.toMap())
}
// toMap converts the EBBEvent object to a map representation for JSON marshaling.
func (e EBBEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, e.AdditionalProperties)
+ MergeAdditionalProperties(structMap, e.AdditionalProperties)
if e.Chargify != nil {
structMap["chargify"] = e.Chargify.toMap()
}
@@ -41,12 +45,12 @@ func (e *EBBEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "chargify")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "chargify")
if err != nil {
return err
}
-
e.AdditionalProperties = additionalProperties
+
e.Chargify = temp.Chargify
return nil
}
diff --git a/models/enable_webhooks_request.go b/models/enable_webhooks_request.go
index 650f4cbf..360ae6b2 100644
--- a/models/enable_webhooks_request.go
+++ b/models/enable_webhooks_request.go
@@ -13,8 +13,8 @@ import (
// EnableWebhooksRequest represents a EnableWebhooksRequest struct.
type EnableWebhooksRequest struct {
- WebhooksEnabled bool `json:"webhooks_enabled"`
- AdditionalProperties map[string]any `json:"_"`
+ WebhooksEnabled bool `json:"webhooks_enabled"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for EnableWebhooksRequest.
@@ -22,13 +22,17 @@ type EnableWebhooksRequest struct {
func (e EnableWebhooksRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(e.AdditionalProperties,
+ "webhooks_enabled"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(e.toMap())
}
// toMap converts the EnableWebhooksRequest object to a map representation for JSON marshaling.
func (e EnableWebhooksRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, e.AdditionalProperties)
+ MergeAdditionalProperties(structMap, e.AdditionalProperties)
structMap["webhooks_enabled"] = e.WebhooksEnabled
return structMap
}
@@ -45,12 +49,12 @@ func (e *EnableWebhooksRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "webhooks_enabled")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "webhooks_enabled")
if err != nil {
return err
}
-
e.AdditionalProperties = additionalProperties
+
e.WebhooksEnabled = *temp.WebhooksEnabled
return nil
}
diff --git a/models/enable_webhooks_response.go b/models/enable_webhooks_response.go
index 423e61b0..b1fc4340 100644
--- a/models/enable_webhooks_response.go
+++ b/models/enable_webhooks_response.go
@@ -11,8 +11,8 @@ import (
// EnableWebhooksResponse represents a EnableWebhooksResponse struct.
type EnableWebhooksResponse struct {
- WebhooksEnabled *bool `json:"webhooks_enabled,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ WebhooksEnabled *bool `json:"webhooks_enabled,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for EnableWebhooksResponse.
@@ -20,13 +20,17 @@ type EnableWebhooksResponse struct {
func (e EnableWebhooksResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(e.AdditionalProperties,
+ "webhooks_enabled"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(e.toMap())
}
// toMap converts the EnableWebhooksResponse object to a map representation for JSON marshaling.
func (e EnableWebhooksResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, e.AdditionalProperties)
+ MergeAdditionalProperties(structMap, e.AdditionalProperties)
if e.WebhooksEnabled != nil {
structMap["webhooks_enabled"] = e.WebhooksEnabled
}
@@ -41,12 +45,12 @@ func (e *EnableWebhooksResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "webhooks_enabled")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "webhooks_enabled")
if err != nil {
return err
}
-
e.AdditionalProperties = additionalProperties
+
e.WebhooksEnabled = temp.WebhooksEnabled
return nil
}
diff --git a/models/endpoint.go b/models/endpoint.go
index 724cf2ee..d9962c98 100644
--- a/models/endpoint.go
+++ b/models/endpoint.go
@@ -11,12 +11,12 @@ import (
// Endpoint represents a Endpoint struct.
type Endpoint struct {
- Id *int `json:"id,omitempty"`
- Url *string `json:"url,omitempty"`
- SiteId *int `json:"site_id,omitempty"`
- Status *string `json:"status,omitempty"`
- WebhookSubscriptions []string `json:"webhook_subscriptions,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ Url *string `json:"url,omitempty"`
+ SiteId *int `json:"site_id,omitempty"`
+ Status *string `json:"status,omitempty"`
+ WebhookSubscriptions []string `json:"webhook_subscriptions,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Endpoint.
@@ -24,13 +24,17 @@ type Endpoint struct {
func (e Endpoint) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(e.AdditionalProperties,
+ "id", "url", "site_id", "status", "webhook_subscriptions"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(e.toMap())
}
// toMap converts the Endpoint object to a map representation for JSON marshaling.
func (e Endpoint) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, e.AdditionalProperties)
+ MergeAdditionalProperties(structMap, e.AdditionalProperties)
if e.Id != nil {
structMap["id"] = e.Id
}
@@ -57,12 +61,12 @@ func (e *Endpoint) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "url", "site_id", "status", "webhook_subscriptions")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "url", "site_id", "status", "webhook_subscriptions")
if err != nil {
return err
}
-
e.AdditionalProperties = additionalProperties
+
e.Id = temp.Id
e.Url = temp.Url
e.SiteId = temp.SiteId
diff --git a/models/endpoint_response.go b/models/endpoint_response.go
index 9287f399..9b4ce1c7 100644
--- a/models/endpoint_response.go
+++ b/models/endpoint_response.go
@@ -11,8 +11,8 @@ import (
// EndpointResponse represents a EndpointResponse struct.
type EndpointResponse struct {
- Endpoint *Endpoint `json:"endpoint,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Endpoint *Endpoint `json:"endpoint,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for EndpointResponse.
@@ -20,13 +20,17 @@ type EndpointResponse struct {
func (e EndpointResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(e.AdditionalProperties,
+ "endpoint"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(e.toMap())
}
// toMap converts the EndpointResponse object to a map representation for JSON marshaling.
func (e EndpointResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, e.AdditionalProperties)
+ MergeAdditionalProperties(structMap, e.AdditionalProperties)
if e.Endpoint != nil {
structMap["endpoint"] = e.Endpoint.toMap()
}
@@ -41,12 +45,12 @@ func (e *EndpointResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "endpoint")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "endpoint")
if err != nil {
return err
}
-
e.AdditionalProperties = additionalProperties
+
e.Endpoint = temp.Endpoint
return nil
}
diff --git a/models/enums.go b/models/enums.go
index e32596f3..77668566 100644
--- a/models/enums.go
+++ b/models/enums.go
@@ -906,6 +906,7 @@ const (
)
// CompoundingStrategy is a string enum.
+// Applicable only to stackable coupons. For `compound`, Percentage-based discounts will be calculated against the remaining price, after prior discounts have been calculated. For `full-price`, Percentage-based discounts will always be calculated against the original item price, before other discounts are applied.
type CompoundingStrategy string
// MarshalJSON implements the json.Marshaler interface for CompoundingStrategy.
@@ -1611,112 +1612,204 @@ const (
DiscountType_PERCENT DiscountType = "percent"
)
-// EventType is a string enum.
-type EventType string
+// EventKey is a string enum.
+type EventKey string
-// MarshalJSON implements the json.Marshaler interface for EventType.
-// It customizes the JSON marshaling process for EventType objects.
-func (e EventType) MarshalJSON() (
+// MarshalJSON implements the json.Marshaler interface for EventKey.
+// It customizes the JSON marshaling process for EventKey objects.
+func (e EventKey) MarshalJSON() (
[]byte,
error) {
if e.isValid() {
return []byte(fmt.Sprintf("\"%v\"", e)), nil
}
- return nil, errors.New("the provided enum value is not allowed for EventType")
+ return nil, errors.New("the provided enum value is not allowed for EventKey")
}
-// UnmarshalJSON implements the json.Unmarshaler interface for EventType.
-// It customizes the JSON unmarshaling process for EventType objects.
-func (e *EventType) UnmarshalJSON(input []byte) error {
+// UnmarshalJSON implements the json.Unmarshaler interface for EventKey.
+// It customizes the JSON unmarshaling process for EventKey objects.
+func (e *EventKey) UnmarshalJSON(input []byte) error {
var enumValue string
err := json.Unmarshal(input, &enumValue)
if err != nil {
return err
}
- *e = EventType(enumValue)
+ *e = EventKey(enumValue)
if !e.isValid() {
- return errors.New("the value " + string(input) + " cannot be unmarshalled to EventType")
+ return errors.New("the value " + string(input) + " cannot be unmarshalled to EventKey")
}
return nil
}
-// Checks whether the value is actually a member of EventType.
-func (e EventType) isValid() bool {
+// Checks whether the value is actually a member of EventKey.
+func (e EventKey) isValid() bool {
switch e {
- case EventType_ACCOUNTTRANSACTIONCHANGED,
- EventType_BILLINGDATECHANGE,
- EventType_COMPONENTALLOCATIONCHANGE,
- EventType_CUSTOMERUPDATE,
- EventType_CUSTOMERCREATE,
- EventType_DUNNINGSTEPREACHED,
- EventType_EXPIRATIONDATECHANGE,
- EventType_EXPIRINGCARD,
- EventType_METEREDUSAGE,
- EventType_PAYMENTSUCCESS,
- EventType_PAYMENTSUCCESSRECREATED,
- EventType_PAYMENTFAILURE,
- EventType_PAYMENTFAILURERECREATED,
- EventType_REFUNDFAILURE,
- EventType_REFUNDSUCCESS,
- EventType_RENEWALSUCCESS,
- EventType_RENEWALSUCCESSRECREATED,
- EventType_RENEWALFAILURE,
- EventType_SIGNUPSUCCESS,
- EventType_SIGNUPFAILURE,
- EventType_STATEMENTCLOSED,
- EventType_STATEMENTSETTLED,
- EventType_SUBSCRIPTIONBANKACCOUNTUPDATE,
- EventType_SUBSCRIPTIONDELETION,
- EventType_SUBSCRIPTIONPAYPALACCOUNTUPDATE,
- EventType_SUBSCRIPTIONPRODUCTCHANGE,
- EventType_SUBSCRIPTIONSTATECHANGE,
- EventType_TRIALENDNOTICE,
- EventType_UPGRADEDOWNGRADESUCCESS,
- EventType_UPGRADEDOWNGRADEFAILURE,
- EventType_UPCOMINGRENEWALNOTICE,
- EventType_CUSTOMFIELDVALUECHANGE,
- EventType_SUBSCRIPTIONPREPAYMENTACCOUNTBALANCECHANGED,
- EventType_SUBSCRIPTIONSERVICECREDITACCOUNTBALANCECHANGED:
+ case EventKey_PAYMENTSUCCESS,
+ EventKey_PAYMENTFAILURE,
+ EventKey_SIGNUPSUCCESS,
+ EventKey_SIGNUPFAILURE,
+ EventKey_DELAYEDSIGNUPCREATIONSUCCESS,
+ EventKey_DELAYEDSIGNUPCREATIONFAILURE,
+ EventKey_BILLINGDATECHANGE,
+ EventKey_EXPIRATIONDATECHANGE,
+ EventKey_RENEWALSUCCESS,
+ EventKey_RENEWALFAILURE,
+ EventKey_SUBSCRIPTIONSTATECHANGE,
+ EventKey_SUBSCRIPTIONPRODUCTCHANGE,
+ EventKey_PENDINGCANCELLATIONCHANGE,
+ EventKey_EXPIRINGCARD,
+ EventKey_CUSTOMERUPDATE,
+ EventKey_CUSTOMERCREATE,
+ EventKey_CUSTOMERDELETE,
+ EventKey_COMPONENTALLOCATIONCHANGE,
+ EventKey_METEREDUSAGE,
+ EventKey_PREPAIDUSAGE,
+ EventKey_UPGRADEDOWNGRADESUCCESS,
+ EventKey_UPGRADEDOWNGRADEFAILURE,
+ EventKey_STATEMENTCLOSED,
+ EventKey_STATEMENTSETTLED,
+ EventKey_SUBSCRIPTIONCARDUPDATE,
+ EventKey_SUBSCRIPTIONGROUPCARDUPDATE,
+ EventKey_SUBSCRIPTIONBANKACCOUNTUPDATE,
+ EventKey_REFUNDSUCCESS,
+ EventKey_REFUNDFAILURE,
+ EventKey_UPCOMINGRENEWALNOTICE,
+ EventKey_TRIALENDNOTICE,
+ EventKey_DUNNINGSTEPREACHED,
+ EventKey_INVOICEISSUED,
+ EventKey_PREPAIDSUBSCRIPTIONBALANCECHANGED,
+ EventKey_SUBSCRIPTIONGROUPSIGNUPSUCCESS,
+ EventKey_SUBSCRIPTIONGROUPSIGNUPFAILURE,
+ EventKey_DIRECTDEBITPAYMENTPAIDOUT,
+ EventKey_DIRECTDEBITPAYMENTREJECTED,
+ EventKey_DIRECTDEBITPAYMENTPENDING,
+ EventKey_PENDINGPAYMENTCREATED,
+ EventKey_PENDINGPAYMENTFAILED,
+ EventKey_PENDINGPAYMENTCOMPLETED,
+ EventKey_PROFORMAINVOICEISSUED,
+ EventKey_SUBSCRIPTIONPREPAYMENTACCOUNTBALANCECHANGED,
+ EventKey_SUBSCRIPTIONSERVICECREDITACCOUNTBALANCECHANGED,
+ EventKey_CUSTOMFIELDVALUECHANGE,
+ EventKey_ITEMPRICEPOINTCHANGED,
+ EventKey_RENEWALSUCCESSRECREATED,
+ EventKey_RENEWALFAILURERECREATED,
+ EventKey_PAYMENTSUCCESSRECREATED,
+ EventKey_PAYMENTFAILURERECREATED,
+ EventKey_SUBSCRIPTIONDELETION,
+ EventKey_SUBSCRIPTIONGROUPBANKACCOUNTUPDATE,
+ EventKey_SUBSCRIPTIONPAYPALACCOUNTUPDATE,
+ EventKey_SUBSCRIPTIONGROUPPAYPALACCOUNTUPDATE,
+ EventKey_SUBSCRIPTIONCUSTOMERCHANGE,
+ EventKey_ACCOUNTTRANSACTIONCHANGED,
+ EventKey_GOCARDLESSPAYMENTPAIDOUT,
+ EventKey_GOCARDLESSPAYMENTREJECTED,
+ EventKey_GOCARDLESSPAYMENTPENDING,
+ EventKey_STRIPEDIRECTDEBITPAYMENTPAIDOUT,
+ EventKey_STRIPEDIRECTDEBITPAYMENTREJECTED,
+ EventKey_STRIPEDIRECTDEBITPAYMENTPENDING,
+ EventKey_MAXIOPAYMENTSDIRECTDEBITPAYMENTPAIDOUT,
+ EventKey_MAXIOPAYMENTSDIRECTDEBITPAYMENTREJECTED,
+ EventKey_MAXIOPAYMENTSDIRECTDEBITPAYMENTPENDING,
+ EventKey_INVOICEINCOLLECTIONSCANCELED,
+ EventKey_SUBSCRIPTIONADDEDTOGROUP,
+ EventKey_SUBSCRIPTIONREMOVEDFROMGROUP,
+ EventKey_CHARGEBACKOPENED,
+ EventKey_CHARGEBACKLOST,
+ EventKey_CHARGEBACKACCEPTED,
+ EventKey_CHARGEBACKCLOSED,
+ EventKey_CHARGEBACKWON,
+ EventKey_PAYMENTCOLLECTIONMETHODCHANGED,
+ EventKey_COMPONENTBILLINGDATECHANGED,
+ EventKey_SUBSCRIPTIONTERMRENEWALSCHEDULED,
+ EventKey_SUBSCRIPTIONTERMRENEWALPENDING,
+ EventKey_SUBSCRIPTIONTERMRENEWALACTIVATED,
+ EventKey_SUBSCRIPTIONTERMRENEWALREMOVED:
return true
}
return false
}
const (
- EventType_ACCOUNTTRANSACTIONCHANGED EventType = "account_transaction_changed"
- EventType_BILLINGDATECHANGE EventType = "billing_date_change"
- EventType_COMPONENTALLOCATIONCHANGE EventType = "component_allocation_change"
- EventType_CUSTOMERUPDATE EventType = "customer_update"
- EventType_CUSTOMERCREATE EventType = "customer_create"
- EventType_DUNNINGSTEPREACHED EventType = "dunning_step_reached"
- EventType_EXPIRATIONDATECHANGE EventType = "expiration_date_change"
- EventType_EXPIRINGCARD EventType = "expiring_card"
- EventType_METEREDUSAGE EventType = "metered_usage"
- EventType_PAYMENTSUCCESS EventType = "payment_success"
- EventType_PAYMENTSUCCESSRECREATED EventType = "payment_success_recreated"
- EventType_PAYMENTFAILURE EventType = "payment_failure"
- EventType_PAYMENTFAILURERECREATED EventType = "payment_failure_recreated"
- EventType_REFUNDFAILURE EventType = "refund_failure"
- EventType_REFUNDSUCCESS EventType = "refund_success"
- EventType_RENEWALSUCCESS EventType = "renewal_success"
- EventType_RENEWALSUCCESSRECREATED EventType = "renewal_success_recreated"
- EventType_RENEWALFAILURE EventType = "renewal_failure"
- EventType_SIGNUPSUCCESS EventType = "signup_success"
- EventType_SIGNUPFAILURE EventType = "signup_failure"
- EventType_STATEMENTCLOSED EventType = "statement_closed"
- EventType_STATEMENTSETTLED EventType = "statement_settled"
- EventType_SUBSCRIPTIONBANKACCOUNTUPDATE EventType = "subscription_bank_account_update"
- EventType_SUBSCRIPTIONDELETION EventType = "subscription_deletion"
- EventType_SUBSCRIPTIONPAYPALACCOUNTUPDATE EventType = "subscription_paypal_account_update"
- EventType_SUBSCRIPTIONPRODUCTCHANGE EventType = "subscription_product_change"
- EventType_SUBSCRIPTIONSTATECHANGE EventType = "subscription_state_change"
- EventType_TRIALENDNOTICE EventType = "trial_end_notice"
- EventType_UPGRADEDOWNGRADESUCCESS EventType = "upgrade_downgrade_success"
- EventType_UPGRADEDOWNGRADEFAILURE EventType = "upgrade_downgrade_failure"
- EventType_UPCOMINGRENEWALNOTICE EventType = "upcoming_renewal_notice"
- EventType_CUSTOMFIELDVALUECHANGE EventType = "custom_field_value_change"
- EventType_SUBSCRIPTIONPREPAYMENTACCOUNTBALANCECHANGED EventType = "subscription_prepayment_account_balance_changed"
- EventType_SUBSCRIPTIONSERVICECREDITACCOUNTBALANCECHANGED EventType = "subscription_service_credit_account_balance_changed"
+ EventKey_PAYMENTSUCCESS EventKey = "payment_success"
+ EventKey_PAYMENTFAILURE EventKey = "payment_failure"
+ EventKey_SIGNUPSUCCESS EventKey = "signup_success"
+ EventKey_SIGNUPFAILURE EventKey = "signup_failure"
+ EventKey_DELAYEDSIGNUPCREATIONSUCCESS EventKey = "delayed_signup_creation_success"
+ EventKey_DELAYEDSIGNUPCREATIONFAILURE EventKey = "delayed_signup_creation_failure"
+ EventKey_BILLINGDATECHANGE EventKey = "billing_date_change"
+ EventKey_EXPIRATIONDATECHANGE EventKey = "expiration_date_change"
+ EventKey_RENEWALSUCCESS EventKey = "renewal_success"
+ EventKey_RENEWALFAILURE EventKey = "renewal_failure"
+ EventKey_SUBSCRIPTIONSTATECHANGE EventKey = "subscription_state_change"
+ EventKey_SUBSCRIPTIONPRODUCTCHANGE EventKey = "subscription_product_change"
+ EventKey_PENDINGCANCELLATIONCHANGE EventKey = "pending_cancellation_change"
+ EventKey_EXPIRINGCARD EventKey = "expiring_card"
+ EventKey_CUSTOMERUPDATE EventKey = "customer_update"
+ EventKey_CUSTOMERCREATE EventKey = "customer_create"
+ EventKey_CUSTOMERDELETE EventKey = "customer_delete"
+ EventKey_COMPONENTALLOCATIONCHANGE EventKey = "component_allocation_change"
+ EventKey_METEREDUSAGE EventKey = "metered_usage"
+ EventKey_PREPAIDUSAGE EventKey = "prepaid_usage"
+ EventKey_UPGRADEDOWNGRADESUCCESS EventKey = "upgrade_downgrade_success"
+ EventKey_UPGRADEDOWNGRADEFAILURE EventKey = "upgrade_downgrade_failure"
+ EventKey_STATEMENTCLOSED EventKey = "statement_closed"
+ EventKey_STATEMENTSETTLED EventKey = "statement_settled"
+ EventKey_SUBSCRIPTIONCARDUPDATE EventKey = "subscription_card_update"
+ EventKey_SUBSCRIPTIONGROUPCARDUPDATE EventKey = "subscription_group_card_update"
+ EventKey_SUBSCRIPTIONBANKACCOUNTUPDATE EventKey = "subscription_bank_account_update"
+ EventKey_REFUNDSUCCESS EventKey = "refund_success"
+ EventKey_REFUNDFAILURE EventKey = "refund_failure"
+ EventKey_UPCOMINGRENEWALNOTICE EventKey = "upcoming_renewal_notice"
+ EventKey_TRIALENDNOTICE EventKey = "trial_end_notice"
+ EventKey_DUNNINGSTEPREACHED EventKey = "dunning_step_reached"
+ EventKey_INVOICEISSUED EventKey = "invoice_issued"
+ EventKey_PREPAIDSUBSCRIPTIONBALANCECHANGED EventKey = "prepaid_subscription_balance_changed"
+ EventKey_SUBSCRIPTIONGROUPSIGNUPSUCCESS EventKey = "subscription_group_signup_success"
+ EventKey_SUBSCRIPTIONGROUPSIGNUPFAILURE EventKey = "subscription_group_signup_failure"
+ EventKey_DIRECTDEBITPAYMENTPAIDOUT EventKey = "direct_debit_payment_paid_out"
+ EventKey_DIRECTDEBITPAYMENTREJECTED EventKey = "direct_debit_payment_rejected"
+ EventKey_DIRECTDEBITPAYMENTPENDING EventKey = "direct_debit_payment_pending"
+ EventKey_PENDINGPAYMENTCREATED EventKey = "pending_payment_created"
+ EventKey_PENDINGPAYMENTFAILED EventKey = "pending_payment_failed"
+ EventKey_PENDINGPAYMENTCOMPLETED EventKey = "pending_payment_completed"
+ EventKey_PROFORMAINVOICEISSUED EventKey = "proforma_invoice_issued"
+ EventKey_SUBSCRIPTIONPREPAYMENTACCOUNTBALANCECHANGED EventKey = "subscription_prepayment_account_balance_changed"
+ EventKey_SUBSCRIPTIONSERVICECREDITACCOUNTBALANCECHANGED EventKey = "subscription_service_credit_account_balance_changed"
+ EventKey_CUSTOMFIELDVALUECHANGE EventKey = "custom_field_value_change"
+ EventKey_ITEMPRICEPOINTCHANGED EventKey = "item_price_point_changed"
+ EventKey_RENEWALSUCCESSRECREATED EventKey = "renewal_success_recreated"
+ EventKey_RENEWALFAILURERECREATED EventKey = "renewal_failure_recreated"
+ EventKey_PAYMENTSUCCESSRECREATED EventKey = "payment_success_recreated"
+ EventKey_PAYMENTFAILURERECREATED EventKey = "payment_failure_recreated"
+ EventKey_SUBSCRIPTIONDELETION EventKey = "subscription_deletion"
+ EventKey_SUBSCRIPTIONGROUPBANKACCOUNTUPDATE EventKey = "subscription_group_bank_account_update"
+ EventKey_SUBSCRIPTIONPAYPALACCOUNTUPDATE EventKey = "subscription_paypal_account_update"
+ EventKey_SUBSCRIPTIONGROUPPAYPALACCOUNTUPDATE EventKey = "subscription_group_paypal_account_update"
+ EventKey_SUBSCRIPTIONCUSTOMERCHANGE EventKey = "subscription_customer_change"
+ EventKey_ACCOUNTTRANSACTIONCHANGED EventKey = "account_transaction_changed"
+ EventKey_GOCARDLESSPAYMENTPAIDOUT EventKey = "go_cardless_payment_paid_out"
+ EventKey_GOCARDLESSPAYMENTREJECTED EventKey = "go_cardless_payment_rejected"
+ EventKey_GOCARDLESSPAYMENTPENDING EventKey = "go_cardless_payment_pending"
+ EventKey_STRIPEDIRECTDEBITPAYMENTPAIDOUT EventKey = "stripe_direct_debit_payment_paid_out"
+ EventKey_STRIPEDIRECTDEBITPAYMENTREJECTED EventKey = "stripe_direct_debit_payment_rejected"
+ EventKey_STRIPEDIRECTDEBITPAYMENTPENDING EventKey = "stripe_direct_debit_payment_pending"
+ EventKey_MAXIOPAYMENTSDIRECTDEBITPAYMENTPAIDOUT EventKey = "maxio_payments_direct_debit_payment_paid_out"
+ EventKey_MAXIOPAYMENTSDIRECTDEBITPAYMENTREJECTED EventKey = "maxio_payments_direct_debit_payment_rejected"
+ EventKey_MAXIOPAYMENTSDIRECTDEBITPAYMENTPENDING EventKey = "maxio_payments_direct_debit_payment_pending"
+ EventKey_INVOICEINCOLLECTIONSCANCELED EventKey = "invoice_in_collections_canceled"
+ EventKey_SUBSCRIPTIONADDEDTOGROUP EventKey = "subscription_added_to_group"
+ EventKey_SUBSCRIPTIONREMOVEDFROMGROUP EventKey = "subscription_removed_from_group"
+ EventKey_CHARGEBACKOPENED EventKey = "chargeback_opened"
+ EventKey_CHARGEBACKLOST EventKey = "chargeback_lost"
+ EventKey_CHARGEBACKACCEPTED EventKey = "chargeback_accepted"
+ EventKey_CHARGEBACKCLOSED EventKey = "chargeback_closed"
+ EventKey_CHARGEBACKWON EventKey = "chargeback_won"
+ EventKey_PAYMENTCOLLECTIONMETHODCHANGED EventKey = "payment_collection_method_changed"
+ EventKey_COMPONENTBILLINGDATECHANGED EventKey = "component_billing_date_changed"
+ EventKey_SUBSCRIPTIONTERMRENEWALSCHEDULED EventKey = "subscription_term_renewal_scheduled"
+ EventKey_SUBSCRIPTIONTERMRENEWALPENDING EventKey = "subscription_term_renewal_pending"
+ EventKey_SUBSCRIPTIONTERMRENEWALACTIVATED EventKey = "subscription_term_renewal_activated"
+ EventKey_SUBSCRIPTIONTERMRENEWALREMOVED EventKey = "subscription_term_renewal_removed"
)
// ExpirationIntervalUnit is a string enum.
@@ -2703,19 +2796,21 @@ func (e InvoiceStatus) isValid() bool {
InvoiceStatus_PAID,
InvoiceStatus_PENDING,
InvoiceStatus_VOIDED,
- InvoiceStatus_CANCELED:
+ InvoiceStatus_CANCELED,
+ InvoiceStatus_PROCESSING:
return true
}
return false
}
const (
- InvoiceStatus_DRAFT InvoiceStatus = "draft"
- InvoiceStatus_OPEN InvoiceStatus = "open"
- InvoiceStatus_PAID InvoiceStatus = "paid"
- InvoiceStatus_PENDING InvoiceStatus = "pending"
- InvoiceStatus_VOIDED InvoiceStatus = "voided"
- InvoiceStatus_CANCELED InvoiceStatus = "canceled"
+ InvoiceStatus_DRAFT InvoiceStatus = "draft"
+ InvoiceStatus_OPEN InvoiceStatus = "open"
+ InvoiceStatus_PAID InvoiceStatus = "paid"
+ InvoiceStatus_PENDING InvoiceStatus = "pending"
+ InvoiceStatus_VOIDED InvoiceStatus = "voided"
+ InvoiceStatus_CANCELED InvoiceStatus = "canceled"
+ InvoiceStatus_PROCESSING InvoiceStatus = "processing"
)
// ItemCategory is a string enum.
diff --git a/models/event.go b/models/event.go
index c7b5e57e..29dc9967 100644
--- a/models/event.go
+++ b/models/event.go
@@ -16,13 +16,47 @@ import (
// Event represents a Event struct.
type Event struct {
Id int64 `json:"id"`
- Key string `json:"key"`
+ Key EventKey `json:"key"`
Message string `json:"message"`
SubscriptionId *int `json:"subscription_id"`
CustomerId *int `json:"customer_id"`
CreatedAt time.Time `json:"created_at"`
+ // The schema varies based on the event key. The key-to-event data mapping is as follows:
+ // * `subscription_product_change` - SubscriptionProductChange
+ // * `subscription_state_change` - SubscriptionStateChange
+ // * `signup_success`, `delayed_signup_creation_success`, `payment_success`, `payment_failure`, `renewal_success`, `renewal_failure`, `chargeback_lost`, `chargeback_accepted`, `chargeback_closed` - PaymentRelatedEvents
+ // * `refund_success` - RefundSuccess
+ // * `component_allocation_change` - ComponentAllocationChange
+ // * `metered_usage` - MeteredUsage
+ // * `prepaid_usage` - PrepaidUsage
+ // * `dunning_step_reached` - DunningStepReached
+ // * `invoice_issued` - InvoiceIssued
+ // * `pending_cancellation_change` - PendingCancellationChange
+ // * `prepaid_subscription_balance_changed` - PrepaidSubscriptionBalanceChanged
+ // * `subscription_group_signup_success` and `subscription_group_signup_failure` - SubscriptionGroupSignupEventData
+ // * `proforma_invoice_issued` - ProformaInvoiceIssued
+ // * `subscription_prepayment_account_balance_changed` - PrepaymentAccountBalanceChanged
+ // * `payment_collection_method_changed` - PaymentCollectionMethodChanged
+ // * `subscription_service_credit_account_balance_changed` - CreditAccountBalanceChanged
+ // * `item_price_point_changed` - ItemPricePointChanged
+ // * `custom_field_value_change` - CustomFieldValueChange
+ // * The rest, that is `delayed_signup_creation_failure`, `billing_date_change`, `expiration_date_change`, `expiring_card`,
+ // `customer_update`, `customer_create`, `customer_delete`, `upgrade_downgrade_success`, `upgrade_downgrade_failure`,
+ // `statement_closed`, `statement_settled`, `subscription_card_update`, `subscription_group_card_update`,
+ // `subscription_bank_account_update`, `refund_failure`, `upcoming_renewal_notice`, `trial_end_notice`,
+ // `direct_debit_payment_paid_out`, `direct_debit_payment_rejected`, `direct_debit_payment_pending`, `pending_payment_created`,
+ // `pending_payment_failed`, `pending_payment_completed`, don't have event_specific_data defined,
+ // `renewal_success_recreated`, `renewal_failure_recreated`, `payment_success_recreated`, `payment_failure_recreated`,
+ // `subscription_deletion`, `subscription_group_bank_account_update`, `subscription_paypal_account_update`, `subscription_group_paypal_account_update`,
+ // `subscription_customer_change`, `account_transaction_changed`, `go_cardless_payment_paid_out`, `go_cardless_payment_rejected`,
+ // `go_cardless_payment_pending`, `stripe_direct_debit_payment_paid_out`, `stripe_direct_debit_payment_rejected`, `stripe_direct_debit_payment_pending`,
+ // `maxio_payments_direct_debit_payment_paid_out`, `maxio_payments_direct_debit_payment_rejected`, `maxio_payments_direct_debit_payment_pending`,
+ // `invoice_in_collections_canceled`, `subscription_added_to_group`, `subscription_removed_from_group`, `chargeback_opened`, `chargeback_lost`,
+ // `chargeback_accepted`, `chargeback_closed`, `chargeback_won`, `payment_collection_method_changed`, `component_billing_date_changed`,
+ // `subscription_term_renewal_scheduled`, `subscription_term_renewal_pending`, `subscription_term_renewal_activated`, `subscription_term_renewal_removed`
+ // they map to `null` instead.
EventSpecificData *EventEventSpecificData `json:"event_specific_data"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Event.
@@ -30,13 +64,17 @@ type Event struct {
func (e Event) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(e.AdditionalProperties,
+ "id", "key", "message", "subscription_id", "customer_id", "created_at", "event_specific_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(e.toMap())
}
// toMap converts the Event object to a map representation for JSON marshaling.
func (e Event) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, e.AdditionalProperties)
+ MergeAdditionalProperties(structMap, e.AdditionalProperties)
structMap["id"] = e.Id
structMap["key"] = e.Key
structMap["message"] = e.Message
@@ -71,12 +109,12 @@ func (e *Event) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "key", "message", "subscription_id", "customer_id", "created_at", "event_specific_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "key", "message", "subscription_id", "customer_id", "created_at", "event_specific_data")
if err != nil {
return err
}
-
e.AdditionalProperties = additionalProperties
+
e.Id = *temp.Id
e.Key = *temp.Key
e.Message = *temp.Message
@@ -94,7 +132,7 @@ func (e *Event) UnmarshalJSON(input []byte) error {
// tempEvent is a temporary struct used for validating the fields of Event.
type tempEvent struct {
Id *int64 `json:"id"`
- Key *string `json:"key"`
+ Key *EventKey `json:"key"`
Message *string `json:"message"`
SubscriptionId *int `json:"subscription_id"`
CustomerId *int `json:"customer_id"`
diff --git a/models/event_based_billing_segment_error.go b/models/event_based_billing_segment_error.go
index 4161be55..24cb1843 100644
--- a/models/event_based_billing_segment_error.go
+++ b/models/event_based_billing_segment_error.go
@@ -15,7 +15,7 @@ import (
type EventBasedBillingSegmentError struct {
// The key of the object would be a number (an index in the request array) where the error occurred. In the value object, the key represents the field and the value is an array with error messages. In most cases, this object would contain just one key.
Segments map[string]interface{} `json:"segments"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for EventBasedBillingSegmentError.
@@ -23,13 +23,17 @@ type EventBasedBillingSegmentError struct {
func (e EventBasedBillingSegmentError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(e.AdditionalProperties,
+ "segments"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(e.toMap())
}
// toMap converts the EventBasedBillingSegmentError object to a map representation for JSON marshaling.
func (e EventBasedBillingSegmentError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, e.AdditionalProperties)
+ MergeAdditionalProperties(structMap, e.AdditionalProperties)
structMap["segments"] = e.Segments
return structMap
}
@@ -46,12 +50,12 @@ func (e *EventBasedBillingSegmentError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "segments")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "segments")
if err != nil {
return err
}
-
e.AdditionalProperties = additionalProperties
+
e.Segments = *temp.Segments
return nil
}
diff --git a/models/event_event_specific_data.go b/models/event_event_specific_data.go
index 462403df..29194ea6 100644
--- a/models/event_event_specific_data.go
+++ b/models/event_event_specific_data.go
@@ -27,8 +27,7 @@ type EventEventSpecificData struct {
isPendingCancellationChange bool
isPrepaidSubscriptionBalanceChanged bool
isProformaInvoiceIssued bool
- isSubscriptionGroupSignupSuccess bool
- isSubscriptionGroupSignupFailure bool
+ isSubscriptionGroupSignupEventData bool
isCreditAccountBalanceChanged bool
isPrepaymentAccountBalanceChanged bool
isPaymentCollectionMethodChanged bool
@@ -82,9 +81,7 @@ func (e *EventEventSpecificData) toMap() any {
return obj.toMap()
case *ProformaInvoiceIssued:
return obj.toMap()
- case *SubscriptionGroupSignupSuccess:
- return obj.toMap()
- case *SubscriptionGroupSignupFailure:
+ case *SubscriptionGroupSignupEventData:
return obj.toMap()
case *CreditAccountBalanceChanged:
return obj.toMap()
@@ -116,8 +113,7 @@ func (e *EventEventSpecificData) UnmarshalJSON(input []byte) error {
NewTypeHolder(&PendingCancellationChange{}, false, &e.isPendingCancellationChange),
NewTypeHolder(&PrepaidSubscriptionBalanceChanged{}, false, &e.isPrepaidSubscriptionBalanceChanged),
NewTypeHolder(&ProformaInvoiceIssued{}, false, &e.isProformaInvoiceIssued),
- NewTypeHolder(&SubscriptionGroupSignupSuccess{}, false, &e.isSubscriptionGroupSignupSuccess),
- NewTypeHolder(&SubscriptionGroupSignupFailure{}, false, &e.isSubscriptionGroupSignupFailure),
+ NewTypeHolder(&SubscriptionGroupSignupEventData{}, false, &e.isSubscriptionGroupSignupEventData),
NewTypeHolder(&CreditAccountBalanceChanged{}, false, &e.isCreditAccountBalanceChanged),
NewTypeHolder(&PrepaymentAccountBalanceChanged{}, false, &e.isPrepaymentAccountBalanceChanged),
NewTypeHolder(&PaymentCollectionMethodChanged{}, false, &e.isPaymentCollectionMethodChanged),
@@ -237,22 +233,13 @@ func (e *EventEventSpecificData) AsProformaInvoiceIssued() (
return e.value.(*ProformaInvoiceIssued), true
}
-func (e *EventEventSpecificData) AsSubscriptionGroupSignupSuccess() (
- *SubscriptionGroupSignupSuccess,
+func (e *EventEventSpecificData) AsSubscriptionGroupSignupEventData() (
+ *SubscriptionGroupSignupEventData,
bool) {
- if !e.isSubscriptionGroupSignupSuccess {
+ if !e.isSubscriptionGroupSignupEventData {
return nil, false
}
- return e.value.(*SubscriptionGroupSignupSuccess), true
-}
-
-func (e *EventEventSpecificData) AsSubscriptionGroupSignupFailure() (
- *SubscriptionGroupSignupFailure,
- bool) {
- if !e.isSubscriptionGroupSignupFailure {
- return nil, false
- }
- return e.value.(*SubscriptionGroupSignupFailure), true
+ return e.value.(*SubscriptionGroupSignupEventData), true
}
func (e *EventEventSpecificData) AsCreditAccountBalanceChanged() (
@@ -366,13 +353,8 @@ func (e *internalEventEventSpecificData) FromProformaInvoiceIssued(val ProformaI
return EventEventSpecificData{value: &val}
}
-// The internalEventEventSpecificData instance, wrapping the provided SubscriptionGroupSignupSuccess value.
-func (e *internalEventEventSpecificData) FromSubscriptionGroupSignupSuccess(val SubscriptionGroupSignupSuccess) EventEventSpecificData {
- return EventEventSpecificData{value: &val}
-}
-
-// The internalEventEventSpecificData instance, wrapping the provided SubscriptionGroupSignupFailure value.
-func (e *internalEventEventSpecificData) FromSubscriptionGroupSignupFailure(val SubscriptionGroupSignupFailure) EventEventSpecificData {
+// The internalEventEventSpecificData instance, wrapping the provided SubscriptionGroupSignupEventData value.
+func (e *internalEventEventSpecificData) FromSubscriptionGroupSignupEventData(val SubscriptionGroupSignupEventData) EventEventSpecificData {
return EventEventSpecificData{value: &val}
}
diff --git a/models/event_response.go b/models/event_response.go
index 8e044de3..2122fe10 100644
--- a/models/event_response.go
+++ b/models/event_response.go
@@ -13,8 +13,8 @@ import (
// EventResponse represents a EventResponse struct.
type EventResponse struct {
- Event Event `json:"event"`
- AdditionalProperties map[string]any `json:"_"`
+ Event Event `json:"event"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for EventResponse.
@@ -22,13 +22,17 @@ type EventResponse struct {
func (e EventResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(e.AdditionalProperties,
+ "event"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(e.toMap())
}
// toMap converts the EventResponse object to a map representation for JSON marshaling.
func (e EventResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, e.AdditionalProperties)
+ MergeAdditionalProperties(structMap, e.AdditionalProperties)
structMap["event"] = e.Event.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (e *EventResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "event")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "event")
if err != nil {
return err
}
-
e.AdditionalProperties = additionalProperties
+
e.Event = *temp.Event
return nil
}
diff --git a/models/failed_payment_event.go b/models/failed_payment_event.go
index 9baec4c6..e9a29989 100644
--- a/models/failed_payment_event.go
+++ b/models/failed_payment_event.go
@@ -21,7 +21,7 @@ type FailedPaymentEvent struct {
EventType InvoiceEventType `json:"event_type"`
// Example schema for an `failed_payment` event
EventData FailedPaymentEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for FailedPaymentEvent.
@@ -29,13 +29,17 @@ type FailedPaymentEvent struct {
func (f FailedPaymentEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(f.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(f.toMap())
}
// toMap converts the FailedPaymentEvent object to a map representation for JSON marshaling.
func (f FailedPaymentEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, f.AdditionalProperties)
+ MergeAdditionalProperties(structMap, f.AdditionalProperties)
structMap["id"] = f.Id
structMap["timestamp"] = f.Timestamp.Format(time.RFC3339)
structMap["invoice"] = f.Invoice.toMap()
@@ -56,12 +60,12 @@ func (f *FailedPaymentEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
f.AdditionalProperties = additionalProperties
+
f.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/failed_payment_event_data.go b/models/failed_payment_event_data.go
index 8819c929..8618512b 100644
--- a/models/failed_payment_event_data.go
+++ b/models/failed_payment_event_data.go
@@ -23,7 +23,7 @@ type FailedPaymentEventData struct {
PaymentMethod InvoicePaymentMethodType `json:"payment_method"`
// The transaction ID of the failed payment.
TransactionId int `json:"transaction_id"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for FailedPaymentEventData.
@@ -31,13 +31,17 @@ type FailedPaymentEventData struct {
func (f FailedPaymentEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(f.AdditionalProperties,
+ "amount_in_cents", "applied_amount", "memo", "payment_method", "transaction_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(f.toMap())
}
// toMap converts the FailedPaymentEventData object to a map representation for JSON marshaling.
func (f FailedPaymentEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, f.AdditionalProperties)
+ MergeAdditionalProperties(structMap, f.AdditionalProperties)
structMap["amount_in_cents"] = f.AmountInCents
structMap["applied_amount"] = f.AppliedAmount
if f.Memo.IsValueSet() {
@@ -64,12 +68,12 @@ func (f *FailedPaymentEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "amount_in_cents", "applied_amount", "memo", "payment_method", "transaction_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "amount_in_cents", "applied_amount", "memo", "payment_method", "transaction_id")
if err != nil {
return err
}
-
f.AdditionalProperties = additionalProperties
+
f.AmountInCents = *temp.AmountInCents
f.AppliedAmount = *temp.AppliedAmount
f.Memo = temp.Memo
diff --git a/models/full_subscription_group_response.go b/models/full_subscription_group_response.go
index 7a019f07..30c77bc8 100644
--- a/models/full_subscription_group_response.go
+++ b/models/full_subscription_group_response.go
@@ -45,7 +45,7 @@ type FullSubscriptionGroupResponse struct {
CurrentBillingAmountInCents *int64 `json:"current_billing_amount_in_cents,omitempty"`
Customer *SubscriptionGroupCustomer `json:"customer,omitempty"`
AccountBalances *SubscriptionGroupBalances `json:"account_balances,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for FullSubscriptionGroupResponse.
@@ -53,13 +53,17 @@ type FullSubscriptionGroupResponse struct {
func (f FullSubscriptionGroupResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(f.AdditionalProperties,
+ "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period", "current_billing_amount_in_cents", "customer", "account_balances"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(f.toMap())
}
// toMap converts the FullSubscriptionGroupResponse object to a map representation for JSON marshaling.
func (f FullSubscriptionGroupResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, f.AdditionalProperties)
+ MergeAdditionalProperties(structMap, f.AdditionalProperties)
if f.Uid != nil {
structMap["uid"] = f.Uid
}
@@ -107,12 +111,12 @@ func (f *FullSubscriptionGroupResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period", "current_billing_amount_in_cents", "customer", "account_balances")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period", "current_billing_amount_in_cents", "customer", "account_balances")
if err != nil {
return err
}
-
f.AdditionalProperties = additionalProperties
+
f.Uid = temp.Uid
f.Scheme = temp.Scheme
f.CustomerId = temp.CustomerId
diff --git a/models/get_one_time_token_payment_profile.go b/models/get_one_time_token_payment_profile.go
index 4bbdb94f..aa78c565 100644
--- a/models/get_one_time_token_payment_profile.go
+++ b/models/get_one_time_token_payment_profile.go
@@ -13,30 +13,30 @@ import (
// GetOneTimeTokenPaymentProfile represents a GetOneTimeTokenPaymentProfile struct.
type GetOneTimeTokenPaymentProfile struct {
- Id Optional[string] `json:"id"`
- FirstName string `json:"first_name"`
- LastName string `json:"last_name"`
- MaskedCardNumber string `json:"masked_card_number"`
+ Id Optional[string] `json:"id"`
+ FirstName string `json:"first_name"`
+ LastName string `json:"last_name"`
+ MaskedCardNumber string `json:"masked_card_number"`
// 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"`
+ CardType CardType `json:"card_type"`
+ ExpirationMonth float64 `json:"expiration_month"`
+ ExpirationYear float64 `json:"expiration_year"`
+ CustomerId Optional[string] `json:"customer_id"`
// The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing.
- CurrentVault CreditCardVault `json:"current_vault"`
- VaultToken string `json:"vault_token"`
- BillingAddress string `json:"billing_address"`
- BillingAddress2 *string `json:"billing_address_2,omitempty"`
- BillingCity string `json:"billing_city"`
- BillingCountry string `json:"billing_country"`
- BillingState string `json:"billing_state"`
- BillingZip string `json:"billing_zip"`
- PaymentType string `json:"payment_type"`
- Disabled bool `json:"disabled"`
- SiteGatewaySettingId int `json:"site_gateway_setting_id"`
- CustomerVaultToken Optional[string] `json:"customer_vault_token"`
- GatewayHandle Optional[string] `json:"gateway_handle"`
- AdditionalProperties map[string]any `json:"_"`
+ CurrentVault CreditCardVault `json:"current_vault"`
+ VaultToken string `json:"vault_token"`
+ BillingAddress string `json:"billing_address"`
+ BillingAddress2 *string `json:"billing_address_2,omitempty"`
+ BillingCity string `json:"billing_city"`
+ BillingCountry string `json:"billing_country"`
+ BillingState string `json:"billing_state"`
+ BillingZip string `json:"billing_zip"`
+ PaymentType string `json:"payment_type"`
+ Disabled bool `json:"disabled"`
+ SiteGatewaySettingId int `json:"site_gateway_setting_id"`
+ CustomerVaultToken Optional[string] `json:"customer_vault_token"`
+ GatewayHandle Optional[string] `json:"gateway_handle"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for GetOneTimeTokenPaymentProfile.
@@ -44,13 +44,17 @@ type GetOneTimeTokenPaymentProfile struct {
func (g GetOneTimeTokenPaymentProfile) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(g.AdditionalProperties,
+ "id", "first_name", "last_name", "masked_card_number", "card_type", "expiration_month", "expiration_year", "customer_id", "current_vault", "vault_token", "billing_address", "billing_address_2", "billing_city", "billing_country", "billing_state", "billing_zip", "payment_type", "disabled", "site_gateway_setting_id", "customer_vault_token", "gateway_handle"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(g.toMap())
}
// toMap converts the GetOneTimeTokenPaymentProfile object to a map representation for JSON marshaling.
func (g GetOneTimeTokenPaymentProfile) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, g.AdditionalProperties)
+ MergeAdditionalProperties(structMap, g.AdditionalProperties)
if g.Id.IsValueSet() {
if g.Id.Value() != nil {
structMap["id"] = g.Id.Value()
@@ -113,12 +117,12 @@ func (g *GetOneTimeTokenPaymentProfile) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "first_name", "last_name", "masked_card_number", "card_type", "expiration_month", "expiration_year", "customer_id", "current_vault", "vault_token", "billing_address", "billing_address_2", "billing_city", "billing_country", "billing_state", "billing_zip", "payment_type", "disabled", "site_gateway_setting_id", "customer_vault_token", "gateway_handle")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "first_name", "last_name", "masked_card_number", "card_type", "expiration_month", "expiration_year", "customer_id", "current_vault", "vault_token", "billing_address", "billing_address_2", "billing_city", "billing_country", "billing_state", "billing_zip", "payment_type", "disabled", "site_gateway_setting_id", "customer_vault_token", "gateway_handle")
if err != nil {
return err
}
-
g.AdditionalProperties = additionalProperties
+
g.Id = temp.Id
g.FirstName = *temp.FirstName
g.LastName = *temp.LastName
diff --git a/models/get_one_time_token_request.go b/models/get_one_time_token_request.go
index 8dc88580..4598ee11 100644
--- a/models/get_one_time_token_request.go
+++ b/models/get_one_time_token_request.go
@@ -14,7 +14,7 @@ import (
// GetOneTimeTokenRequest represents a GetOneTimeTokenRequest struct.
type GetOneTimeTokenRequest struct {
PaymentProfile GetOneTimeTokenPaymentProfile `json:"payment_profile"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for GetOneTimeTokenRequest.
@@ -22,13 +22,17 @@ type GetOneTimeTokenRequest struct {
func (g GetOneTimeTokenRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(g.AdditionalProperties,
+ "payment_profile"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(g.toMap())
}
// toMap converts the GetOneTimeTokenRequest object to a map representation for JSON marshaling.
func (g GetOneTimeTokenRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, g.AdditionalProperties)
+ MergeAdditionalProperties(structMap, g.AdditionalProperties)
structMap["payment_profile"] = g.PaymentProfile.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (g *GetOneTimeTokenRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payment_profile")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payment_profile")
if err != nil {
return err
}
-
g.AdditionalProperties = additionalProperties
+
g.PaymentProfile = *temp.PaymentProfile
return nil
}
diff --git a/models/group_billing.go b/models/group_billing.go
index 11e862a7..e50e228e 100644
--- a/models/group_billing.go
+++ b/models/group_billing.go
@@ -13,12 +13,12 @@ import (
// Optional attributes related to billing date and accrual. Note: Only applicable for new subscriptions.
type GroupBilling struct {
// A flag indicating whether or not to accrue charges on the new subscription.
- Accrue *bool `json:"accrue,omitempty"`
+ Accrue *bool `json:"accrue,omitempty"`
// A flag indicating whether or not to align the billing date of the new subscription with the billing date of the primary subscription of the hierarchy's default subscription group. Required to be true if prorate is also true.
- AlignDate *bool `json:"align_date,omitempty"`
+ AlignDate *bool `json:"align_date,omitempty"`
// A flag indicating whether or not to prorate billing of the new subscription for the current period. A value of true is ignored unless align_date is also true.
- Prorate *bool `json:"prorate,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Prorate *bool `json:"prorate,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for GroupBilling.
@@ -26,13 +26,17 @@ type GroupBilling struct {
func (g GroupBilling) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(g.AdditionalProperties,
+ "accrue", "align_date", "prorate"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(g.toMap())
}
// toMap converts the GroupBilling object to a map representation for JSON marshaling.
func (g GroupBilling) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, g.AdditionalProperties)
+ MergeAdditionalProperties(structMap, g.AdditionalProperties)
if g.Accrue != nil {
structMap["accrue"] = g.Accrue
}
@@ -53,12 +57,12 @@ func (g *GroupBilling) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "accrue", "align_date", "prorate")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "accrue", "align_date", "prorate")
if err != nil {
return err
}
-
g.AdditionalProperties = additionalProperties
+
g.Accrue = temp.Accrue
g.AlignDate = temp.AlignDate
g.Prorate = temp.Prorate
diff --git a/models/group_settings.go b/models/group_settings.go
index 0106c7b6..8a098e2d 100644
--- a/models/group_settings.go
+++ b/models/group_settings.go
@@ -14,10 +14,10 @@ import (
// GroupSettings represents a GroupSettings struct.
type GroupSettings struct {
// Attributes of the target customer who will be the responsible payer of the created subscription. Required.
- Target GroupTarget `json:"target"`
+ Target GroupTarget `json:"target"`
// Optional attributes related to billing date and accrual. Note: Only applicable for new subscriptions.
- Billing *GroupBilling `json:"billing,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Billing *GroupBilling `json:"billing,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for GroupSettings.
@@ -25,13 +25,17 @@ type GroupSettings struct {
func (g GroupSettings) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(g.AdditionalProperties,
+ "target", "billing"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(g.toMap())
}
// toMap converts the GroupSettings object to a map representation for JSON marshaling.
func (g GroupSettings) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, g.AdditionalProperties)
+ MergeAdditionalProperties(structMap, g.AdditionalProperties)
structMap["target"] = g.Target.toMap()
if g.Billing != nil {
structMap["billing"] = g.Billing.toMap()
@@ -51,12 +55,12 @@ func (g *GroupSettings) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "target", "billing")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "target", "billing")
if err != nil {
return err
}
-
g.AdditionalProperties = additionalProperties
+
g.Target = *temp.Target
g.Billing = temp.Billing
return nil
diff --git a/models/group_target.go b/models/group_target.go
index a9e03c72..98aaeb87 100644
--- a/models/group_target.go
+++ b/models/group_target.go
@@ -15,10 +15,10 @@ import (
// Attributes of the target customer who will be the responsible payer of the created subscription. Required.
type GroupTarget struct {
// The type of object indicated by the id attribute.
- Type GroupTargetType `json:"type"`
+ Type GroupTargetType `json:"type"`
// The id of the target customer or subscription to group the existing subscription with. Ignored and should not be included if type is "self" , "parent", or "eldest"
- Id *int `json:"id,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for GroupTarget.
@@ -26,13 +26,17 @@ type GroupTarget struct {
func (g GroupTarget) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(g.AdditionalProperties,
+ "type", "id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(g.toMap())
}
// toMap converts the GroupTarget object to a map representation for JSON marshaling.
func (g GroupTarget) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, g.AdditionalProperties)
+ MergeAdditionalProperties(structMap, g.AdditionalProperties)
structMap["type"] = g.Type
if g.Id != nil {
structMap["id"] = g.Id
@@ -52,12 +56,12 @@ func (g *GroupTarget) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "type", "id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "type", "id")
if err != nil {
return err
}
-
g.AdditionalProperties = additionalProperties
+
g.Type = *temp.Type
g.Id = temp.Id
return nil
diff --git a/models/historic_usage.go b/models/historic_usage.go
index 8f5c3bac..b0689a90 100644
--- a/models/historic_usage.go
+++ b/models/historic_usage.go
@@ -15,12 +15,12 @@ import (
// Optional for Event Based Components. If the `include=historic_usages` query param is provided, the last ten billing periods will be returned.
type HistoricUsage struct {
// Total usage of a component for billing period
- TotalUsageQuantity *float64 `json:"total_usage_quantity,omitempty"`
+ TotalUsageQuantity *float64 `json:"total_usage_quantity,omitempty"`
// Start date of billing period
- BillingPeriodStartsAt *time.Time `json:"billing_period_starts_at,omitempty"`
+ BillingPeriodStartsAt *time.Time `json:"billing_period_starts_at,omitempty"`
// End date of billing period
- BillingPeriodEndsAt *time.Time `json:"billing_period_ends_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ BillingPeriodEndsAt *time.Time `json:"billing_period_ends_at,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for HistoricUsage.
@@ -28,13 +28,17 @@ type HistoricUsage struct {
func (h HistoricUsage) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(h.AdditionalProperties,
+ "total_usage_quantity", "billing_period_starts_at", "billing_period_ends_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(h.toMap())
}
// toMap converts the HistoricUsage object to a map representation for JSON marshaling.
func (h HistoricUsage) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, h.AdditionalProperties)
+ MergeAdditionalProperties(structMap, h.AdditionalProperties)
if h.TotalUsageQuantity != nil {
structMap["total_usage_quantity"] = h.TotalUsageQuantity
}
@@ -55,12 +59,12 @@ func (h *HistoricUsage) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "total_usage_quantity", "billing_period_starts_at", "billing_period_ends_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "total_usage_quantity", "billing_period_starts_at", "billing_period_ends_at")
if err != nil {
return err
}
-
h.AdditionalProperties = additionalProperties
+
h.TotalUsageQuantity = temp.TotalUsageQuantity
if temp.BillingPeriodStartsAt != nil {
BillingPeriodStartsAtVal, err := time.Parse(time.RFC3339, *temp.BillingPeriodStartsAt)
diff --git a/models/invoice.go b/models/invoice.go
index a191277c..b3fa15e7 100644
--- a/models/invoice.go
+++ b/models/invoice.go
@@ -92,6 +92,7 @@ type Invoice struct {
// The amount of credit (from credit notes) applied to this invoice.
// Credits offset the amount due from the customer.
CreditAmount *string `json:"credit_amount,omitempty"`
+ DebitAmount *string `json:"debit_amount,omitempty"`
RefundAmount *string `json:"refund_amount,omitempty"`
// The amount paid on the invoice by the customer.
PaidAmount *string `json:"paid_amount,omitempty"`
@@ -102,16 +103,18 @@ type Invoice struct {
Discounts []InvoiceDiscount `json:"discounts,omitempty"`
Taxes []InvoiceTax `json:"taxes,omitempty"`
Credits []InvoiceCredit `json:"credits,omitempty"`
+ Debits []InvoiceDebit `json:"debits,omitempty"`
Refunds []InvoiceRefund `json:"refunds,omitempty"`
Payments []InvoicePayment `json:"payments,omitempty"`
CustomFields []InvoiceCustomField `json:"custom_fields,omitempty"`
DisplaySettings *InvoiceDisplaySettings `json:"display_settings,omitempty"`
+ AvataxDetails *InvoiceAvataxDetails `json:"avatax_details,omitempty"`
// The public URL of the invoice
PublicUrl *string `json:"public_url,omitempty"`
PreviousBalanceData *InvoicePreviousBalance `json:"previous_balance_data,omitempty"`
// The format is `"YYYY-MM-DD"`.
PublicUrlExpiresOn *time.Time `json:"public_url_expires_on,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Invoice.
@@ -119,13 +122,17 @@ type Invoice struct {
func (i Invoice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "id", "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "transaction_time", "created_at", "updated_at", "issue_date", "due_date", "paid_date", "status", "role", "parent_invoice_id", "collection_method", "payment_instructions", "currency", "consolidation_level", "parent_invoice_uid", "subscription_group_id", "parent_invoice_number", "group_primary_subscription_id", "product_name", "product_family_name", "seller", "customer", "payer", "recipient_emails", "net_terms", "memo", "billing_address", "shipping_address", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "credit_amount", "debit_amount", "refund_amount", "paid_amount", "due_amount", "line_items", "discounts", "taxes", "credits", "debits", "refunds", "payments", "custom_fields", "display_settings", "avatax_details", "public_url", "previous_balance_data", "public_url_expires_on"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the Invoice object to a map representation for JSON marshaling.
func (i Invoice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Id != nil {
structMap["id"] = i.Id
}
@@ -272,6 +279,9 @@ func (i Invoice) toMap() map[string]any {
if i.CreditAmount != nil {
structMap["credit_amount"] = i.CreditAmount
}
+ if i.DebitAmount != nil {
+ structMap["debit_amount"] = i.DebitAmount
+ }
if i.RefundAmount != nil {
structMap["refund_amount"] = i.RefundAmount
}
@@ -293,6 +303,9 @@ func (i Invoice) toMap() map[string]any {
if i.Credits != nil {
structMap["credits"] = i.Credits
}
+ if i.Debits != nil {
+ structMap["debits"] = i.Debits
+ }
if i.Refunds != nil {
structMap["refunds"] = i.Refunds
}
@@ -305,6 +318,9 @@ func (i Invoice) toMap() map[string]any {
if i.DisplaySettings != nil {
structMap["display_settings"] = i.DisplaySettings.toMap()
}
+ if i.AvataxDetails != nil {
+ structMap["avatax_details"] = i.AvataxDetails.toMap()
+ }
if i.PublicUrl != nil {
structMap["public_url"] = i.PublicUrl
}
@@ -325,12 +341,12 @@ func (i *Invoice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "transaction_time", "created_at", "updated_at", "issue_date", "due_date", "paid_date", "status", "role", "parent_invoice_id", "collection_method", "payment_instructions", "currency", "consolidation_level", "parent_invoice_uid", "subscription_group_id", "parent_invoice_number", "group_primary_subscription_id", "product_name", "product_family_name", "seller", "customer", "payer", "recipient_emails", "net_terms", "memo", "billing_address", "shipping_address", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "credit_amount", "refund_amount", "paid_amount", "due_amount", "line_items", "discounts", "taxes", "credits", "refunds", "payments", "custom_fields", "display_settings", "public_url", "previous_balance_data", "public_url_expires_on")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "transaction_time", "created_at", "updated_at", "issue_date", "due_date", "paid_date", "status", "role", "parent_invoice_id", "collection_method", "payment_instructions", "currency", "consolidation_level", "parent_invoice_uid", "subscription_group_id", "parent_invoice_number", "group_primary_subscription_id", "product_name", "product_family_name", "seller", "customer", "payer", "recipient_emails", "net_terms", "memo", "billing_address", "shipping_address", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "credit_amount", "debit_amount", "refund_amount", "paid_amount", "due_amount", "line_items", "discounts", "taxes", "credits", "debits", "refunds", "payments", "custom_fields", "display_settings", "avatax_details", "public_url", "previous_balance_data", "public_url_expires_on")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Id = temp.Id
i.Uid = temp.Uid
i.SiteId = temp.SiteId
@@ -407,6 +423,7 @@ func (i *Invoice) UnmarshalJSON(input []byte) error {
i.TaxAmount = temp.TaxAmount
i.TotalAmount = temp.TotalAmount
i.CreditAmount = temp.CreditAmount
+ i.DebitAmount = temp.DebitAmount
i.RefundAmount = temp.RefundAmount
i.PaidAmount = temp.PaidAmount
i.DueAmount = temp.DueAmount
@@ -414,10 +431,12 @@ func (i *Invoice) UnmarshalJSON(input []byte) error {
i.Discounts = temp.Discounts
i.Taxes = temp.Taxes
i.Credits = temp.Credits
+ i.Debits = temp.Debits
i.Refunds = temp.Refunds
i.Payments = temp.Payments
i.CustomFields = temp.CustomFields
i.DisplaySettings = temp.DisplaySettings
+ i.AvataxDetails = temp.AvataxDetails
i.PublicUrl = temp.PublicUrl
i.PreviousBalanceData = temp.PreviousBalanceData
if temp.PublicUrlExpiresOn != nil {
@@ -471,6 +490,7 @@ type tempInvoice struct {
TaxAmount *string `json:"tax_amount,omitempty"`
TotalAmount *string `json:"total_amount,omitempty"`
CreditAmount *string `json:"credit_amount,omitempty"`
+ DebitAmount *string `json:"debit_amount,omitempty"`
RefundAmount *string `json:"refund_amount,omitempty"`
PaidAmount *string `json:"paid_amount,omitempty"`
DueAmount *string `json:"due_amount,omitempty"`
@@ -478,10 +498,12 @@ type tempInvoice struct {
Discounts []InvoiceDiscount `json:"discounts,omitempty"`
Taxes []InvoiceTax `json:"taxes,omitempty"`
Credits []InvoiceCredit `json:"credits,omitempty"`
+ Debits []InvoiceDebit `json:"debits,omitempty"`
Refunds []InvoiceRefund `json:"refunds,omitempty"`
Payments []InvoicePayment `json:"payments,omitempty"`
CustomFields []InvoiceCustomField `json:"custom_fields,omitempty"`
DisplaySettings *InvoiceDisplaySettings `json:"display_settings,omitempty"`
+ AvataxDetails *InvoiceAvataxDetails `json:"avatax_details,omitempty"`
PublicUrl *string `json:"public_url,omitempty"`
PreviousBalanceData *InvoicePreviousBalance `json:"previous_balance_data,omitempty"`
PublicUrlExpiresOn *string `json:"public_url_expires_on,omitempty"`
diff --git a/models/invoice_address.go b/models/invoice_address.go
index f0dff6bd..2200e1b0 100644
--- a/models/invoice_address.go
+++ b/models/invoice_address.go
@@ -11,13 +11,13 @@ import (
// InvoiceAddress represents a InvoiceAddress struct.
type InvoiceAddress struct {
- Street Optional[string] `json:"street"`
- Line2 Optional[string] `json:"line2"`
- City Optional[string] `json:"city"`
- State Optional[string] `json:"state"`
- Zip Optional[string] `json:"zip"`
- Country Optional[string] `json:"country"`
- AdditionalProperties map[string]any `json:"_"`
+ Street Optional[string] `json:"street"`
+ Line2 Optional[string] `json:"line2"`
+ City Optional[string] `json:"city"`
+ State Optional[string] `json:"state"`
+ Zip Optional[string] `json:"zip"`
+ Country Optional[string] `json:"country"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceAddress.
@@ -25,13 +25,17 @@ type InvoiceAddress struct {
func (i InvoiceAddress) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "street", "line2", "city", "state", "zip", "country"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceAddress object to a map representation for JSON marshaling.
func (i InvoiceAddress) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Street.IsValueSet() {
if i.Street.Value() != nil {
structMap["street"] = i.Street.Value()
@@ -85,12 +89,12 @@ func (i *InvoiceAddress) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "street", "line2", "city", "state", "zip", "country")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "street", "line2", "city", "state", "zip", "country")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Street = temp.Street
i.Line2 = temp.Line2
i.City = temp.City
diff --git a/models/invoice_avatax_details.go b/models/invoice_avatax_details.go
new file mode 100644
index 00000000..061e0c18
--- /dev/null
+++ b/models/invoice_avatax_details.go
@@ -0,0 +1,131 @@
+/*
+Package advancedbilling
+
+This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
+*/
+package models
+
+import (
+ "encoding/json"
+ "log"
+ "time"
+)
+
+// InvoiceAvataxDetails represents a InvoiceAvataxDetails struct.
+type InvoiceAvataxDetails struct {
+ Id Optional[int64] `json:"id"`
+ Status Optional[string] `json:"status"`
+ DocumentCode Optional[string] `json:"document_code"`
+ CommitDate Optional[time.Time] `json:"commit_date"`
+ ModifyDate Optional[time.Time] `json:"modify_date"`
+ AdditionalProperties map[string]interface{} `json:"_"`
+}
+
+// MarshalJSON implements the json.Marshaler interface for InvoiceAvataxDetails.
+// It customizes the JSON marshaling process for InvoiceAvataxDetails objects.
+func (i InvoiceAvataxDetails) MarshalJSON() (
+ []byte,
+ error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "id", "status", "document_code", "commit_date", "modify_date"); err != nil {
+ return []byte{}, err
+ }
+ return json.Marshal(i.toMap())
+}
+
+// toMap converts the InvoiceAvataxDetails object to a map representation for JSON marshaling.
+func (i InvoiceAvataxDetails) toMap() map[string]any {
+ structMap := make(map[string]any)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
+ if i.Id.IsValueSet() {
+ if i.Id.Value() != nil {
+ structMap["id"] = i.Id.Value()
+ } else {
+ structMap["id"] = nil
+ }
+ }
+ if i.Status.IsValueSet() {
+ if i.Status.Value() != nil {
+ structMap["status"] = i.Status.Value()
+ } else {
+ structMap["status"] = nil
+ }
+ }
+ if i.DocumentCode.IsValueSet() {
+ if i.DocumentCode.Value() != nil {
+ structMap["document_code"] = i.DocumentCode.Value()
+ } else {
+ structMap["document_code"] = nil
+ }
+ }
+ if i.CommitDate.IsValueSet() {
+ var CommitDateVal *string = nil
+ if i.CommitDate.Value() != nil {
+ val := i.CommitDate.Value().Format(time.RFC3339)
+ CommitDateVal = &val
+ }
+ if i.CommitDate.Value() != nil {
+ structMap["commit_date"] = CommitDateVal
+ } else {
+ structMap["commit_date"] = nil
+ }
+ }
+ if i.ModifyDate.IsValueSet() {
+ var ModifyDateVal *string = nil
+ if i.ModifyDate.Value() != nil {
+ val := i.ModifyDate.Value().Format(time.RFC3339)
+ ModifyDateVal = &val
+ }
+ if i.ModifyDate.Value() != nil {
+ structMap["modify_date"] = ModifyDateVal
+ } else {
+ structMap["modify_date"] = nil
+ }
+ }
+ return structMap
+}
+
+// UnmarshalJSON implements the json.Unmarshaler interface for InvoiceAvataxDetails.
+// It customizes the JSON unmarshaling process for InvoiceAvataxDetails objects.
+func (i *InvoiceAvataxDetails) UnmarshalJSON(input []byte) error {
+ var temp tempInvoiceAvataxDetails
+ err := json.Unmarshal(input, &temp)
+ if err != nil {
+ return err
+ }
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "status", "document_code", "commit_date", "modify_date")
+ if err != nil {
+ return err
+ }
+ i.AdditionalProperties = additionalProperties
+
+ i.Id = temp.Id
+ i.Status = temp.Status
+ i.DocumentCode = temp.DocumentCode
+ i.CommitDate.ShouldSetValue(temp.CommitDate.IsValueSet())
+ if temp.CommitDate.Value() != nil {
+ CommitDateVal, err := time.Parse(time.RFC3339, (*temp.CommitDate.Value()))
+ if err != nil {
+ log.Fatalf("Cannot Parse commit_date as % s format.", time.RFC3339)
+ }
+ i.CommitDate.SetValue(&CommitDateVal)
+ }
+ i.ModifyDate.ShouldSetValue(temp.ModifyDate.IsValueSet())
+ if temp.ModifyDate.Value() != nil {
+ ModifyDateVal, err := time.Parse(time.RFC3339, (*temp.ModifyDate.Value()))
+ if err != nil {
+ log.Fatalf("Cannot Parse modify_date as % s format.", time.RFC3339)
+ }
+ i.ModifyDate.SetValue(&ModifyDateVal)
+ }
+ return nil
+}
+
+// tempInvoiceAvataxDetails is a temporary struct used for validating the fields of InvoiceAvataxDetails.
+type tempInvoiceAvataxDetails struct {
+ Id Optional[int64] `json:"id"`
+ Status Optional[string] `json:"status"`
+ DocumentCode Optional[string] `json:"document_code"`
+ CommitDate Optional[string] `json:"commit_date"`
+ ModifyDate Optional[string] `json:"modify_date"`
+}
diff --git a/models/invoice_balance_item.go b/models/invoice_balance_item.go
index 5a03bb44..5a28cf68 100644
--- a/models/invoice_balance_item.go
+++ b/models/invoice_balance_item.go
@@ -11,10 +11,10 @@ import (
// InvoiceBalanceItem represents a InvoiceBalanceItem struct.
type InvoiceBalanceItem struct {
- Uid *string `json:"uid,omitempty"`
- Number *string `json:"number,omitempty"`
- OutstandingAmount *string `json:"outstanding_amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Uid *string `json:"uid,omitempty"`
+ Number *string `json:"number,omitempty"`
+ OutstandingAmount *string `json:"outstanding_amount,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceBalanceItem.
@@ -22,13 +22,17 @@ type InvoiceBalanceItem struct {
func (i InvoiceBalanceItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "uid", "number", "outstanding_amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceBalanceItem object to a map representation for JSON marshaling.
func (i InvoiceBalanceItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Uid != nil {
structMap["uid"] = i.Uid
}
@@ -49,12 +53,12 @@ func (i *InvoiceBalanceItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "number", "outstanding_amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "number", "outstanding_amount")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Uid = temp.Uid
i.Number = temp.Number
i.OutstandingAmount = temp.OutstandingAmount
diff --git a/models/invoice_credit.go b/models/invoice_credit.go
index 0aff7cae..a36c0f78 100644
--- a/models/invoice_credit.go
+++ b/models/invoice_credit.go
@@ -13,14 +13,14 @@ import (
// InvoiceCredit represents a InvoiceCredit struct.
type InvoiceCredit struct {
- Uid *string `json:"uid,omitempty"`
- CreditNoteNumber *string `json:"credit_note_number,omitempty"`
- CreditNoteUid *string `json:"credit_note_uid,omitempty"`
- TransactionTime *time.Time `json:"transaction_time,omitempty"`
- Memo *string `json:"memo,omitempty"`
- OriginalAmount *string `json:"original_amount,omitempty"`
- AppliedAmount *string `json:"applied_amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Uid *string `json:"uid,omitempty"`
+ CreditNoteNumber *string `json:"credit_note_number,omitempty"`
+ CreditNoteUid *string `json:"credit_note_uid,omitempty"`
+ TransactionTime *time.Time `json:"transaction_time,omitempty"`
+ Memo *string `json:"memo,omitempty"`
+ OriginalAmount *string `json:"original_amount,omitempty"`
+ AppliedAmount *string `json:"applied_amount,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceCredit.
@@ -28,13 +28,17 @@ type InvoiceCredit struct {
func (i InvoiceCredit) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "uid", "credit_note_number", "credit_note_uid", "transaction_time", "memo", "original_amount", "applied_amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceCredit object to a map representation for JSON marshaling.
func (i InvoiceCredit) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Uid != nil {
structMap["uid"] = i.Uid
}
@@ -67,12 +71,12 @@ func (i *InvoiceCredit) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "credit_note_number", "credit_note_uid", "transaction_time", "memo", "original_amount", "applied_amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "credit_note_number", "credit_note_uid", "transaction_time", "memo", "original_amount", "applied_amount")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Uid = temp.Uid
i.CreditNoteNumber = temp.CreditNoteNumber
i.CreditNoteUid = temp.CreditNoteUid
diff --git a/models/invoice_custom_field.go b/models/invoice_custom_field.go
index 6bd2e580..06864a5d 100644
--- a/models/invoice_custom_field.go
+++ b/models/invoice_custom_field.go
@@ -11,12 +11,12 @@ import (
// InvoiceCustomField represents a InvoiceCustomField struct.
type InvoiceCustomField struct {
- OwnerId *int `json:"owner_id,omitempty"`
- OwnerType *CustomFieldOwner `json:"owner_type,omitempty"`
- Name *string `json:"name,omitempty"`
- Value *string `json:"value,omitempty"`
- MetadatumId *int `json:"metadatum_id,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ OwnerId *int `json:"owner_id,omitempty"`
+ OwnerType *CustomFieldOwner `json:"owner_type,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Value *string `json:"value,omitempty"`
+ MetadatumId *int `json:"metadatum_id,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceCustomField.
@@ -24,13 +24,17 @@ type InvoiceCustomField struct {
func (i InvoiceCustomField) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "owner_id", "owner_type", "name", "value", "metadatum_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceCustomField object to a map representation for JSON marshaling.
func (i InvoiceCustomField) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.OwnerId != nil {
structMap["owner_id"] = i.OwnerId
}
@@ -57,12 +61,12 @@ func (i *InvoiceCustomField) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "owner_id", "owner_type", "name", "value", "metadatum_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "owner_id", "owner_type", "name", "value", "metadatum_id")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.OwnerId = temp.OwnerId
i.OwnerType = temp.OwnerType
i.Name = temp.Name
diff --git a/models/invoice_customer.go b/models/invoice_customer.go
index f9278e12..83dff00f 100644
--- a/models/invoice_customer.go
+++ b/models/invoice_customer.go
@@ -12,14 +12,14 @@ import (
// InvoiceCustomer represents a InvoiceCustomer struct.
// Information about the customer who is owner or recipient the invoiced subscription.
type InvoiceCustomer struct {
- ChargifyId Optional[int] `json:"chargify_id"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- Organization Optional[string] `json:"organization"`
- Email *string `json:"email,omitempty"`
- VatNumber Optional[string] `json:"vat_number"`
- Reference Optional[string] `json:"reference"`
- AdditionalProperties map[string]any `json:"_"`
+ ChargifyId Optional[int] `json:"chargify_id"`
+ FirstName *string `json:"first_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
+ Organization Optional[string] `json:"organization"`
+ Email *string `json:"email,omitempty"`
+ VatNumber Optional[string] `json:"vat_number"`
+ Reference Optional[string] `json:"reference"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceCustomer.
@@ -27,13 +27,17 @@ type InvoiceCustomer struct {
func (i InvoiceCustomer) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "chargify_id", "first_name", "last_name", "organization", "email", "vat_number", "reference"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceCustomer object to a map representation for JSON marshaling.
func (i InvoiceCustomer) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.ChargifyId.IsValueSet() {
if i.ChargifyId.Value() != nil {
structMap["chargify_id"] = i.ChargifyId.Value()
@@ -82,12 +86,12 @@ func (i *InvoiceCustomer) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "chargify_id", "first_name", "last_name", "organization", "email", "vat_number", "reference")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "chargify_id", "first_name", "last_name", "organization", "email", "vat_number", "reference")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.ChargifyId = temp.ChargifyId
i.FirstName = temp.FirstName
i.LastName = temp.LastName
diff --git a/models/invoice_debit.go b/models/invoice_debit.go
new file mode 100644
index 00000000..801ea84d
--- /dev/null
+++ b/models/invoice_debit.go
@@ -0,0 +1,112 @@
+/*
+Package advancedbilling
+
+This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
+*/
+package models
+
+import (
+ "encoding/json"
+ "log"
+ "time"
+)
+
+// InvoiceDebit represents a InvoiceDebit struct.
+type InvoiceDebit struct {
+ Uid *string `json:"uid,omitempty"`
+ DebitNoteNumber *string `json:"debit_note_number,omitempty"`
+ DebitNoteUid *string `json:"debit_note_uid,omitempty"`
+ // The role of the debit note.
+ Role *DebitNoteRole `json:"role,omitempty"`
+ TransactionTime *time.Time `json:"transaction_time,omitempty"`
+ Memo *string `json:"memo,omitempty"`
+ OriginalAmount *string `json:"original_amount,omitempty"`
+ AppliedAmount *string `json:"applied_amount,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
+}
+
+// MarshalJSON implements the json.Marshaler interface for InvoiceDebit.
+// It customizes the JSON marshaling process for InvoiceDebit objects.
+func (i InvoiceDebit) MarshalJSON() (
+ []byte,
+ error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "uid", "debit_note_number", "debit_note_uid", "role", "transaction_time", "memo", "original_amount", "applied_amount"); err != nil {
+ return []byte{}, err
+ }
+ return json.Marshal(i.toMap())
+}
+
+// toMap converts the InvoiceDebit object to a map representation for JSON marshaling.
+func (i InvoiceDebit) toMap() map[string]any {
+ structMap := make(map[string]any)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
+ if i.Uid != nil {
+ structMap["uid"] = i.Uid
+ }
+ if i.DebitNoteNumber != nil {
+ structMap["debit_note_number"] = i.DebitNoteNumber
+ }
+ if i.DebitNoteUid != nil {
+ structMap["debit_note_uid"] = i.DebitNoteUid
+ }
+ if i.Role != nil {
+ structMap["role"] = i.Role
+ }
+ if i.TransactionTime != nil {
+ structMap["transaction_time"] = i.TransactionTime.Format(time.RFC3339)
+ }
+ if i.Memo != nil {
+ structMap["memo"] = i.Memo
+ }
+ if i.OriginalAmount != nil {
+ structMap["original_amount"] = i.OriginalAmount
+ }
+ if i.AppliedAmount != nil {
+ structMap["applied_amount"] = i.AppliedAmount
+ }
+ return structMap
+}
+
+// UnmarshalJSON implements the json.Unmarshaler interface for InvoiceDebit.
+// It customizes the JSON unmarshaling process for InvoiceDebit objects.
+func (i *InvoiceDebit) UnmarshalJSON(input []byte) error {
+ var temp tempInvoiceDebit
+ err := json.Unmarshal(input, &temp)
+ if err != nil {
+ return err
+ }
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "debit_note_number", "debit_note_uid", "role", "transaction_time", "memo", "original_amount", "applied_amount")
+ if err != nil {
+ return err
+ }
+ i.AdditionalProperties = additionalProperties
+
+ i.Uid = temp.Uid
+ i.DebitNoteNumber = temp.DebitNoteNumber
+ i.DebitNoteUid = temp.DebitNoteUid
+ i.Role = temp.Role
+ if temp.TransactionTime != nil {
+ TransactionTimeVal, err := time.Parse(time.RFC3339, *temp.TransactionTime)
+ if err != nil {
+ log.Fatalf("Cannot Parse transaction_time as % s format.", time.RFC3339)
+ }
+ i.TransactionTime = &TransactionTimeVal
+ }
+ i.Memo = temp.Memo
+ i.OriginalAmount = temp.OriginalAmount
+ i.AppliedAmount = temp.AppliedAmount
+ return nil
+}
+
+// tempInvoiceDebit is a temporary struct used for validating the fields of InvoiceDebit.
+type tempInvoiceDebit struct {
+ Uid *string `json:"uid,omitempty"`
+ DebitNoteNumber *string `json:"debit_note_number,omitempty"`
+ DebitNoteUid *string `json:"debit_note_uid,omitempty"`
+ Role *DebitNoteRole `json:"role,omitempty"`
+ TransactionTime *string `json:"transaction_time,omitempty"`
+ Memo *string `json:"memo,omitempty"`
+ OriginalAmount *string `json:"original_amount,omitempty"`
+ AppliedAmount *string `json:"applied_amount,omitempty"`
+}
diff --git a/models/invoice_discount.go b/models/invoice_discount.go
index 3f2c6945..7c33951a 100644
--- a/models/invoice_discount.go
+++ b/models/invoice_discount.go
@@ -23,7 +23,7 @@ type InvoiceDiscount struct {
DiscountAmount *string `json:"discount_amount,omitempty"`
TransactionId *int `json:"transaction_id,omitempty"`
LineItemBreakouts []InvoiceDiscountBreakout `json:"line_item_breakouts,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceDiscount.
@@ -31,13 +31,17 @@ type InvoiceDiscount struct {
func (i InvoiceDiscount) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "uid", "title", "description", "code", "source_type", "source_id", "discount_type", "percentage", "eligible_amount", "discount_amount", "transaction_id", "line_item_breakouts"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceDiscount object to a map representation for JSON marshaling.
func (i InvoiceDiscount) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Uid != nil {
structMap["uid"] = i.Uid
}
@@ -89,12 +93,12 @@ func (i *InvoiceDiscount) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "title", "description", "code", "source_type", "source_id", "discount_type", "percentage", "eligible_amount", "discount_amount", "transaction_id", "line_item_breakouts")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "title", "description", "code", "source_type", "source_id", "discount_type", "percentage", "eligible_amount", "discount_amount", "transaction_id", "line_item_breakouts")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Uid = temp.Uid
i.Title = temp.Title
i.Description = temp.Description
diff --git a/models/invoice_discount_breakout.go b/models/invoice_discount_breakout.go
index 2213b4c8..8e945861 100644
--- a/models/invoice_discount_breakout.go
+++ b/models/invoice_discount_breakout.go
@@ -11,10 +11,10 @@ import (
// InvoiceDiscountBreakout represents a InvoiceDiscountBreakout struct.
type InvoiceDiscountBreakout struct {
- Uid *string `json:"uid,omitempty"`
- EligibleAmount *string `json:"eligible_amount,omitempty"`
- DiscountAmount *string `json:"discount_amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Uid *string `json:"uid,omitempty"`
+ EligibleAmount *string `json:"eligible_amount,omitempty"`
+ DiscountAmount *string `json:"discount_amount,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceDiscountBreakout.
@@ -22,13 +22,17 @@ type InvoiceDiscountBreakout struct {
func (i InvoiceDiscountBreakout) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "uid", "eligible_amount", "discount_amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceDiscountBreakout object to a map representation for JSON marshaling.
func (i InvoiceDiscountBreakout) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Uid != nil {
structMap["uid"] = i.Uid
}
@@ -49,12 +53,12 @@ func (i *InvoiceDiscountBreakout) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "eligible_amount", "discount_amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "eligible_amount", "discount_amount")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Uid = temp.Uid
i.EligibleAmount = temp.EligibleAmount
i.DiscountAmount = temp.DiscountAmount
diff --git a/models/invoice_display_settings.go b/models/invoice_display_settings.go
index b4a715a8..e27f8a49 100644
--- a/models/invoice_display_settings.go
+++ b/models/invoice_display_settings.go
@@ -11,9 +11,9 @@ import (
// InvoiceDisplaySettings represents a InvoiceDisplaySettings struct.
type InvoiceDisplaySettings struct {
- HideZeroSubtotalLines *bool `json:"hide_zero_subtotal_lines,omitempty"`
- IncludeDiscountsOnLines *bool `json:"include_discounts_on_lines,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ HideZeroSubtotalLines *bool `json:"hide_zero_subtotal_lines,omitempty"`
+ IncludeDiscountsOnLines *bool `json:"include_discounts_on_lines,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceDisplaySettings.
@@ -21,13 +21,17 @@ type InvoiceDisplaySettings struct {
func (i InvoiceDisplaySettings) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "hide_zero_subtotal_lines", "include_discounts_on_lines"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceDisplaySettings object to a map representation for JSON marshaling.
func (i InvoiceDisplaySettings) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.HideZeroSubtotalLines != nil {
structMap["hide_zero_subtotal_lines"] = i.HideZeroSubtotalLines
}
@@ -45,12 +49,12 @@ func (i *InvoiceDisplaySettings) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "hide_zero_subtotal_lines", "include_discounts_on_lines")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "hide_zero_subtotal_lines", "include_discounts_on_lines")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.HideZeroSubtotalLines = temp.HideZeroSubtotalLines
i.IncludeDiscountsOnLines = temp.IncludeDiscountsOnLines
return nil
diff --git a/models/invoice_issued.go b/models/invoice_issued.go
index d6f19a99..ccecfd3e 100644
--- a/models/invoice_issued.go
+++ b/models/invoice_issued.go
@@ -32,7 +32,7 @@ type InvoiceIssued struct {
ProductName string `json:"product_name"`
ConsolidationLevel string `json:"consolidation_level"`
LineItems []InvoiceLineItemEventData `json:"line_items"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceIssued.
@@ -40,13 +40,17 @@ type InvoiceIssued struct {
func (i InvoiceIssued) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "uid", "number", "role", "due_date", "issue_date", "paid_date", "due_amount", "paid_amount", "tax_amount", "refund_amount", "total_amount", "status_amount", "product_name", "consolidation_level", "line_items"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceIssued object to a map representation for JSON marshaling.
func (i InvoiceIssued) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
structMap["uid"] = i.Uid
structMap["number"] = i.Number
structMap["role"] = i.Role
@@ -81,12 +85,12 @@ func (i *InvoiceIssued) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "number", "role", "due_date", "issue_date", "paid_date", "due_amount", "paid_amount", "tax_amount", "refund_amount", "total_amount", "status_amount", "product_name", "consolidation_level", "line_items")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "number", "role", "due_date", "issue_date", "paid_date", "due_amount", "paid_amount", "tax_amount", "refund_amount", "total_amount", "status_amount", "product_name", "consolidation_level", "line_items")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Uid = *temp.Uid
i.Number = *temp.Number
i.Role = *temp.Role
diff --git a/models/invoice_line_item.go b/models/invoice_line_item.go
index 87d730a0..b07d5e5c 100644
--- a/models/invoice_line_item.go
+++ b/models/invoice_line_item.go
@@ -14,58 +14,59 @@ import (
// InvoiceLineItem represents a InvoiceLineItem struct.
type InvoiceLineItem struct {
// Unique identifier for the line item. Useful when cross-referencing the line against individual discounts in the `discounts` or `taxes` lists.
- Uid *string `json:"uid,omitempty"`
+ Uid *string `json:"uid,omitempty"`
// A short descriptor for the charge or item represented by this line.
- Title *string `json:"title,omitempty"`
+ Title *string `json:"title,omitempty"`
// Detailed description for the charge or item represented by this line. May include proration details in plain text.
// Note: this string may contain line breaks that are hints for the best display format on the invoice.
- Description *string `json:"description,omitempty"`
+ Description *string `json:"description,omitempty"`
// The quantity or count of units billed by the line item.
// This is a decimal number represented as a string. (See "About Decimal Numbers".)
- Quantity *string `json:"quantity,omitempty"`
+ Quantity *string `json:"quantity,omitempty"`
// The price per unit for the line item.
// When tiered pricing was used (i.e. not every unit was actually priced at the same price) this will be the blended average cost per unit and the `tiered_unit_price` field will be set to `true`.
- UnitPrice *string `json:"unit_price,omitempty"`
+ UnitPrice *string `json:"unit_price,omitempty"`
// The line subtotal, generally calculated as `quantity * unit_price`. This is the canonical amount of record for the line - when rounding differences are in play, `subtotal_amount` takes precedence over the value derived from `quantity * unit_price` (which may not have the proper precision to exactly equal this amount).
- SubtotalAmount *string `json:"subtotal_amount,omitempty"`
+ SubtotalAmount *string `json:"subtotal_amount,omitempty"`
// The approximate discount applied to just this line.
// The value is approximated in cases where rounding errors make it difficult to apportion exactly a total discount among many lines. Several lines may have been summed prior to applying the discount to arrive at `discount_amount` for the invoice - backing that out to the discount on a single line may introduce rounding or precision errors.
- DiscountAmount *string `json:"discount_amount,omitempty"`
+ DiscountAmount *string `json:"discount_amount,omitempty"`
// The approximate tax applied to just this line.
// The value is approximated in cases where rounding errors make it difficult to apportion exactly a total tax among many lines. Several lines may have been summed prior to applying the tax rate to arrive at `tax_amount` for the invoice - backing that out to the tax on a single line may introduce rounding or precision errors.
- TaxAmount *string `json:"tax_amount,omitempty"`
+ TaxAmount *string `json:"tax_amount,omitempty"`
// The non-canonical total amount for the line.
// `subtotal_amount` is the canonical amount for a line. The invoice `total_amount` is derived from the sum of the line `subtotal_amount`s and discounts or taxes applied thereafter. Therefore, due to rounding or precision errors, the sum of line `total_amount`s may not equal the invoice `total_amount`.
- TotalAmount *string `json:"total_amount,omitempty"`
+ TotalAmount *string `json:"total_amount,omitempty"`
// When `true`, indicates that the actual pricing scheme for the line was tiered, so the `unit_price` shown is the blended average for all units.
- TieredUnitPrice *bool `json:"tiered_unit_price,omitempty"`
+ TieredUnitPrice *bool `json:"tiered_unit_price,omitempty"`
// Start date for the period covered by this line. The format is `"YYYY-MM-DD"`.
// * For periodic charges paid in advance, this date will match the billing date, and the end date will be in the future.
// * For periodic charges paid in arrears (e.g. metered charges), this date will be the date of the previous billing, and the end date will be the current billing date.
// * For non-periodic charges, this date and the end date will match.
- PeriodRangeStart *time.Time `json:"period_range_start,omitempty"`
+ PeriodRangeStart *time.Time `json:"period_range_start,omitempty"`
// End date for the period covered by this line. The format is `"YYYY-MM-DD"`.
// * For periodic charges paid in advance, this date will match the next (future) billing date.
// * For periodic charges paid in arrears (e.g. metered charges), this date will be the date of the current billing date.
// * For non-periodic charges, this date and the start date will match.
- PeriodRangeEnd *time.Time `json:"period_range_end,omitempty"`
- TransactionId *int `json:"transaction_id,omitempty"`
+ PeriodRangeEnd *time.Time `json:"period_range_end,omitempty"`
+ TransactionId *int `json:"transaction_id,omitempty"`
// The ID of the product subscribed when the charge was made.
// This may be set even for component charges, so true product-only (non-component) charges will also have a nil `component_id`.
- ProductId Optional[int] `json:"product_id"`
+ ProductId Optional[int] `json:"product_id"`
// The version of the product subscribed when the charge was made.
- ProductVersion Optional[int] `json:"product_version"`
+ ProductVersion Optional[int] `json:"product_version"`
// The ID of the component being billed. Will be `nil` for non-component charges.
- ComponentId Optional[int] `json:"component_id"`
+ ComponentId Optional[int] `json:"component_id"`
// The price point ID of the component being billed. Will be `nil` for non-component charges.
- PricePointId Optional[int] `json:"price_point_id"`
- Hide *bool `json:"hide,omitempty"`
- ComponentCostData Optional[InvoiceLineItemComponentCostData] `json:"component_cost_data"`
+ PricePointId Optional[int] `json:"price_point_id"`
+ BillingScheduleItemId Optional[int] `json:"billing_schedule_item_id"`
+ Hide *bool `json:"hide,omitempty"`
+ ComponentCostData Optional[InvoiceLineItemComponentCostData] `json:"component_cost_data"`
// The price point ID of the line item's product
- ProductPricePointId Optional[int] `json:"product_price_point_id"`
- CustomItem *bool `json:"custom_item,omitempty"`
- Kind *string `json:"kind,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ProductPricePointId Optional[int] `json:"product_price_point_id"`
+ CustomItem *bool `json:"custom_item,omitempty"`
+ Kind *string `json:"kind,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceLineItem.
@@ -73,13 +74,17 @@ type InvoiceLineItem struct {
func (i InvoiceLineItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "uid", "title", "description", "quantity", "unit_price", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "tiered_unit_price", "period_range_start", "period_range_end", "transaction_id", "product_id", "product_version", "component_id", "price_point_id", "billing_schedule_item_id", "hide", "component_cost_data", "product_price_point_id", "custom_item", "kind"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceLineItem object to a map representation for JSON marshaling.
func (i InvoiceLineItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Uid != nil {
structMap["uid"] = i.Uid
}
@@ -147,6 +152,13 @@ func (i InvoiceLineItem) toMap() map[string]any {
structMap["price_point_id"] = nil
}
}
+ if i.BillingScheduleItemId.IsValueSet() {
+ if i.BillingScheduleItemId.Value() != nil {
+ structMap["billing_schedule_item_id"] = i.BillingScheduleItemId.Value()
+ } else {
+ structMap["billing_schedule_item_id"] = nil
+ }
+ }
if i.Hide != nil {
structMap["hide"] = i.Hide
}
@@ -181,12 +193,12 @@ func (i *InvoiceLineItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "title", "description", "quantity", "unit_price", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "tiered_unit_price", "period_range_start", "period_range_end", "transaction_id", "product_id", "product_version", "component_id", "price_point_id", "hide", "component_cost_data", "product_price_point_id", "custom_item", "kind")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "title", "description", "quantity", "unit_price", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "tiered_unit_price", "period_range_start", "period_range_end", "transaction_id", "product_id", "product_version", "component_id", "price_point_id", "billing_schedule_item_id", "hide", "component_cost_data", "product_price_point_id", "custom_item", "kind")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Uid = temp.Uid
i.Title = temp.Title
i.Description = temp.Description
@@ -216,6 +228,7 @@ func (i *InvoiceLineItem) UnmarshalJSON(input []byte) error {
i.ProductVersion = temp.ProductVersion
i.ComponentId = temp.ComponentId
i.PricePointId = temp.PricePointId
+ i.BillingScheduleItemId = temp.BillingScheduleItemId
i.Hide = temp.Hide
i.ComponentCostData = temp.ComponentCostData
i.ProductPricePointId = temp.ProductPricePointId
@@ -226,26 +239,27 @@ func (i *InvoiceLineItem) UnmarshalJSON(input []byte) error {
// tempInvoiceLineItem is a temporary struct used for validating the fields of InvoiceLineItem.
type tempInvoiceLineItem struct {
- Uid *string `json:"uid,omitempty"`
- Title *string `json:"title,omitempty"`
- Description *string `json:"description,omitempty"`
- Quantity *string `json:"quantity,omitempty"`
- UnitPrice *string `json:"unit_price,omitempty"`
- SubtotalAmount *string `json:"subtotal_amount,omitempty"`
- DiscountAmount *string `json:"discount_amount,omitempty"`
- TaxAmount *string `json:"tax_amount,omitempty"`
- TotalAmount *string `json:"total_amount,omitempty"`
- TieredUnitPrice *bool `json:"tiered_unit_price,omitempty"`
- PeriodRangeStart *string `json:"period_range_start,omitempty"`
- PeriodRangeEnd *string `json:"period_range_end,omitempty"`
- TransactionId *int `json:"transaction_id,omitempty"`
- ProductId Optional[int] `json:"product_id"`
- ProductVersion Optional[int] `json:"product_version"`
- ComponentId Optional[int] `json:"component_id"`
- PricePointId Optional[int] `json:"price_point_id"`
- Hide *bool `json:"hide,omitempty"`
- ComponentCostData Optional[InvoiceLineItemComponentCostData] `json:"component_cost_data"`
- ProductPricePointId Optional[int] `json:"product_price_point_id"`
- CustomItem *bool `json:"custom_item,omitempty"`
- Kind *string `json:"kind,omitempty"`
+ Uid *string `json:"uid,omitempty"`
+ Title *string `json:"title,omitempty"`
+ Description *string `json:"description,omitempty"`
+ Quantity *string `json:"quantity,omitempty"`
+ UnitPrice *string `json:"unit_price,omitempty"`
+ SubtotalAmount *string `json:"subtotal_amount,omitempty"`
+ DiscountAmount *string `json:"discount_amount,omitempty"`
+ TaxAmount *string `json:"tax_amount,omitempty"`
+ TotalAmount *string `json:"total_amount,omitempty"`
+ TieredUnitPrice *bool `json:"tiered_unit_price,omitempty"`
+ PeriodRangeStart *string `json:"period_range_start,omitempty"`
+ PeriodRangeEnd *string `json:"period_range_end,omitempty"`
+ TransactionId *int `json:"transaction_id,omitempty"`
+ ProductId Optional[int] `json:"product_id"`
+ ProductVersion Optional[int] `json:"product_version"`
+ ComponentId Optional[int] `json:"component_id"`
+ PricePointId Optional[int] `json:"price_point_id"`
+ BillingScheduleItemId Optional[int] `json:"billing_schedule_item_id"`
+ Hide *bool `json:"hide,omitempty"`
+ ComponentCostData Optional[InvoiceLineItemComponentCostData] `json:"component_cost_data"`
+ ProductPricePointId Optional[int] `json:"product_price_point_id"`
+ CustomItem *bool `json:"custom_item,omitempty"`
+ Kind *string `json:"kind,omitempty"`
}
diff --git a/models/invoice_line_item_component_cost_data.go b/models/invoice_line_item_component_cost_data.go
index 5a1804c7..cabb13d7 100644
--- a/models/invoice_line_item_component_cost_data.go
+++ b/models/invoice_line_item_component_cost_data.go
@@ -11,8 +11,8 @@ import (
// InvoiceLineItemComponentCostData represents a InvoiceLineItemComponentCostData struct.
type InvoiceLineItemComponentCostData struct {
- Rates []ComponentCostData `json:"rates,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Rates []ComponentCostData `json:"rates,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceLineItemComponentCostData.
@@ -20,13 +20,17 @@ type InvoiceLineItemComponentCostData struct {
func (i InvoiceLineItemComponentCostData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "rates"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceLineItemComponentCostData object to a map representation for JSON marshaling.
func (i InvoiceLineItemComponentCostData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Rates != nil {
structMap["rates"] = i.Rates
}
@@ -41,12 +45,12 @@ func (i *InvoiceLineItemComponentCostData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "rates")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "rates")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Rates = temp.Rates
return nil
}
diff --git a/models/invoice_line_item_event_data.go b/models/invoice_line_item_event_data.go
index 3363e7b5..7f3305a1 100644
--- a/models/invoice_line_item_event_data.go
+++ b/models/invoice_line_item_event_data.go
@@ -31,7 +31,7 @@ type InvoiceLineItemEventData struct {
ComponentId Optional[int] `json:"component_id"`
BillingScheduleItemId Optional[int] `json:"billing_schedule_item_id"`
CustomItem Optional[bool] `json:"custom_item"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceLineItemEventData.
@@ -39,13 +39,17 @@ type InvoiceLineItemEventData struct {
func (i InvoiceLineItemEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "uid", "title", "description", "quantity", "quantity_delta", "unit_price", "period_range_start", "period_range_end", "amount", "line_references", "pricing_details_index", "pricing_details", "tax_code", "tax_amount", "product_id", "product_price_point_id", "price_point_id", "component_id", "billing_schedule_item_id", "custom_item"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceLineItemEventData object to a map representation for JSON marshaling.
func (i InvoiceLineItemEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Uid != nil {
structMap["uid"] = i.Uid
}
@@ -149,12 +153,12 @@ func (i *InvoiceLineItemEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "title", "description", "quantity", "quantity_delta", "unit_price", "period_range_start", "period_range_end", "amount", "line_references", "pricing_details_index", "pricing_details", "tax_code", "tax_amount", "product_id", "product_price_point_id", "price_point_id", "component_id", "billing_schedule_item_id", "custom_item")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "title", "description", "quantity", "quantity_delta", "unit_price", "period_range_start", "period_range_end", "amount", "line_references", "pricing_details_index", "pricing_details", "tax_code", "tax_amount", "product_id", "product_price_point_id", "price_point_id", "component_id", "billing_schedule_item_id", "custom_item")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Uid = temp.Uid
i.Title = temp.Title
i.Description = temp.Description
diff --git a/models/invoice_line_item_pricing_detail.go b/models/invoice_line_item_pricing_detail.go
index d0a088da..e74dd3d7 100644
--- a/models/invoice_line_item_pricing_detail.go
+++ b/models/invoice_line_item_pricing_detail.go
@@ -11,9 +11,9 @@ import (
// InvoiceLineItemPricingDetail represents a InvoiceLineItemPricingDetail struct.
type InvoiceLineItemPricingDetail struct {
- Label *string `json:"label,omitempty"`
- Amount *string `json:"amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Label *string `json:"label,omitempty"`
+ Amount *string `json:"amount,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceLineItemPricingDetail.
@@ -21,13 +21,17 @@ type InvoiceLineItemPricingDetail struct {
func (i InvoiceLineItemPricingDetail) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "label", "amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceLineItemPricingDetail object to a map representation for JSON marshaling.
func (i InvoiceLineItemPricingDetail) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Label != nil {
structMap["label"] = i.Label
}
@@ -45,12 +49,12 @@ func (i *InvoiceLineItemPricingDetail) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "label", "amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "label", "amount")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Label = temp.Label
i.Amount = temp.Amount
return nil
diff --git a/models/invoice_payer.go b/models/invoice_payer.go
index 2a9feb70..48a84420 100644
--- a/models/invoice_payer.go
+++ b/models/invoice_payer.go
@@ -11,13 +11,13 @@ import (
// InvoicePayer represents a InvoicePayer struct.
type InvoicePayer struct {
- ChargifyId *int `json:"chargify_id,omitempty"`
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- Organization Optional[string] `json:"organization"`
- Email *string `json:"email,omitempty"`
- VatNumber Optional[string] `json:"vat_number"`
- AdditionalProperties map[string]any `json:"_"`
+ ChargifyId *int `json:"chargify_id,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
+ Organization Optional[string] `json:"organization"`
+ Email *string `json:"email,omitempty"`
+ VatNumber Optional[string] `json:"vat_number"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoicePayer.
@@ -25,13 +25,17 @@ type InvoicePayer struct {
func (i InvoicePayer) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "chargify_id", "first_name", "last_name", "organization", "email", "vat_number"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoicePayer object to a map representation for JSON marshaling.
func (i InvoicePayer) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.ChargifyId != nil {
structMap["chargify_id"] = i.ChargifyId
}
@@ -69,12 +73,12 @@ func (i *InvoicePayer) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "chargify_id", "first_name", "last_name", "organization", "email", "vat_number")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "chargify_id", "first_name", "last_name", "organization", "email", "vat_number")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.ChargifyId = temp.ChargifyId
i.FirstName = temp.FirstName
i.LastName = temp.LastName
diff --git a/models/invoice_payer_change.go b/models/invoice_payer_change.go
index 7235da91..0a774b33 100644
--- a/models/invoice_payer_change.go
+++ b/models/invoice_payer_change.go
@@ -11,11 +11,11 @@ import (
// InvoicePayerChange represents a InvoicePayerChange struct.
type InvoicePayerChange struct {
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- Organization *string `json:"organization,omitempty"`
- Email *string `json:"email,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ FirstName *string `json:"first_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
+ Organization *string `json:"organization,omitempty"`
+ Email *string `json:"email,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoicePayerChange.
@@ -23,13 +23,17 @@ type InvoicePayerChange struct {
func (i InvoicePayerChange) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "first_name", "last_name", "organization", "email"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoicePayerChange object to a map representation for JSON marshaling.
func (i InvoicePayerChange) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.FirstName != nil {
structMap["first_name"] = i.FirstName
}
@@ -53,12 +57,12 @@ func (i *InvoicePayerChange) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "first_name", "last_name", "organization", "email")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "first_name", "last_name", "organization", "email")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.FirstName = temp.FirstName
i.LastName = temp.LastName
i.Organization = temp.Organization
diff --git a/models/invoice_payment.go b/models/invoice_payment.go
index b7066954..c0cc6f4e 100644
--- a/models/invoice_payment.go
+++ b/models/invoice_payment.go
@@ -13,22 +13,22 @@ import (
// InvoicePayment represents a InvoicePayment struct.
type InvoicePayment struct {
- TransactionTime *time.Time `json:"transaction_time,omitempty"`
- Memo *string `json:"memo,omitempty"`
- OriginalAmount *string `json:"original_amount,omitempty"`
- AppliedAmount *string `json:"applied_amount,omitempty"`
- PaymentMethod *InvoicePaymentMethod `json:"payment_method,omitempty"`
- TransactionId *int `json:"transaction_id,omitempty"`
- Prepayment *bool `json:"prepayment,omitempty"`
- GatewayHandle Optional[string] `json:"gateway_handle"`
- GatewayUsed *string `json:"gateway_used,omitempty"`
+ TransactionTime *time.Time `json:"transaction_time,omitempty"`
+ Memo *string `json:"memo,omitempty"`
+ OriginalAmount *string `json:"original_amount,omitempty"`
+ AppliedAmount *string `json:"applied_amount,omitempty"`
+ PaymentMethod *InvoicePaymentMethod `json:"payment_method,omitempty"`
+ TransactionId *int `json:"transaction_id,omitempty"`
+ Prepayment *bool `json:"prepayment,omitempty"`
+ GatewayHandle Optional[string] `json:"gateway_handle"`
+ GatewayUsed *string `json:"gateway_used,omitempty"`
// The transaction ID for the payment as returned from the payment gateway
- GatewayTransactionId Optional[string] `json:"gateway_transaction_id"`
+ GatewayTransactionId Optional[string] `json:"gateway_transaction_id"`
// Date reflecting when the payment was received from a customer. Must be in the past. Applicable only to
// `external` payments.
- ReceivedOn Optional[time.Time] `json:"received_on"`
- Uid *string `json:"uid,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ReceivedOn Optional[time.Time] `json:"received_on"`
+ Uid *string `json:"uid,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoicePayment.
@@ -36,13 +36,17 @@ type InvoicePayment struct {
func (i InvoicePayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "transaction_time", "memo", "original_amount", "applied_amount", "payment_method", "transaction_id", "prepayment", "gateway_handle", "gateway_used", "gateway_transaction_id", "received_on", "uid"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoicePayment object to a map representation for JSON marshaling.
func (i InvoicePayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.TransactionTime != nil {
structMap["transaction_time"] = i.TransactionTime.Format(time.RFC3339)
}
@@ -107,12 +111,12 @@ func (i *InvoicePayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "transaction_time", "memo", "original_amount", "applied_amount", "payment_method", "transaction_id", "prepayment", "gateway_handle", "gateway_used", "gateway_transaction_id", "received_on", "uid")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "transaction_time", "memo", "original_amount", "applied_amount", "payment_method", "transaction_id", "prepayment", "gateway_handle", "gateway_used", "gateway_transaction_id", "received_on", "uid")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
if temp.TransactionTime != nil {
TransactionTimeVal, err := time.Parse(time.RFC3339, *temp.TransactionTime)
if err != nil {
diff --git a/models/invoice_payment_application.go b/models/invoice_payment_application.go
index f57b200c..7da6f86c 100644
--- a/models/invoice_payment_application.go
+++ b/models/invoice_payment_application.go
@@ -12,12 +12,12 @@ import (
// InvoicePaymentApplication represents a InvoicePaymentApplication struct.
type InvoicePaymentApplication struct {
// Unique identifier for the paid invoice. It has the prefix "inv_" followed by alphanumeric characters.
- InvoiceUid *string `json:"invoice_uid,omitempty"`
+ InvoiceUid *string `json:"invoice_uid,omitempty"`
// Unique identifier for the payment. It has the prefix "pmt_" followed by alphanumeric characters.
- ApplicationUid *string `json:"application_uid,omitempty"`
+ ApplicationUid *string `json:"application_uid,omitempty"`
// Dollar amount of the paid invoice.
- AppliedAmount *string `json:"applied_amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AppliedAmount *string `json:"applied_amount,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoicePaymentApplication.
@@ -25,13 +25,17 @@ type InvoicePaymentApplication struct {
func (i InvoicePaymentApplication) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "invoice_uid", "application_uid", "applied_amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoicePaymentApplication object to a map representation for JSON marshaling.
func (i InvoicePaymentApplication) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.InvoiceUid != nil {
structMap["invoice_uid"] = i.InvoiceUid
}
@@ -52,12 +56,12 @@ func (i *InvoicePaymentApplication) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "invoice_uid", "application_uid", "applied_amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "invoice_uid", "application_uid", "applied_amount")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.InvoiceUid = temp.InvoiceUid
i.ApplicationUid = temp.ApplicationUid
i.AppliedAmount = temp.AppliedAmount
diff --git a/models/invoice_payment_method.go b/models/invoice_payment_method.go
index 5e589721..1e58c13c 100644
--- a/models/invoice_payment_method.go
+++ b/models/invoice_payment_method.go
@@ -11,15 +11,15 @@ import (
// InvoicePaymentMethod represents a InvoicePaymentMethod struct.
type InvoicePaymentMethod struct {
- Details *string `json:"details,omitempty"`
- Kind *string `json:"kind,omitempty"`
- Memo *string `json:"memo,omitempty"`
- Type *string `json:"type,omitempty"`
- CardBrand *string `json:"card_brand,omitempty"`
- CardExpiration *string `json:"card_expiration,omitempty"`
- LastFour Optional[string] `json:"last_four"`
- MaskedCardNumber *string `json:"masked_card_number,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Details *string `json:"details,omitempty"`
+ Kind *string `json:"kind,omitempty"`
+ Memo *string `json:"memo,omitempty"`
+ Type *string `json:"type,omitempty"`
+ CardBrand *string `json:"card_brand,omitempty"`
+ CardExpiration *string `json:"card_expiration,omitempty"`
+ LastFour Optional[string] `json:"last_four"`
+ MaskedCardNumber *string `json:"masked_card_number,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoicePaymentMethod.
@@ -27,13 +27,17 @@ type InvoicePaymentMethod struct {
func (i InvoicePaymentMethod) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "details", "kind", "memo", "type", "card_brand", "card_expiration", "last_four", "masked_card_number"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoicePaymentMethod object to a map representation for JSON marshaling.
func (i InvoicePaymentMethod) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Details != nil {
structMap["details"] = i.Details
}
@@ -73,12 +77,12 @@ func (i *InvoicePaymentMethod) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "details", "kind", "memo", "type", "card_brand", "card_expiration", "last_four", "masked_card_number")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "details", "kind", "memo", "type", "card_brand", "card_expiration", "last_four", "masked_card_number")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Details = temp.Details
i.Kind = temp.Kind
i.Memo = temp.Memo
diff --git a/models/invoice_pre_payment.go b/models/invoice_pre_payment.go
index 741d859a..680d2c22 100644
--- a/models/invoice_pre_payment.go
+++ b/models/invoice_pre_payment.go
@@ -12,12 +12,12 @@ import (
// InvoicePrePayment represents a InvoicePrePayment struct.
type InvoicePrePayment struct {
// The subscription id for the prepayment account
- SubscriptionId *int `json:"subscription_id,omitempty"`
+ SubscriptionId *int `json:"subscription_id,omitempty"`
// The amount in cents of the prepayment that was created as a result of this payment.
- AmountInCents *int64 `json:"amount_in_cents,omitempty"`
+ AmountInCents *int64 `json:"amount_in_cents,omitempty"`
// The total balance of the prepayment account for this subscription including any prior prepayments
- EndingBalanceInCents *int64 `json:"ending_balance_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ EndingBalanceInCents *int64 `json:"ending_balance_in_cents,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoicePrePayment.
@@ -25,13 +25,17 @@ type InvoicePrePayment struct {
func (i InvoicePrePayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "subscription_id", "amount_in_cents", "ending_balance_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoicePrePayment object to a map representation for JSON marshaling.
func (i InvoicePrePayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.SubscriptionId != nil {
structMap["subscription_id"] = i.SubscriptionId
}
@@ -52,12 +56,12 @@ func (i *InvoicePrePayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_id", "amount_in_cents", "ending_balance_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_id", "amount_in_cents", "ending_balance_in_cents")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.SubscriptionId = temp.SubscriptionId
i.AmountInCents = temp.AmountInCents
i.EndingBalanceInCents = temp.EndingBalanceInCents
diff --git a/models/invoice_previous_balance.go b/models/invoice_previous_balance.go
index 6e40b649..cb9e5032 100644
--- a/models/invoice_previous_balance.go
+++ b/models/invoice_previous_balance.go
@@ -13,9 +13,9 @@ import (
// InvoicePreviousBalance represents a InvoicePreviousBalance struct.
type InvoicePreviousBalance struct {
- CapturedAt *time.Time `json:"captured_at,omitempty"`
- Invoices []InvoiceBalanceItem `json:"invoices,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CapturedAt *time.Time `json:"captured_at,omitempty"`
+ Invoices []InvoiceBalanceItem `json:"invoices,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoicePreviousBalance.
@@ -23,13 +23,17 @@ type InvoicePreviousBalance struct {
func (i InvoicePreviousBalance) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "captured_at", "invoices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoicePreviousBalance object to a map representation for JSON marshaling.
func (i InvoicePreviousBalance) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.CapturedAt != nil {
structMap["captured_at"] = i.CapturedAt.Format(time.RFC3339)
}
@@ -47,12 +51,12 @@ func (i *InvoicePreviousBalance) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "captured_at", "invoices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "captured_at", "invoices")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
if temp.CapturedAt != nil {
CapturedAtVal, err := time.Parse(time.RFC3339, *temp.CapturedAt)
if err != nil {
diff --git a/models/invoice_refund.go b/models/invoice_refund.go
index 36bbbfef..eed662e6 100644
--- a/models/invoice_refund.go
+++ b/models/invoice_refund.go
@@ -11,17 +11,17 @@ import (
// InvoiceRefund represents a InvoiceRefund struct.
type InvoiceRefund struct {
- TransactionId *int `json:"transaction_id,omitempty"`
- PaymentId *int `json:"payment_id,omitempty"`
- Memo *string `json:"memo,omitempty"`
- OriginalAmount *string `json:"original_amount,omitempty"`
- AppliedAmount *string `json:"applied_amount,omitempty"`
+ TransactionId *int `json:"transaction_id,omitempty"`
+ PaymentId *int `json:"payment_id,omitempty"`
+ Memo *string `json:"memo,omitempty"`
+ OriginalAmount *string `json:"original_amount,omitempty"`
+ AppliedAmount *string `json:"applied_amount,omitempty"`
// The transaction ID for the refund as returned from the payment gateway
- GatewayTransactionId Optional[string] `json:"gateway_transaction_id"`
- GatewayUsed *string `json:"gateway_used,omitempty"`
- GatewayHandle Optional[string] `json:"gateway_handle"`
- AchLateReject Optional[bool] `json:"ach_late_reject"`
- AdditionalProperties map[string]any `json:"_"`
+ GatewayTransactionId Optional[string] `json:"gateway_transaction_id"`
+ GatewayUsed *string `json:"gateway_used,omitempty"`
+ GatewayHandle Optional[string] `json:"gateway_handle"`
+ AchLateReject Optional[bool] `json:"ach_late_reject"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceRefund.
@@ -29,13 +29,17 @@ type InvoiceRefund struct {
func (i InvoiceRefund) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "transaction_id", "payment_id", "memo", "original_amount", "applied_amount", "gateway_transaction_id", "gateway_used", "gateway_handle", "ach_late_reject"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceRefund object to a map representation for JSON marshaling.
func (i InvoiceRefund) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.TransactionId != nil {
structMap["transaction_id"] = i.TransactionId
}
@@ -86,12 +90,12 @@ func (i *InvoiceRefund) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "transaction_id", "payment_id", "memo", "original_amount", "applied_amount", "gateway_transaction_id", "gateway_used", "gateway_handle", "ach_late_reject")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "transaction_id", "payment_id", "memo", "original_amount", "applied_amount", "gateway_transaction_id", "gateway_used", "gateway_handle", "ach_late_reject")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.TransactionId = temp.TransactionId
i.PaymentId = temp.PaymentId
i.Memo = temp.Memo
diff --git a/models/invoice_response.go b/models/invoice_response.go
index 759a6de0..4850d523 100644
--- a/models/invoice_response.go
+++ b/models/invoice_response.go
@@ -13,8 +13,8 @@ import (
// InvoiceResponse represents a InvoiceResponse struct.
type InvoiceResponse struct {
- Invoice Invoice `json:"invoice"`
- AdditionalProperties map[string]any `json:"_"`
+ Invoice Invoice `json:"invoice"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceResponse.
@@ -22,13 +22,17 @@ type InvoiceResponse struct {
func (i InvoiceResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "invoice"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceResponse object to a map representation for JSON marshaling.
func (i InvoiceResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
structMap["invoice"] = i.Invoice.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (i *InvoiceResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "invoice")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "invoice")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Invoice = *temp.Invoice
return nil
}
diff --git a/models/invoice_seller.go b/models/invoice_seller.go
index 767693c3..b0d856b6 100644
--- a/models/invoice_seller.go
+++ b/models/invoice_seller.go
@@ -12,11 +12,11 @@ import (
// InvoiceSeller represents a InvoiceSeller struct.
// Information about the seller (merchant) listed on the masthead of the invoice.
type InvoiceSeller struct {
- Name *string `json:"name,omitempty"`
- Address *InvoiceAddress `json:"address,omitempty"`
- Phone *string `json:"phone,omitempty"`
- LogoUrl Optional[string] `json:"logo_url"`
- AdditionalProperties map[string]any `json:"_"`
+ Name *string `json:"name,omitempty"`
+ Address *InvoiceAddress `json:"address,omitempty"`
+ Phone *string `json:"phone,omitempty"`
+ LogoUrl Optional[string] `json:"logo_url"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceSeller.
@@ -24,13 +24,17 @@ type InvoiceSeller struct {
func (i InvoiceSeller) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "name", "address", "phone", "logo_url"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceSeller object to a map representation for JSON marshaling.
func (i InvoiceSeller) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Name != nil {
structMap["name"] = i.Name
}
@@ -58,12 +62,12 @@ func (i *InvoiceSeller) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "address", "phone", "logo_url")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "address", "phone", "logo_url")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Name = temp.Name
i.Address = temp.Address
i.Phone = temp.Phone
diff --git a/models/invoice_tax.go b/models/invoice_tax.go
index ac1ee5a0..949316c4 100644
--- a/models/invoice_tax.go
+++ b/models/invoice_tax.go
@@ -25,7 +25,7 @@ type InvoiceTax struct {
EuVat *bool `json:"eu_vat,omitempty"`
Type *string `json:"type,omitempty"`
TaxExemptAmount *string `json:"tax_exempt_amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceTax.
@@ -33,13 +33,17 @@ type InvoiceTax struct {
func (i InvoiceTax) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "uid", "title", "description", "source_type", "source_id", "percentage", "taxable_amount", "tax_amount", "transaction_id", "line_item_breakouts", "tax_component_breakouts", "eu_vat", "type", "tax_exempt_amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceTax object to a map representation for JSON marshaling.
func (i InvoiceTax) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Uid != nil {
structMap["uid"] = i.Uid
}
@@ -97,12 +101,12 @@ func (i *InvoiceTax) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "title", "description", "source_type", "source_id", "percentage", "taxable_amount", "tax_amount", "transaction_id", "line_item_breakouts", "tax_component_breakouts", "eu_vat", "type", "tax_exempt_amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "title", "description", "source_type", "source_id", "percentage", "taxable_amount", "tax_amount", "transaction_id", "line_item_breakouts", "tax_component_breakouts", "eu_vat", "type", "tax_exempt_amount")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Uid = temp.Uid
i.Title = temp.Title
i.Description = temp.Description
diff --git a/models/invoice_tax_breakout.go b/models/invoice_tax_breakout.go
index 434b083a..7d891aa1 100644
--- a/models/invoice_tax_breakout.go
+++ b/models/invoice_tax_breakout.go
@@ -11,11 +11,11 @@ import (
// InvoiceTaxBreakout represents a InvoiceTaxBreakout struct.
type InvoiceTaxBreakout struct {
- Uid *string `json:"uid,omitempty"`
- TaxableAmount *string `json:"taxable_amount,omitempty"`
- TaxAmount *string `json:"tax_amount,omitempty"`
- TaxExemptAmount *string `json:"tax_exempt_amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Uid *string `json:"uid,omitempty"`
+ TaxableAmount *string `json:"taxable_amount,omitempty"`
+ TaxAmount *string `json:"tax_amount,omitempty"`
+ TaxExemptAmount *string `json:"tax_exempt_amount,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceTaxBreakout.
@@ -23,13 +23,17 @@ type InvoiceTaxBreakout struct {
func (i InvoiceTaxBreakout) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "uid", "taxable_amount", "tax_amount", "tax_exempt_amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceTaxBreakout object to a map representation for JSON marshaling.
func (i InvoiceTaxBreakout) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Uid != nil {
structMap["uid"] = i.Uid
}
@@ -53,12 +57,12 @@ func (i *InvoiceTaxBreakout) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "taxable_amount", "tax_amount", "tax_exempt_amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "taxable_amount", "tax_amount", "tax_exempt_amount")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Uid = temp.Uid
i.TaxableAmount = temp.TaxableAmount
i.TaxAmount = temp.TaxAmount
diff --git a/models/invoice_tax_component_breakout.go b/models/invoice_tax_component_breakout.go
index 6be6cc91..d9973a9c 100644
--- a/models/invoice_tax_component_breakout.go
+++ b/models/invoice_tax_component_breakout.go
@@ -11,21 +11,21 @@ import (
// InvoiceTaxComponentBreakout represents a InvoiceTaxComponentBreakout struct.
type InvoiceTaxComponentBreakout struct {
- TaxRuleId *int `json:"tax_rule_id,omitempty"`
- Percentage *string `json:"percentage,omitempty"`
- CountryCode *string `json:"country_code,omitempty"`
- SubdivisionCode *string `json:"subdivision_code,omitempty"`
- TaxAmount *string `json:"tax_amount,omitempty"`
- TaxableAmount *string `json:"taxable_amount,omitempty"`
- TaxExemptAmount *string `json:"tax_exempt_amount,omitempty"`
- NonTaxableAmount *string `json:"non_taxable_amount,omitempty"`
- TaxName *string `json:"tax_name,omitempty"`
- TaxType *string `json:"tax_type,omitempty"`
- RateType *string `json:"rate_type,omitempty"`
- TaxAuthorityType *int `json:"tax_authority_type,omitempty"`
- StateAssignedNo *string `json:"state_assigned_no,omitempty"`
- TaxSubType *string `json:"tax_sub_type,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ TaxRuleId *int `json:"tax_rule_id,omitempty"`
+ Percentage *string `json:"percentage,omitempty"`
+ CountryCode *string `json:"country_code,omitempty"`
+ SubdivisionCode *string `json:"subdivision_code,omitempty"`
+ TaxAmount *string `json:"tax_amount,omitempty"`
+ TaxableAmount *string `json:"taxable_amount,omitempty"`
+ TaxExemptAmount *string `json:"tax_exempt_amount,omitempty"`
+ NonTaxableAmount *string `json:"non_taxable_amount,omitempty"`
+ TaxName *string `json:"tax_name,omitempty"`
+ TaxType *string `json:"tax_type,omitempty"`
+ RateType *string `json:"rate_type,omitempty"`
+ TaxAuthorityType *int `json:"tax_authority_type,omitempty"`
+ StateAssignedNo *string `json:"state_assigned_no,omitempty"`
+ TaxSubType *string `json:"tax_sub_type,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for InvoiceTaxComponentBreakout.
@@ -33,13 +33,17 @@ type InvoiceTaxComponentBreakout struct {
func (i InvoiceTaxComponentBreakout) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "tax_rule_id", "percentage", "country_code", "subdivision_code", "tax_amount", "taxable_amount", "tax_exempt_amount", "non_taxable_amount", "tax_name", "tax_type", "rate_type", "tax_authority_type", "state_assigned_no", "tax_sub_type"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the InvoiceTaxComponentBreakout object to a map representation for JSON marshaling.
func (i InvoiceTaxComponentBreakout) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.TaxRuleId != nil {
structMap["tax_rule_id"] = i.TaxRuleId
}
@@ -93,12 +97,12 @@ func (i *InvoiceTaxComponentBreakout) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "tax_rule_id", "percentage", "country_code", "subdivision_code", "tax_amount", "taxable_amount", "tax_exempt_amount", "non_taxable_amount", "tax_name", "tax_type", "rate_type", "tax_authority_type", "state_assigned_no", "tax_sub_type")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "tax_rule_id", "percentage", "country_code", "subdivision_code", "tax_amount", "taxable_amount", "tax_exempt_amount", "non_taxable_amount", "tax_name", "tax_type", "rate_type", "tax_authority_type", "state_assigned_no", "tax_sub_type")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.TaxRuleId = temp.TaxRuleId
i.Percentage = temp.Percentage
i.CountryCode = temp.CountryCode
diff --git a/models/issue_advance_invoice_request.go b/models/issue_advance_invoice_request.go
index 2870ed4b..b55a4fac 100644
--- a/models/issue_advance_invoice_request.go
+++ b/models/issue_advance_invoice_request.go
@@ -11,8 +11,8 @@ import (
// IssueAdvanceInvoiceRequest represents a IssueAdvanceInvoiceRequest struct.
type IssueAdvanceInvoiceRequest struct {
- Force *bool `json:"force,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Force *bool `json:"force,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for IssueAdvanceInvoiceRequest.
@@ -20,13 +20,17 @@ type IssueAdvanceInvoiceRequest struct {
func (i IssueAdvanceInvoiceRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "force"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the IssueAdvanceInvoiceRequest object to a map representation for JSON marshaling.
func (i IssueAdvanceInvoiceRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Force != nil {
structMap["force"] = i.Force
}
@@ -41,12 +45,12 @@ func (i *IssueAdvanceInvoiceRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "force")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "force")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Force = temp.Force
return nil
}
diff --git a/models/issue_invoice_event.go b/models/issue_invoice_event.go
index 07ffb565..18e69d60 100644
--- a/models/issue_invoice_event.go
+++ b/models/issue_invoice_event.go
@@ -15,13 +15,13 @@ import (
// IssueInvoiceEvent represents a IssueInvoiceEvent struct.
type IssueInvoiceEvent struct {
- Id int64 `json:"id"`
- Timestamp time.Time `json:"timestamp"`
- Invoice Invoice `json:"invoice"`
- EventType InvoiceEventType `json:"event_type"`
+ Id int64 `json:"id"`
+ Timestamp time.Time `json:"timestamp"`
+ Invoice Invoice `json:"invoice"`
+ EventType InvoiceEventType `json:"event_type"`
// Example schema for an `issue_invoice` event
- EventData IssueInvoiceEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ EventData IssueInvoiceEventData `json:"event_data"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for IssueInvoiceEvent.
@@ -29,13 +29,17 @@ type IssueInvoiceEvent struct {
func (i IssueInvoiceEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the IssueInvoiceEvent object to a map representation for JSON marshaling.
func (i IssueInvoiceEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
structMap["id"] = i.Id
structMap["timestamp"] = i.Timestamp.Format(time.RFC3339)
structMap["invoice"] = i.Invoice.toMap()
@@ -56,12 +60,12 @@ func (i *IssueInvoiceEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/issue_invoice_event_data.go b/models/issue_invoice_event_data.go
index e1a8d5d3..d28883d6 100644
--- a/models/issue_invoice_event_data.go
+++ b/models/issue_invoice_event_data.go
@@ -29,7 +29,7 @@ type IssueInvoiceEventData struct {
DueAmount string `json:"due_amount"`
// The invoice total, which is `subtotal_amount - discount_amount + tax_amount`.'
TotalAmount string `json:"total_amount"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for IssueInvoiceEventData.
@@ -37,13 +37,17 @@ type IssueInvoiceEventData struct {
func (i IssueInvoiceEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "consolidation_level", "from_status", "to_status", "due_amount", "total_amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the IssueInvoiceEventData object to a map representation for JSON marshaling.
func (i IssueInvoiceEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
structMap["consolidation_level"] = i.ConsolidationLevel
structMap["from_status"] = i.FromStatus
structMap["to_status"] = i.ToStatus
@@ -64,12 +68,12 @@ func (i *IssueInvoiceEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "consolidation_level", "from_status", "to_status", "due_amount", "total_amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "consolidation_level", "from_status", "to_status", "due_amount", "total_amount")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.ConsolidationLevel = *temp.ConsolidationLevel
i.FromStatus = *temp.FromStatus
i.ToStatus = *temp.ToStatus
diff --git a/models/issue_invoice_request.go b/models/issue_invoice_request.go
index a9a2c6b6..a70c8a06 100644
--- a/models/issue_invoice_request.go
+++ b/models/issue_invoice_request.go
@@ -15,8 +15,8 @@ type IssueInvoiceRequest struct {
// - `leave_open_invoice` - prepayments and credits applied to invoice; invoice status set to "open"; email sent to the customer for the issued invoice (if setting applies); payment failure recorded in the invoice history. This is the default option.
// - `rollback_to_pending` - prepayments and credits not applied; invoice remains in "pending" status; no email sent to the customer; payment failure recorded in the invoice history.
// - `initiate_dunning` - prepayments and credits applied to the invoice; invoice status set to "open"; email sent to the customer for the issued invoice (if setting applies); payment failure recorded in the invoice history; subscription will most likely go into "past_due" or "canceled" state (depending upon net terms and dunning settings).
- OnFailedPayment *FailedPaymentAction `json:"on_failed_payment,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ OnFailedPayment *FailedPaymentAction `json:"on_failed_payment,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for IssueInvoiceRequest.
@@ -24,13 +24,17 @@ type IssueInvoiceRequest struct {
func (i IssueInvoiceRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "on_failed_payment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the IssueInvoiceRequest object to a map representation for JSON marshaling.
func (i IssueInvoiceRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.OnFailedPayment != nil {
structMap["on_failed_payment"] = i.OnFailedPayment
}
@@ -45,12 +49,12 @@ func (i *IssueInvoiceRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "on_failed_payment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "on_failed_payment")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.OnFailedPayment = temp.OnFailedPayment
return nil
}
diff --git a/models/issue_service_credit.go b/models/issue_service_credit.go
index 11e78a0b..bba76564 100644
--- a/models/issue_service_credit.go
+++ b/models/issue_service_credit.go
@@ -15,7 +15,7 @@ import (
type IssueServiceCredit struct {
Amount IssueServiceCreditAmount `json:"amount"`
Memo *string `json:"memo,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for IssueServiceCredit.
@@ -23,13 +23,17 @@ type IssueServiceCredit struct {
func (i IssueServiceCredit) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "amount", "memo"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the IssueServiceCredit object to a map representation for JSON marshaling.
func (i IssueServiceCredit) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
structMap["amount"] = i.Amount.toMap()
if i.Memo != nil {
structMap["memo"] = i.Memo
@@ -49,12 +53,12 @@ func (i *IssueServiceCredit) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "amount", "memo")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "amount", "memo")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Amount = *temp.Amount
i.Memo = temp.Memo
return nil
diff --git a/models/issue_service_credit_request.go b/models/issue_service_credit_request.go
index 0127d70e..1ac11e2b 100644
--- a/models/issue_service_credit_request.go
+++ b/models/issue_service_credit_request.go
@@ -13,8 +13,8 @@ import (
// IssueServiceCreditRequest represents a IssueServiceCreditRequest struct.
type IssueServiceCreditRequest struct {
- ServiceCredit IssueServiceCredit `json:"service_credit"`
- AdditionalProperties map[string]any `json:"_"`
+ ServiceCredit IssueServiceCredit `json:"service_credit"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for IssueServiceCreditRequest.
@@ -22,13 +22,17 @@ type IssueServiceCreditRequest struct {
func (i IssueServiceCreditRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "service_credit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the IssueServiceCreditRequest object to a map representation for JSON marshaling.
func (i IssueServiceCreditRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
structMap["service_credit"] = i.ServiceCredit.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (i *IssueServiceCreditRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "service_credit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "service_credit")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.ServiceCredit = *temp.ServiceCredit
return nil
}
diff --git a/models/item_price_point_changed.go b/models/item_price_point_changed.go
index 8cafb1cd..46d39f0f 100644
--- a/models/item_price_point_changed.go
+++ b/models/item_price_point_changed.go
@@ -13,13 +13,13 @@ import (
// ItemPricePointChanged represents a ItemPricePointChanged struct.
type ItemPricePointChanged struct {
- ItemId int `json:"item_id"`
- ItemType string `json:"item_type"`
- ItemHandle string `json:"item_handle"`
- ItemName string `json:"item_name"`
- PreviousPricePoint ItemPricePointData `json:"previous_price_point"`
- CurrentPricePoint ItemPricePointData `json:"current_price_point"`
- AdditionalProperties map[string]any `json:"_"`
+ ItemId int `json:"item_id"`
+ ItemType string `json:"item_type"`
+ ItemHandle string `json:"item_handle"`
+ ItemName string `json:"item_name"`
+ PreviousPricePoint ItemPricePointData `json:"previous_price_point"`
+ CurrentPricePoint ItemPricePointData `json:"current_price_point"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ItemPricePointChanged.
@@ -27,13 +27,17 @@ type ItemPricePointChanged struct {
func (i ItemPricePointChanged) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "item_id", "item_type", "item_handle", "item_name", "previous_price_point", "current_price_point"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the ItemPricePointChanged object to a map representation for JSON marshaling.
func (i ItemPricePointChanged) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
structMap["item_id"] = i.ItemId
structMap["item_type"] = i.ItemType
structMap["item_handle"] = i.ItemHandle
@@ -55,12 +59,12 @@ func (i *ItemPricePointChanged) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "item_id", "item_type", "item_handle", "item_name", "previous_price_point", "current_price_point")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "item_id", "item_type", "item_handle", "item_name", "previous_price_point", "current_price_point")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.ItemId = *temp.ItemId
i.ItemType = *temp.ItemType
i.ItemHandle = *temp.ItemHandle
diff --git a/models/item_price_point_data.go b/models/item_price_point_data.go
index bdbb1568..36c0e86e 100644
--- a/models/item_price_point_data.go
+++ b/models/item_price_point_data.go
@@ -11,10 +11,10 @@ import (
// ItemPricePointData represents a ItemPricePointData struct.
type ItemPricePointData struct {
- Id *int `json:"id,omitempty"`
- Handle *string `json:"handle,omitempty"`
- Name *string `json:"name,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ Handle *string `json:"handle,omitempty"`
+ Name *string `json:"name,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ItemPricePointData.
@@ -22,13 +22,17 @@ type ItemPricePointData struct {
func (i ItemPricePointData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(i.AdditionalProperties,
+ "id", "handle", "name"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(i.toMap())
}
// toMap converts the ItemPricePointData object to a map representation for JSON marshaling.
func (i ItemPricePointData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, i.AdditionalProperties)
+ MergeAdditionalProperties(structMap, i.AdditionalProperties)
if i.Id != nil {
structMap["id"] = i.Id
}
@@ -49,12 +53,12 @@ func (i *ItemPricePointData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "handle", "name")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "handle", "name")
if err != nil {
return err
}
-
i.AdditionalProperties = additionalProperties
+
i.Id = temp.Id
i.Handle = temp.Handle
i.Name = temp.Name
diff --git a/models/list_components_filter.go b/models/list_components_filter.go
index 1e9bdadd..6620334a 100644
--- a/models/list_components_filter.go
+++ b/models/list_components_filter.go
@@ -12,10 +12,10 @@ import (
// ListComponentsFilter represents a ListComponentsFilter struct.
type ListComponentsFilter struct {
// Allows fetching components with matching id based on provided value. Use in query `filter[ids]=1,2,3`.
- Ids []int `json:"ids,omitempty"`
+ Ids []int `json:"ids,omitempty"`
// Allows fetching components with matching use_site_exchange_rate based on provided value (refers to default price point). Use in query `filter[use_site_exchange_rate]=true`.
- UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListComponentsFilter.
@@ -23,13 +23,17 @@ type ListComponentsFilter struct {
func (l ListComponentsFilter) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "ids", "use_site_exchange_rate"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListComponentsFilter object to a map representation for JSON marshaling.
func (l ListComponentsFilter) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.Ids != nil {
structMap["ids"] = l.Ids
}
@@ -47,12 +51,12 @@ func (l *ListComponentsFilter) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "ids", "use_site_exchange_rate")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "ids", "use_site_exchange_rate")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Ids = temp.Ids
l.UseSiteExchangeRate = temp.UseSiteExchangeRate
return nil
diff --git a/models/list_components_price_points_response.go b/models/list_components_price_points_response.go
index 6bf14a98..f75dc0a1 100644
--- a/models/list_components_price_points_response.go
+++ b/models/list_components_price_points_response.go
@@ -13,8 +13,8 @@ import (
// ListComponentsPricePointsResponse represents a ListComponentsPricePointsResponse struct.
type ListComponentsPricePointsResponse struct {
- PricePoints []ComponentPricePoint `json:"price_points"`
- AdditionalProperties map[string]any `json:"_"`
+ PricePoints []ComponentPricePoint `json:"price_points"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListComponentsPricePointsResponse.
@@ -22,13 +22,17 @@ type ListComponentsPricePointsResponse struct {
func (l ListComponentsPricePointsResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "price_points"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListComponentsPricePointsResponse object to a map representation for JSON marshaling.
func (l ListComponentsPricePointsResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
structMap["price_points"] = l.PricePoints
return structMap
}
@@ -45,12 +49,12 @@ func (l *ListComponentsPricePointsResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_points")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_points")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.PricePoints = *temp.PricePoints
return nil
}
diff --git a/models/list_coupons_filter.go b/models/list_coupons_filter.go
index 61bea3b0..e27b9e80 100644
--- a/models/list_coupons_filter.go
+++ b/models/list_coupons_filter.go
@@ -14,22 +14,22 @@ import (
// ListCouponsFilter represents a ListCouponsFilter struct.
type ListCouponsFilter struct {
// The type of filter you would like to apply to your search. Use in query `filter[date_field]=created_at`.
- DateField *BasicDateField `json:"date_field,omitempty"`
+ DateField *BasicDateField `json:"date_field,omitempty"`
// The start date (format YYYY-MM-DD) with which to filter the date_field. Returns coupons with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. Use in query `filter[start_date]=2011-12-17`.
- StartDate *time.Time `json:"start_date,omitempty"`
+ StartDate *time.Time `json:"start_date,omitempty"`
// The end date (format YYYY-MM-DD) with which to filter the date_field. Returns coupons with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. Use in query `filter[end_date]=2011-12-15`.
- EndDate *time.Time `json:"end_date,omitempty"`
+ EndDate *time.Time `json:"end_date,omitempty"`
// The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns coupons with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date. Use in query `filter[start_datetime]=2011-12-19T10:15:30+01:00`.
- StartDatetime *time.Time `json:"start_datetime,omitempty"`
+ StartDatetime *time.Time `json:"start_datetime,omitempty"`
// The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns coupons with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date. Use in query `filter[end_datetime]=2011-12-1T10:15:30+01:00`.
- EndDatetime *time.Time `json:"end_datetime,omitempty"`
+ EndDatetime *time.Time `json:"end_datetime,omitempty"`
// Allows fetching coupons with matching id based on provided values. Use in query `filter[ids]=1,2,3`.
- Ids []int `json:"ids,omitempty"`
+ Ids []int `json:"ids,omitempty"`
// Allows fetching coupons with matching codes based on provided values. Use in query `filter[codes]=free,free_trial`.
- Codes []string `json:"codes,omitempty"`
+ Codes []string `json:"codes,omitempty"`
// Allows fetching coupons with matching use_site_exchange_rate based on provided value. Use in query `filter[use_site_exchange_rate]=true`.
- UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListCouponsFilter.
@@ -37,13 +37,17 @@ type ListCouponsFilter struct {
func (l ListCouponsFilter) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "date_field", "start_date", "end_date", "start_datetime", "end_datetime", "ids", "codes", "use_site_exchange_rate"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListCouponsFilter object to a map representation for JSON marshaling.
func (l ListCouponsFilter) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.DateField != nil {
structMap["date_field"] = l.DateField
}
@@ -79,12 +83,12 @@ func (l *ListCouponsFilter) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "date_field", "start_date", "end_date", "start_datetime", "end_datetime", "ids", "codes", "use_site_exchange_rate")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "date_field", "start_date", "end_date", "start_datetime", "end_datetime", "ids", "codes", "use_site_exchange_rate")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.DateField = temp.DateField
if temp.StartDate != nil {
StartDateVal, err := time.Parse(DEFAULT_DATE, *temp.StartDate)
diff --git a/models/list_credit_notes_response.go b/models/list_credit_notes_response.go
index 746b443a..8213391c 100644
--- a/models/list_credit_notes_response.go
+++ b/models/list_credit_notes_response.go
@@ -13,8 +13,8 @@ import (
// ListCreditNotesResponse represents a ListCreditNotesResponse struct.
type ListCreditNotesResponse struct {
- CreditNotes []CreditNote `json:"credit_notes"`
- AdditionalProperties map[string]any `json:"_"`
+ CreditNotes []CreditNote `json:"credit_notes"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListCreditNotesResponse.
@@ -22,13 +22,17 @@ type ListCreditNotesResponse struct {
func (l ListCreditNotesResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "credit_notes"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListCreditNotesResponse object to a map representation for JSON marshaling.
func (l ListCreditNotesResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
structMap["credit_notes"] = l.CreditNotes
return structMap
}
@@ -45,12 +49,12 @@ func (l *ListCreditNotesResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "credit_notes")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "credit_notes")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.CreditNotes = *temp.CreditNotes
return nil
}
diff --git a/models/list_invoice_events_response.go b/models/list_invoice_events_response.go
index 4150983a..2a0a0951 100644
--- a/models/list_invoice_events_response.go
+++ b/models/list_invoice_events_response.go
@@ -11,11 +11,11 @@ import (
// ListInvoiceEventsResponse represents a ListInvoiceEventsResponse struct.
type ListInvoiceEventsResponse struct {
- Events []InvoiceEvent `json:"events,omitempty"`
- Page *int `json:"page,omitempty"`
- PerPage *int `json:"per_page,omitempty"`
- TotalPages *int `json:"total_pages,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Events []InvoiceEvent `json:"events,omitempty"`
+ Page *int `json:"page,omitempty"`
+ PerPage *int `json:"per_page,omitempty"`
+ TotalPages *int `json:"total_pages,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListInvoiceEventsResponse.
@@ -23,13 +23,17 @@ type ListInvoiceEventsResponse struct {
func (l ListInvoiceEventsResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "events", "page", "per_page", "total_pages"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListInvoiceEventsResponse object to a map representation for JSON marshaling.
func (l ListInvoiceEventsResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.Events != nil {
structMap["events"] = l.Events
}
@@ -53,12 +57,12 @@ func (l *ListInvoiceEventsResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "events", "page", "per_page", "total_pages")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "events", "page", "per_page", "total_pages")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Events = temp.Events
l.Page = temp.Page
l.PerPage = temp.PerPage
diff --git a/models/list_invoices_response.go b/models/list_invoices_response.go
index 9007738c..eee66438 100644
--- a/models/list_invoices_response.go
+++ b/models/list_invoices_response.go
@@ -13,8 +13,8 @@ import (
// ListInvoicesResponse represents a ListInvoicesResponse struct.
type ListInvoicesResponse struct {
- Invoices []Invoice `json:"invoices"`
- AdditionalProperties map[string]any `json:"_"`
+ Invoices []Invoice `json:"invoices"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListInvoicesResponse.
@@ -22,13 +22,17 @@ type ListInvoicesResponse struct {
func (l ListInvoicesResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "invoices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListInvoicesResponse object to a map representation for JSON marshaling.
func (l ListInvoicesResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
structMap["invoices"] = l.Invoices
return structMap
}
@@ -45,12 +49,12 @@ func (l *ListInvoicesResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "invoices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "invoices")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Invoices = *temp.Invoices
return nil
}
diff --git a/models/list_metafields_response.go b/models/list_metafields_response.go
index 97ce4c6b..5c81d4a7 100644
--- a/models/list_metafields_response.go
+++ b/models/list_metafields_response.go
@@ -11,12 +11,12 @@ import (
// ListMetafieldsResponse represents a ListMetafieldsResponse struct.
type ListMetafieldsResponse struct {
- TotalCount *int `json:"total_count,omitempty"`
- CurrentPage *int `json:"current_page,omitempty"`
- TotalPages *int `json:"total_pages,omitempty"`
- PerPage *int `json:"per_page,omitempty"`
- Metafields []Metafield `json:"metafields,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ TotalCount *int `json:"total_count,omitempty"`
+ CurrentPage *int `json:"current_page,omitempty"`
+ TotalPages *int `json:"total_pages,omitempty"`
+ PerPage *int `json:"per_page,omitempty"`
+ Metafields []Metafield `json:"metafields,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListMetafieldsResponse.
@@ -24,13 +24,17 @@ type ListMetafieldsResponse struct {
func (l ListMetafieldsResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "total_count", "current_page", "total_pages", "per_page", "metafields"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListMetafieldsResponse object to a map representation for JSON marshaling.
func (l ListMetafieldsResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.TotalCount != nil {
structMap["total_count"] = l.TotalCount
}
@@ -57,12 +61,12 @@ func (l *ListMetafieldsResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "total_count", "current_page", "total_pages", "per_page", "metafields")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "total_count", "current_page", "total_pages", "per_page", "metafields")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.TotalCount = temp.TotalCount
l.CurrentPage = temp.CurrentPage
l.TotalPages = temp.TotalPages
diff --git a/models/list_mrr_filter.go b/models/list_mrr_filter.go
index 67f5033c..8f72252f 100644
--- a/models/list_mrr_filter.go
+++ b/models/list_mrr_filter.go
@@ -12,8 +12,8 @@ import (
// ListMrrFilter represents a ListMrrFilter struct.
type ListMrrFilter struct {
// Submit ids in order to limit results. Use in query: `filter[subscription_ids]=1,2,3`.
- SubscriptionIds []int `json:"subscription_ids,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ SubscriptionIds []int `json:"subscription_ids,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListMrrFilter.
@@ -21,13 +21,17 @@ type ListMrrFilter struct {
func (l ListMrrFilter) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "subscription_ids"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListMrrFilter object to a map representation for JSON marshaling.
func (l ListMrrFilter) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.SubscriptionIds != nil {
structMap["subscription_ids"] = l.SubscriptionIds
}
@@ -42,12 +46,12 @@ func (l *ListMrrFilter) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_ids")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_ids")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.SubscriptionIds = temp.SubscriptionIds
return nil
}
diff --git a/models/list_mrr_response.go b/models/list_mrr_response.go
index cdd89172..95351746 100644
--- a/models/list_mrr_response.go
+++ b/models/list_mrr_response.go
@@ -13,8 +13,8 @@ import (
// ListMRRResponse represents a ListMRRResponse struct.
type ListMRRResponse struct {
- Mrr ListMRRResponseResult `json:"mrr"`
- AdditionalProperties map[string]any `json:"_"`
+ Mrr ListMRRResponseResult `json:"mrr"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListMRRResponse.
@@ -22,13 +22,17 @@ type ListMRRResponse struct {
func (l ListMRRResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "mrr"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListMRRResponse object to a map representation for JSON marshaling.
func (l ListMRRResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
structMap["mrr"] = l.Mrr.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (l *ListMRRResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "mrr")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "mrr")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Mrr = *temp.Mrr
return nil
}
diff --git a/models/list_mrr_response_result.go b/models/list_mrr_response_result.go
index 32ce2731..65b9b69b 100644
--- a/models/list_mrr_response_result.go
+++ b/models/list_mrr_response_result.go
@@ -11,14 +11,14 @@ import (
// ListMRRResponseResult represents a ListMRRResponseResult struct.
type ListMRRResponseResult struct {
- Page *int `json:"page,omitempty"`
- PerPage *int `json:"per_page,omitempty"`
- TotalPages *int `json:"total_pages,omitempty"`
- TotalEntries *int `json:"total_entries,omitempty"`
- Currency *string `json:"currency,omitempty"`
- CurrencySymbol *string `json:"currency_symbol,omitempty"`
- Movements []Movement `json:"movements,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Page *int `json:"page,omitempty"`
+ PerPage *int `json:"per_page,omitempty"`
+ TotalPages *int `json:"total_pages,omitempty"`
+ TotalEntries *int `json:"total_entries,omitempty"`
+ Currency *string `json:"currency,omitempty"`
+ CurrencySymbol *string `json:"currency_symbol,omitempty"`
+ Movements []Movement `json:"movements,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListMRRResponseResult.
@@ -26,13 +26,17 @@ type ListMRRResponseResult struct {
func (l ListMRRResponseResult) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "page", "per_page", "total_pages", "total_entries", "currency", "currency_symbol", "movements"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListMRRResponseResult object to a map representation for JSON marshaling.
func (l ListMRRResponseResult) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.Page != nil {
structMap["page"] = l.Page
}
@@ -65,12 +69,12 @@ func (l *ListMRRResponseResult) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "page", "per_page", "total_pages", "total_entries", "currency", "currency_symbol", "movements")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "page", "per_page", "total_pages", "total_entries", "currency", "currency_symbol", "movements")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Page = temp.Page
l.PerPage = temp.PerPage
l.TotalPages = temp.TotalPages
diff --git a/models/list_offers_response.go b/models/list_offers_response.go
index a7710cd7..4ef75bd5 100644
--- a/models/list_offers_response.go
+++ b/models/list_offers_response.go
@@ -11,8 +11,8 @@ import (
// ListOffersResponse represents a ListOffersResponse struct.
type ListOffersResponse struct {
- Offers []Offer `json:"offers,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Offers []Offer `json:"offers,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListOffersResponse.
@@ -20,13 +20,17 @@ type ListOffersResponse struct {
func (l ListOffersResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "offers"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListOffersResponse object to a map representation for JSON marshaling.
func (l ListOffersResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.Offers != nil {
structMap["offers"] = l.Offers
}
@@ -41,12 +45,12 @@ func (l *ListOffersResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "offers")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "offers")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Offers = temp.Offers
return nil
}
diff --git a/models/list_prepayments_filter.go b/models/list_prepayments_filter.go
index c178bfaa..14ee3ef4 100644
--- a/models/list_prepayments_filter.go
+++ b/models/list_prepayments_filter.go
@@ -19,7 +19,7 @@ type ListPrepaymentsFilter struct {
StartDate *time.Time `json:"start_date,omitempty"`
// The end date (format YYYY-MM-DD) with which to filter the date_field. Returns prepayments with a timestamp up to and including 11:59:59PM in your site's time zone on the date specified. Use in query: `filter[end_date]=2011-12-15`.
EndDate *time.Time `json:"end_date,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListPrepaymentsFilter.
@@ -27,13 +27,17 @@ type ListPrepaymentsFilter struct {
func (l ListPrepaymentsFilter) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "date_field", "start_date", "end_date"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListPrepaymentsFilter object to a map representation for JSON marshaling.
func (l ListPrepaymentsFilter) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.DateField != nil {
structMap["date_field"] = l.DateField
}
@@ -54,12 +58,12 @@ func (l *ListPrepaymentsFilter) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "date_field", "start_date", "end_date")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "date_field", "start_date", "end_date")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.DateField = temp.DateField
if temp.StartDate != nil {
StartDateVal, err := time.Parse(DEFAULT_DATE, *temp.StartDate)
diff --git a/models/list_price_points_filter.go b/models/list_price_points_filter.go
index 6c7f778e..4b6a4d01 100644
--- a/models/list_price_points_filter.go
+++ b/models/list_price_points_filter.go
@@ -14,22 +14,22 @@ import (
// ListPricePointsFilter represents a ListPricePointsFilter struct.
type ListPricePointsFilter struct {
// The type of filter you would like to apply to your search. Use in query: `filter[date_field]=created_at`.
- DateField *BasicDateField `json:"date_field,omitempty"`
+ DateField *BasicDateField `json:"date_field,omitempty"`
// The start date (format YYYY-MM-DD) with which to filter the date_field. Returns price points with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified.
- StartDate *time.Time `json:"start_date,omitempty"`
+ StartDate *time.Time `json:"start_date,omitempty"`
// The end date (format YYYY-MM-DD) with which to filter the date_field. Returns price points with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified.
- EndDate *time.Time `json:"end_date,omitempty"`
+ EndDate *time.Time `json:"end_date,omitempty"`
// The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns price points with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date.
- StartDatetime *time.Time `json:"start_datetime,omitempty"`
+ StartDatetime *time.Time `json:"start_datetime,omitempty"`
// The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns price points with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date.
- EndDatetime *time.Time `json:"end_datetime,omitempty"`
+ EndDatetime *time.Time `json:"end_datetime,omitempty"`
// Allows fetching price points with matching type. Use in query: `filter[type]=custom,catalog`.
- Type []PricePointType `json:"type,omitempty"`
+ Type []PricePointType `json:"type,omitempty"`
// Allows fetching price points with matching id based on provided values. Use in query: `filter[ids]=1,2,3`.
- Ids []int `json:"ids,omitempty"`
+ Ids []int `json:"ids,omitempty"`
// Allows fetching price points only if archived_at is present or not. Use in query: `filter[archived_at]=not_null`.
- ArchivedAt *IncludeNullOrNotNull `json:"archived_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ArchivedAt *IncludeNullOrNotNull `json:"archived_at,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListPricePointsFilter.
@@ -37,13 +37,17 @@ type ListPricePointsFilter struct {
func (l ListPricePointsFilter) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "date_field", "start_date", "end_date", "start_datetime", "end_datetime", "type", "ids", "archived_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListPricePointsFilter object to a map representation for JSON marshaling.
func (l ListPricePointsFilter) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.DateField != nil {
structMap["date_field"] = l.DateField
}
@@ -79,12 +83,12 @@ func (l *ListPricePointsFilter) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "date_field", "start_date", "end_date", "start_datetime", "end_datetime", "type", "ids", "archived_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "date_field", "start_date", "end_date", "start_datetime", "end_datetime", "type", "ids", "archived_at")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.DateField = temp.DateField
if temp.StartDate != nil {
StartDateVal, err := time.Parse(DEFAULT_DATE, *temp.StartDate)
diff --git a/models/list_product_price_points_response.go b/models/list_product_price_points_response.go
index 7038723e..218c53f9 100644
--- a/models/list_product_price_points_response.go
+++ b/models/list_product_price_points_response.go
@@ -13,8 +13,8 @@ import (
// ListProductPricePointsResponse represents a ListProductPricePointsResponse struct.
type ListProductPricePointsResponse struct {
- PricePoints []ProductPricePoint `json:"price_points"`
- AdditionalProperties map[string]any `json:"_"`
+ PricePoints []ProductPricePoint `json:"price_points"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListProductPricePointsResponse.
@@ -22,13 +22,17 @@ type ListProductPricePointsResponse struct {
func (l ListProductPricePointsResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "price_points"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListProductPricePointsResponse object to a map representation for JSON marshaling.
func (l ListProductPricePointsResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
structMap["price_points"] = l.PricePoints
return structMap
}
@@ -45,12 +49,12 @@ func (l *ListProductPricePointsResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_points")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_points")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.PricePoints = *temp.PricePoints
return nil
}
diff --git a/models/list_products_filter.go b/models/list_products_filter.go
index e46cfab1..6cb7cd05 100644
--- a/models/list_products_filter.go
+++ b/models/list_products_filter.go
@@ -17,7 +17,7 @@ type ListProductsFilter struct {
PrepaidProductPricePoint *PrepaidProductPricePointFilter `json:"prepaid_product_price_point,omitempty"`
// Allows fetching products with matching use_site_exchange_rate based on provided value (refers to default price point). Use in query `filter[use_site_exchange_rate]=true`.
UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListProductsFilter.
@@ -25,13 +25,17 @@ type ListProductsFilter struct {
func (l ListProductsFilter) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "ids", "prepaid_product_price_point", "use_site_exchange_rate"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListProductsFilter object to a map representation for JSON marshaling.
func (l ListProductsFilter) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.Ids != nil {
structMap["ids"] = l.Ids
}
@@ -52,12 +56,12 @@ func (l *ListProductsFilter) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "ids", "prepaid_product_price_point", "use_site_exchange_rate")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "ids", "prepaid_product_price_point", "use_site_exchange_rate")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Ids = temp.Ids
l.PrepaidProductPricePoint = temp.PrepaidProductPricePoint
l.UseSiteExchangeRate = temp.UseSiteExchangeRate
diff --git a/models/list_proforma_invoices_meta.go b/models/list_proforma_invoices_meta.go
index 2e72e65a..ad69b249 100644
--- a/models/list_proforma_invoices_meta.go
+++ b/models/list_proforma_invoices_meta.go
@@ -11,11 +11,11 @@ import (
// ListProformaInvoicesMeta represents a ListProformaInvoicesMeta struct.
type ListProformaInvoicesMeta struct {
- TotalCount *int `json:"total_count,omitempty"`
- CurrentPage *int `json:"current_page,omitempty"`
- TotalPages *int `json:"total_pages,omitempty"`
- StatusCode *int `json:"status_code,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ TotalCount *int `json:"total_count,omitempty"`
+ CurrentPage *int `json:"current_page,omitempty"`
+ TotalPages *int `json:"total_pages,omitempty"`
+ StatusCode *int `json:"status_code,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListProformaInvoicesMeta.
@@ -23,13 +23,17 @@ type ListProformaInvoicesMeta struct {
func (l ListProformaInvoicesMeta) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "total_count", "current_page", "total_pages", "status_code"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListProformaInvoicesMeta object to a map representation for JSON marshaling.
func (l ListProformaInvoicesMeta) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.TotalCount != nil {
structMap["total_count"] = l.TotalCount
}
@@ -53,12 +57,12 @@ func (l *ListProformaInvoicesMeta) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "total_count", "current_page", "total_pages", "status_code")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "total_count", "current_page", "total_pages", "status_code")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.TotalCount = temp.TotalCount
l.CurrentPage = temp.CurrentPage
l.TotalPages = temp.TotalPages
diff --git a/models/list_proforma_invoices_response.go b/models/list_proforma_invoices_response.go
index 58079d1f..ec98e84f 100644
--- a/models/list_proforma_invoices_response.go
+++ b/models/list_proforma_invoices_response.go
@@ -13,7 +13,7 @@ import (
type ListProformaInvoicesResponse struct {
ProformaInvoices []ProformaInvoice `json:"proforma_invoices,omitempty"`
Meta *ListProformaInvoicesMeta `json:"meta,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListProformaInvoicesResponse.
@@ -21,13 +21,17 @@ type ListProformaInvoicesResponse struct {
func (l ListProformaInvoicesResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "proforma_invoices", "meta"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListProformaInvoicesResponse object to a map representation for JSON marshaling.
func (l ListProformaInvoicesResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.ProformaInvoices != nil {
structMap["proforma_invoices"] = l.ProformaInvoices
}
@@ -45,12 +49,12 @@ func (l *ListProformaInvoicesResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "proforma_invoices", "meta")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "proforma_invoices", "meta")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.ProformaInvoices = temp.ProformaInvoices
l.Meta = temp.Meta
return nil
diff --git a/models/list_public_keys_meta.go b/models/list_public_keys_meta.go
index ecdfc90e..c4fcdb8f 100644
--- a/models/list_public_keys_meta.go
+++ b/models/list_public_keys_meta.go
@@ -11,11 +11,11 @@ import (
// ListPublicKeysMeta represents a ListPublicKeysMeta struct.
type ListPublicKeysMeta struct {
- TotalCount *int `json:"total_count,omitempty"`
- CurrentPage *int `json:"current_page,omitempty"`
- TotalPages *int `json:"total_pages,omitempty"`
- PerPage *int `json:"per_page,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ TotalCount *int `json:"total_count,omitempty"`
+ CurrentPage *int `json:"current_page,omitempty"`
+ TotalPages *int `json:"total_pages,omitempty"`
+ PerPage *int `json:"per_page,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListPublicKeysMeta.
@@ -23,13 +23,17 @@ type ListPublicKeysMeta struct {
func (l ListPublicKeysMeta) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "total_count", "current_page", "total_pages", "per_page"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListPublicKeysMeta object to a map representation for JSON marshaling.
func (l ListPublicKeysMeta) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.TotalCount != nil {
structMap["total_count"] = l.TotalCount
}
@@ -53,12 +57,12 @@ func (l *ListPublicKeysMeta) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "total_count", "current_page", "total_pages", "per_page")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "total_count", "current_page", "total_pages", "per_page")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.TotalCount = temp.TotalCount
l.CurrentPage = temp.CurrentPage
l.TotalPages = temp.TotalPages
diff --git a/models/list_public_keys_response.go b/models/list_public_keys_response.go
index aaba6b5d..61220392 100644
--- a/models/list_public_keys_response.go
+++ b/models/list_public_keys_response.go
@@ -11,9 +11,9 @@ import (
// ListPublicKeysResponse represents a ListPublicKeysResponse struct.
type ListPublicKeysResponse struct {
- ChargifyJsKeys []PublicKey `json:"chargify_js_keys,omitempty"`
- Meta *ListPublicKeysMeta `json:"meta,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ChargifyJsKeys []PublicKey `json:"chargify_js_keys,omitempty"`
+ Meta *ListPublicKeysMeta `json:"meta,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListPublicKeysResponse.
@@ -21,13 +21,17 @@ type ListPublicKeysResponse struct {
func (l ListPublicKeysResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "chargify_js_keys", "meta"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListPublicKeysResponse object to a map representation for JSON marshaling.
func (l ListPublicKeysResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.ChargifyJsKeys != nil {
structMap["chargify_js_keys"] = l.ChargifyJsKeys
}
@@ -45,12 +49,12 @@ func (l *ListPublicKeysResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "chargify_js_keys", "meta")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "chargify_js_keys", "meta")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.ChargifyJsKeys = temp.ChargifyJsKeys
l.Meta = temp.Meta
return nil
diff --git a/models/list_sale_rep_item.go b/models/list_sale_rep_item.go
index 109f09cc..59898e45 100644
--- a/models/list_sale_rep_item.go
+++ b/models/list_sale_rep_item.go
@@ -16,7 +16,7 @@ type ListSaleRepItem struct {
SubscriptionsCount *int `json:"subscriptions_count,omitempty"`
MrrData map[string]SaleRepItemMrr `json:"mrr_data,omitempty"`
TestMode *bool `json:"test_mode,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSaleRepItem.
@@ -24,13 +24,17 @@ type ListSaleRepItem struct {
func (l ListSaleRepItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "id", "full_name", "subscriptions_count", "mrr_data", "test_mode"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSaleRepItem object to a map representation for JSON marshaling.
func (l ListSaleRepItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.Id != nil {
structMap["id"] = l.Id
}
@@ -57,12 +61,12 @@ func (l *ListSaleRepItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "full_name", "subscriptions_count", "mrr_data", "test_mode")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "full_name", "subscriptions_count", "mrr_data", "test_mode")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Id = temp.Id
l.FullName = temp.FullName
l.SubscriptionsCount = temp.SubscriptionsCount
diff --git a/models/list_segments_filter.go b/models/list_segments_filter.go
index 6f8cd270..8b07e2da 100644
--- a/models/list_segments_filter.go
+++ b/models/list_segments_filter.go
@@ -12,14 +12,14 @@ import (
// ListSegmentsFilter represents a ListSegmentsFilter struct.
type ListSegmentsFilter struct {
// The value passed here would be used to filter segments. Pass a value related to `segment_property_1` on attached Metric. If empty string is passed, this filter would be rejected. Use in query `filter[segment_property_1_value]=EU`.
- SegmentProperty1Value *string `json:"segment_property_1_value,omitempty"`
+ SegmentProperty1Value *string `json:"segment_property_1_value,omitempty"`
// The value passed here would be used to filter segments. Pass a value related to `segment_property_2` on attached Metric. If empty string is passed, this filter would be rejected.
- SegmentProperty2Value *string `json:"segment_property_2_value,omitempty"`
+ SegmentProperty2Value *string `json:"segment_property_2_value,omitempty"`
// The value passed here would be used to filter segments. Pass a value related to `segment_property_3` on attached Metric. If empty string is passed, this filter would be rejected.
- SegmentProperty3Value *string `json:"segment_property_3_value,omitempty"`
+ SegmentProperty3Value *string `json:"segment_property_3_value,omitempty"`
// The value passed here would be used to filter segments. Pass a value related to `segment_property_4` on attached Metric. If empty string is passed, this filter would be rejected.
- SegmentProperty4Value *string `json:"segment_property_4_value,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ SegmentProperty4Value *string `json:"segment_property_4_value,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSegmentsFilter.
@@ -27,13 +27,17 @@ type ListSegmentsFilter struct {
func (l ListSegmentsFilter) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "segment_property_1_value", "segment_property_2_value", "segment_property_3_value", "segment_property_4_value"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSegmentsFilter object to a map representation for JSON marshaling.
func (l ListSegmentsFilter) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.SegmentProperty1Value != nil {
structMap["segment_property_1_value"] = l.SegmentProperty1Value
}
@@ -57,12 +61,12 @@ func (l *ListSegmentsFilter) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "segment_property_1_value", "segment_property_2_value", "segment_property_3_value", "segment_property_4_value")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "segment_property_1_value", "segment_property_2_value", "segment_property_3_value", "segment_property_4_value")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.SegmentProperty1Value = temp.SegmentProperty1Value
l.SegmentProperty2Value = temp.SegmentProperty2Value
l.SegmentProperty3Value = temp.SegmentProperty3Value
diff --git a/models/list_segments_response.go b/models/list_segments_response.go
index 0134a61b..20bb3077 100644
--- a/models/list_segments_response.go
+++ b/models/list_segments_response.go
@@ -11,8 +11,8 @@ import (
// ListSegmentsResponse represents a ListSegmentsResponse struct.
type ListSegmentsResponse struct {
- Segments []Segment `json:"segments,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Segments []Segment `json:"segments,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSegmentsResponse.
@@ -20,13 +20,17 @@ type ListSegmentsResponse struct {
func (l ListSegmentsResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "segments"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSegmentsResponse object to a map representation for JSON marshaling.
func (l ListSegmentsResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.Segments != nil {
structMap["segments"] = l.Segments
}
@@ -41,12 +45,12 @@ func (l *ListSegmentsResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "segments")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "segments")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Segments = temp.Segments
return nil
}
diff --git a/models/list_subcription_group_prepayment_item.go b/models/list_subcription_group_prepayment_item.go
index f467c389..5973bc5a 100644
--- a/models/list_subcription_group_prepayment_item.go
+++ b/models/list_subcription_group_prepayment_item.go
@@ -13,16 +13,16 @@ import (
// ListSubcriptionGroupPrepaymentItem represents a ListSubcriptionGroupPrepaymentItem struct.
type ListSubcriptionGroupPrepaymentItem struct {
- Id *int `json:"id,omitempty"`
- SubscriptionGroupUid *string `json:"subscription_group_uid,omitempty"`
- AmountInCents *int64 `json:"amount_in_cents,omitempty"`
- RemainingAmountInCents *int64 `json:"remaining_amount_in_cents,omitempty"`
- Details *string `json:"details,omitempty"`
- External *bool `json:"external,omitempty"`
- Memo *string `json:"memo,omitempty"`
- PaymentType *PrepaymentMethod `json:"payment_type,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ SubscriptionGroupUid *string `json:"subscription_group_uid,omitempty"`
+ AmountInCents *int64 `json:"amount_in_cents,omitempty"`
+ RemainingAmountInCents *int64 `json:"remaining_amount_in_cents,omitempty"`
+ Details *string `json:"details,omitempty"`
+ External *bool `json:"external,omitempty"`
+ Memo *string `json:"memo,omitempty"`
+ PaymentType *PrepaymentMethod `json:"payment_type,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSubcriptionGroupPrepaymentItem.
@@ -30,13 +30,17 @@ type ListSubcriptionGroupPrepaymentItem struct {
func (l ListSubcriptionGroupPrepaymentItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "id", "subscription_group_uid", "amount_in_cents", "remaining_amount_in_cents", "details", "external", "memo", "payment_type", "created_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSubcriptionGroupPrepaymentItem object to a map representation for JSON marshaling.
func (l ListSubcriptionGroupPrepaymentItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.Id != nil {
structMap["id"] = l.Id
}
@@ -75,12 +79,12 @@ func (l *ListSubcriptionGroupPrepaymentItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "subscription_group_uid", "amount_in_cents", "remaining_amount_in_cents", "details", "external", "memo", "payment_type", "created_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "subscription_group_uid", "amount_in_cents", "remaining_amount_in_cents", "details", "external", "memo", "payment_type", "created_at")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Id = temp.Id
l.SubscriptionGroupUid = temp.SubscriptionGroupUid
l.AmountInCents = temp.AmountInCents
diff --git a/models/list_subscription_components_filter.go b/models/list_subscription_components_filter.go
index 216aca77..83e38922 100644
--- a/models/list_subscription_components_filter.go
+++ b/models/list_subscription_components_filter.go
@@ -12,10 +12,10 @@ import (
// ListSubscriptionComponentsFilter represents a ListSubscriptionComponentsFilter struct.
type ListSubscriptionComponentsFilter struct {
// Allows fetching components allocation with matching currency based on provided values. Use in query `filter[currencies]=EUR,USD`.
- Currencies []string `json:"currencies,omitempty"`
+ Currencies []string `json:"currencies,omitempty"`
// Allows fetching components allocation with matching use_site_exchange_rate based on provided value. Use in query `filter[use_site_exchange_rate]=true`.
- UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSubscriptionComponentsFilter.
@@ -23,13 +23,17 @@ type ListSubscriptionComponentsFilter struct {
func (l ListSubscriptionComponentsFilter) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "currencies", "use_site_exchange_rate"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSubscriptionComponentsFilter object to a map representation for JSON marshaling.
func (l ListSubscriptionComponentsFilter) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.Currencies != nil {
structMap["currencies"] = l.Currencies
}
@@ -47,12 +51,12 @@ func (l *ListSubscriptionComponentsFilter) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currencies", "use_site_exchange_rate")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currencies", "use_site_exchange_rate")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Currencies = temp.Currencies
l.UseSiteExchangeRate = temp.UseSiteExchangeRate
return nil
diff --git a/models/list_subscription_components_for_site_filter.go b/models/list_subscription_components_for_site_filter.go
index 750157c0..ae174538 100644
--- a/models/list_subscription_components_for_site_filter.go
+++ b/models/list_subscription_components_for_site_filter.go
@@ -12,12 +12,12 @@ import (
// ListSubscriptionComponentsForSiteFilter represents a ListSubscriptionComponentsForSiteFilter struct.
type ListSubscriptionComponentsForSiteFilter struct {
// Allows fetching components allocation with matching currency based on provided values. Use in query `filter[currencies]=USD,EUR`.
- Currencies []string `json:"currencies,omitempty"`
+ Currencies []string `json:"currencies,omitempty"`
// Allows fetching components allocation with matching use_site_exchange_rate based on provided value. Use in query `filter[use_site_exchange_rate]=true`.
- UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
+ UseSiteExchangeRate *bool `json:"use_site_exchange_rate,omitempty"`
// Nested filter used for List Subscription Components For Site Filter
- Subscription *SubscriptionFilter `json:"subscription,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Subscription *SubscriptionFilter `json:"subscription,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSubscriptionComponentsForSiteFilter.
@@ -25,13 +25,17 @@ type ListSubscriptionComponentsForSiteFilter struct {
func (l ListSubscriptionComponentsForSiteFilter) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "currencies", "use_site_exchange_rate", "subscription"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSubscriptionComponentsForSiteFilter object to a map representation for JSON marshaling.
func (l ListSubscriptionComponentsForSiteFilter) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.Currencies != nil {
structMap["currencies"] = l.Currencies
}
@@ -52,12 +56,12 @@ func (l *ListSubscriptionComponentsForSiteFilter) UnmarshalJSON(input []byte) er
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currencies", "use_site_exchange_rate", "subscription")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currencies", "use_site_exchange_rate", "subscription")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Currencies = temp.Currencies
l.UseSiteExchangeRate = temp.UseSiteExchangeRate
l.Subscription = temp.Subscription
diff --git a/models/list_subscription_components_response.go b/models/list_subscription_components_response.go
index 968067c8..259e3864 100644
--- a/models/list_subscription_components_response.go
+++ b/models/list_subscription_components_response.go
@@ -14,7 +14,7 @@ import (
// ListSubscriptionComponentsResponse represents a ListSubscriptionComponentsResponse struct.
type ListSubscriptionComponentsResponse struct {
SubscriptionsComponents []SubscriptionComponent `json:"subscriptions_components"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSubscriptionComponentsResponse.
@@ -22,13 +22,17 @@ type ListSubscriptionComponentsResponse struct {
func (l ListSubscriptionComponentsResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "subscriptions_components"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSubscriptionComponentsResponse object to a map representation for JSON marshaling.
func (l ListSubscriptionComponentsResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
structMap["subscriptions_components"] = l.SubscriptionsComponents
return structMap
}
@@ -45,12 +49,12 @@ func (l *ListSubscriptionComponentsResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscriptions_components")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscriptions_components")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.SubscriptionsComponents = *temp.SubscriptionsComponents
return nil
}
diff --git a/models/list_subscription_group_prepayment.go b/models/list_subscription_group_prepayment.go
index 681bc04a..76beefe3 100644
--- a/models/list_subscription_group_prepayment.go
+++ b/models/list_subscription_group_prepayment.go
@@ -14,7 +14,7 @@ import (
// ListSubscriptionGroupPrepayment represents a ListSubscriptionGroupPrepayment struct.
type ListSubscriptionGroupPrepayment struct {
Prepayment ListSubcriptionGroupPrepaymentItem `json:"prepayment"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSubscriptionGroupPrepayment.
@@ -22,13 +22,17 @@ type ListSubscriptionGroupPrepayment struct {
func (l ListSubscriptionGroupPrepayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "prepayment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSubscriptionGroupPrepayment object to a map representation for JSON marshaling.
func (l ListSubscriptionGroupPrepayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
structMap["prepayment"] = l.Prepayment.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (l *ListSubscriptionGroupPrepayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prepayment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prepayment")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Prepayment = *temp.Prepayment
return nil
}
diff --git a/models/list_subscription_group_prepayment_response.go b/models/list_subscription_group_prepayment_response.go
index aceaee54..b2982140 100644
--- a/models/list_subscription_group_prepayment_response.go
+++ b/models/list_subscription_group_prepayment_response.go
@@ -14,7 +14,7 @@ import (
// ListSubscriptionGroupPrepaymentResponse represents a ListSubscriptionGroupPrepaymentResponse struct.
type ListSubscriptionGroupPrepaymentResponse struct {
Prepayments []ListSubscriptionGroupPrepayment `json:"prepayments"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSubscriptionGroupPrepaymentResponse.
@@ -22,13 +22,17 @@ type ListSubscriptionGroupPrepaymentResponse struct {
func (l ListSubscriptionGroupPrepaymentResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "prepayments"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSubscriptionGroupPrepaymentResponse object to a map representation for JSON marshaling.
func (l ListSubscriptionGroupPrepaymentResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
structMap["prepayments"] = l.Prepayments
return structMap
}
@@ -45,12 +49,12 @@ func (l *ListSubscriptionGroupPrepaymentResponse) UnmarshalJSON(input []byte) er
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prepayments")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prepayments")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Prepayments = *temp.Prepayments
return nil
}
diff --git a/models/list_subscription_groups_item.go b/models/list_subscription_groups_item.go
index dcaa4c9e..785918ac 100644
--- a/models/list_subscription_groups_item.go
+++ b/models/list_subscription_groups_item.go
@@ -24,7 +24,7 @@ type ListSubscriptionGroupsItem struct {
CancelAtEndOfPeriod *bool `json:"cancel_at_end_of_period,omitempty"`
AccountBalances *SubscriptionGroupBalances `json:"account_balances,omitempty"`
GroupType *GroupType `json:"group_type,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSubscriptionGroupsItem.
@@ -32,13 +32,17 @@ type ListSubscriptionGroupsItem struct {
func (l ListSubscriptionGroupsItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period", "account_balances", "group_type"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSubscriptionGroupsItem object to a map representation for JSON marshaling.
func (l ListSubscriptionGroupsItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.Uid != nil {
structMap["uid"] = l.Uid
}
@@ -83,12 +87,12 @@ func (l *ListSubscriptionGroupsItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period", "account_balances", "group_type")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period", "account_balances", "group_type")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.Uid = temp.Uid
l.Scheme = temp.Scheme
l.CustomerId = temp.CustomerId
diff --git a/models/list_subscription_groups_meta.go b/models/list_subscription_groups_meta.go
index e9769fe7..bbdbda35 100644
--- a/models/list_subscription_groups_meta.go
+++ b/models/list_subscription_groups_meta.go
@@ -11,9 +11,9 @@ import (
// ListSubscriptionGroupsMeta represents a ListSubscriptionGroupsMeta struct.
type ListSubscriptionGroupsMeta struct {
- CurrentPage *int `json:"current_page,omitempty"`
- TotalCount *int `json:"total_count,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CurrentPage *int `json:"current_page,omitempty"`
+ TotalCount *int `json:"total_count,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSubscriptionGroupsMeta.
@@ -21,13 +21,17 @@ type ListSubscriptionGroupsMeta struct {
func (l ListSubscriptionGroupsMeta) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "current_page", "total_count"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSubscriptionGroupsMeta object to a map representation for JSON marshaling.
func (l ListSubscriptionGroupsMeta) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.CurrentPage != nil {
structMap["current_page"] = l.CurrentPage
}
@@ -45,12 +49,12 @@ func (l *ListSubscriptionGroupsMeta) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "current_page", "total_count")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "current_page", "total_count")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.CurrentPage = temp.CurrentPage
l.TotalCount = temp.TotalCount
return nil
diff --git a/models/list_subscription_groups_response.go b/models/list_subscription_groups_response.go
index ffcde9cc..d70b0c68 100644
--- a/models/list_subscription_groups_response.go
+++ b/models/list_subscription_groups_response.go
@@ -13,7 +13,7 @@ import (
type ListSubscriptionGroupsResponse struct {
SubscriptionGroups []ListSubscriptionGroupsItem `json:"subscription_groups,omitempty"`
Meta *ListSubscriptionGroupsMeta `json:"meta,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ListSubscriptionGroupsResponse.
@@ -21,13 +21,17 @@ type ListSubscriptionGroupsResponse struct {
func (l ListSubscriptionGroupsResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(l.AdditionalProperties,
+ "subscription_groups", "meta"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(l.toMap())
}
// toMap converts the ListSubscriptionGroupsResponse object to a map representation for JSON marshaling.
func (l ListSubscriptionGroupsResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, l.AdditionalProperties)
+ MergeAdditionalProperties(structMap, l.AdditionalProperties)
if l.SubscriptionGroups != nil {
structMap["subscription_groups"] = l.SubscriptionGroups
}
@@ -45,12 +49,12 @@ func (l *ListSubscriptionGroupsResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_groups", "meta")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_groups", "meta")
if err != nil {
return err
}
-
l.AdditionalProperties = additionalProperties
+
l.SubscriptionGroups = temp.SubscriptionGroups
l.Meta = temp.Meta
return nil
diff --git a/models/m_errors.go b/models/m_errors.go
index a57465fb..6e34e88b 100644
--- a/models/m_errors.go
+++ b/models/m_errors.go
@@ -11,9 +11,9 @@ import (
// Errors represents a Errors struct.
type Errors struct {
- PerPage []string `json:"per_page,omitempty"`
- PricePoint []string `json:"price_point,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PerPage []string `json:"per_page,omitempty"`
+ PricePoint []string `json:"price_point,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Errors.
@@ -21,13 +21,17 @@ type Errors struct {
func (m Errors) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "per_page", "price_point"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the Errors object to a map representation for JSON marshaling.
func (m Errors) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
if m.PerPage != nil {
structMap["per_page"] = m.PerPage
}
@@ -45,12 +49,12 @@ func (m *Errors) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "per_page", "price_point")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "per_page", "price_point")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.PerPage = temp.PerPage
m.PricePoint = temp.PricePoint
return nil
diff --git a/models/metadata.go b/models/metadata.go
index e6948495..c113554f 100644
--- a/models/metadata.go
+++ b/models/metadata.go
@@ -13,13 +13,13 @@ import (
// Metadata represents a Metadata struct.
type Metadata struct {
- Id Optional[int] `json:"id"`
- Value Optional[string] `json:"value"`
- ResourceId Optional[int] `json:"resource_id"`
- Name *string `json:"name,omitempty"`
- DeletedAt Optional[time.Time] `json:"deleted_at"`
- MetafieldId Optional[int] `json:"metafield_id"`
- AdditionalProperties map[string]any `json:"_"`
+ Id Optional[int] `json:"id"`
+ Value Optional[string] `json:"value"`
+ ResourceId Optional[int] `json:"resource_id"`
+ Name *string `json:"name,omitempty"`
+ DeletedAt Optional[time.Time] `json:"deleted_at"`
+ MetafieldId Optional[int] `json:"metafield_id"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Metadata.
@@ -27,13 +27,17 @@ type Metadata struct {
func (m Metadata) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "id", "value", "resource_id", "name", "deleted_at", "metafield_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the Metadata object to a map representation for JSON marshaling.
func (m Metadata) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
if m.Id.IsValueSet() {
if m.Id.Value() != nil {
structMap["id"] = m.Id.Value()
@@ -88,12 +92,12 @@ func (m *Metadata) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "value", "resource_id", "name", "deleted_at", "metafield_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "value", "resource_id", "name", "deleted_at", "metafield_id")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.Id = temp.Id
m.Value = temp.Value
m.ResourceId = temp.ResourceId
diff --git a/models/metafield.go b/models/metafield.go
index 826bee6b..deff4cc5 100644
--- a/models/metafield.go
+++ b/models/metafield.go
@@ -20,7 +20,7 @@ type Metafield struct {
// Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text'
InputType *MetafieldInput `json:"input_type,omitempty"`
Enum Optional[MetafieldEnum] `json:"enum"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Metafield.
@@ -28,13 +28,17 @@ type Metafield struct {
func (m Metafield) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "id", "name", "scope", "data_count", "input_type", "enum"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the Metafield object to a map representation for JSON marshaling.
func (m Metafield) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
if m.Id != nil {
structMap["id"] = m.Id
}
@@ -68,12 +72,12 @@ func (m *Metafield) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "name", "scope", "data_count", "input_type", "enum")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "name", "scope", "data_count", "input_type", "enum")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.Id = temp.Id
m.Name = temp.Name
m.Scope = temp.Scope
diff --git a/models/metafield_scope.go b/models/metafield_scope.go
index 20a2eaf1..149336b6 100644
--- a/models/metafield_scope.go
+++ b/models/metafield_scope.go
@@ -13,19 +13,19 @@ import (
// Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings.
type MetafieldScope struct {
// Include (1) or exclude (0) metafields from the csv export.
- Csv *IncludeOption `json:"csv,omitempty"`
+ Csv *IncludeOption `json:"csv,omitempty"`
// Include (1) or exclude (0) metafields from invoices.
- Invoices *IncludeOption `json:"invoices,omitempty"`
+ Invoices *IncludeOption `json:"invoices,omitempty"`
// Include (1) or exclude (0) metafields from statements.
- Statements *IncludeOption `json:"statements,omitempty"`
+ Statements *IncludeOption `json:"statements,omitempty"`
// Include (1) or exclude (0) metafields from the portal.
- Portal *IncludeOption `json:"portal,omitempty"`
+ Portal *IncludeOption `json:"portal,omitempty"`
// Include (1) or exclude (0) metafields from being viewable by your ecosystem.
- PublicShow *IncludeOption `json:"public_show,omitempty"`
+ PublicShow *IncludeOption `json:"public_show,omitempty"`
// Include (1) or exclude (0) metafields from being edited by your ecosystem.
- PublicEdit *IncludeOption `json:"public_edit,omitempty"`
- Hosted []string `json:"hosted,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PublicEdit *IncludeOption `json:"public_edit,omitempty"`
+ Hosted []string `json:"hosted,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for MetafieldScope.
@@ -33,13 +33,17 @@ type MetafieldScope struct {
func (m MetafieldScope) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "csv", "invoices", "statements", "portal", "public_show", "public_edit", "hosted"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the MetafieldScope object to a map representation for JSON marshaling.
func (m MetafieldScope) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
if m.Csv != nil {
structMap["csv"] = m.Csv
}
@@ -72,12 +76,12 @@ func (m *MetafieldScope) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "csv", "invoices", "statements", "portal", "public_show", "public_edit", "hosted")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "csv", "invoices", "statements", "portal", "public_show", "public_edit", "hosted")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.Csv = temp.Csv
m.Invoices = temp.Invoices
m.Statements = temp.Statements
diff --git a/models/metered_component.go b/models/metered_component.go
index c917c816..91ef38d4 100644
--- a/models/metered_component.go
+++ b/models/metered_component.go
@@ -27,12 +27,6 @@ type MeteredComponent struct {
PricingScheme PricingScheme `json:"pricing_scheme"`
// (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes.
Prices []Price `json:"prices,omitempty"`
- // The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
- // Available values: `full`, `prorated`, `none`.
- UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
- // The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
- // Available values: `full`, `prorated`, `none`.
- DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
PricePoints []ComponentPricePointItem `json:"price_points,omitempty"`
// The amount the customer will be charged per unit when the pricing scheme is “per_unit”. For On/Off Components, this is the amount that the customer will be charged when they turn the component on for the subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065
UnitPrice *MeteredComponentUnitPrice `json:"unit_price,omitempty"`
@@ -40,8 +34,6 @@ type MeteredComponent struct {
TaxCode *string `json:"tax_code,omitempty"`
// (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices.
HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
- // deprecated May 2011 - use unit_price instead
- PriceInCents *string `json:"price_in_cents,omitempty"`
DisplayOnHostedPage *bool `json:"display_on_hosted_page,omitempty"`
AllowFractionalQuantities *bool `json:"allow_fractional_quantities,omitempty"`
PublicSignupPageIds []int `json:"public_signup_page_ids,omitempty"`
@@ -49,7 +41,7 @@ type MeteredComponent struct {
Interval *int `json:"interval,omitempty"`
// A string representing the interval unit for this component's default price point, either month or day. This property is only available for sites with Multifrequency enabled.
IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for MeteredComponent.
@@ -57,13 +49,17 @@ type MeteredComponent struct {
func (m MeteredComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids", "interval", "interval_unit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the MeteredComponent object to a map representation for JSON marshaling.
func (m MeteredComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
structMap["name"] = m.Name
structMap["unit_name"] = m.UnitName
if m.Description != nil {
@@ -79,20 +75,6 @@ func (m MeteredComponent) toMap() map[string]any {
if m.Prices != nil {
structMap["prices"] = m.Prices
}
- if m.UpgradeCharge.IsValueSet() {
- if m.UpgradeCharge.Value() != nil {
- structMap["upgrade_charge"] = m.UpgradeCharge.Value()
- } else {
- structMap["upgrade_charge"] = nil
- }
- }
- if m.DowngradeCredit.IsValueSet() {
- if m.DowngradeCredit.Value() != nil {
- structMap["downgrade_credit"] = m.DowngradeCredit.Value()
- } else {
- structMap["downgrade_credit"] = nil
- }
- }
if m.PricePoints != nil {
structMap["price_points"] = m.PricePoints
}
@@ -105,9 +87,6 @@ func (m MeteredComponent) toMap() map[string]any {
if m.HideDateRangeOnInvoice != nil {
structMap["hide_date_range_on_invoice"] = m.HideDateRangeOnInvoice
}
- if m.PriceInCents != nil {
- structMap["price_in_cents"] = m.PriceInCents
- }
if m.DisplayOnHostedPage != nil {
structMap["display_on_hosted_page"] = m.DisplayOnHostedPage
}
@@ -142,12 +121,12 @@ func (m *MeteredComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "upgrade_charge", "downgrade_credit", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "price_in_cents", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids", "interval", "interval_unit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids", "interval", "interval_unit")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.Name = *temp.Name
m.UnitName = *temp.UnitName
m.Description = temp.Description
@@ -155,13 +134,10 @@ func (m *MeteredComponent) UnmarshalJSON(input []byte) error {
m.Taxable = temp.Taxable
m.PricingScheme = *temp.PricingScheme
m.Prices = temp.Prices
- m.UpgradeCharge = temp.UpgradeCharge
- m.DowngradeCredit = temp.DowngradeCredit
m.PricePoints = temp.PricePoints
m.UnitPrice = temp.UnitPrice
m.TaxCode = temp.TaxCode
m.HideDateRangeOnInvoice = temp.HideDateRangeOnInvoice
- m.PriceInCents = temp.PriceInCents
m.DisplayOnHostedPage = temp.DisplayOnHostedPage
m.AllowFractionalQuantities = temp.AllowFractionalQuantities
m.PublicSignupPageIds = temp.PublicSignupPageIds
@@ -179,13 +155,10 @@ type tempMeteredComponent struct {
Taxable *bool `json:"taxable,omitempty"`
PricingScheme *PricingScheme `json:"pricing_scheme"`
Prices []Price `json:"prices,omitempty"`
- UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
- DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
PricePoints []ComponentPricePointItem `json:"price_points,omitempty"`
UnitPrice *MeteredComponentUnitPrice `json:"unit_price,omitempty"`
TaxCode *string `json:"tax_code,omitempty"`
HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
- PriceInCents *string `json:"price_in_cents,omitempty"`
DisplayOnHostedPage *bool `json:"display_on_hosted_page,omitempty"`
AllowFractionalQuantities *bool `json:"allow_fractional_quantities,omitempty"`
PublicSignupPageIds []int `json:"public_signup_page_ids,omitempty"`
diff --git a/models/metered_usage.go b/models/metered_usage.go
index b27f3a3d..7171c69c 100644
--- a/models/metered_usage.go
+++ b/models/metered_usage.go
@@ -13,13 +13,13 @@ import (
// MeteredUsage represents a MeteredUsage struct.
type MeteredUsage struct {
- PreviousUnitBalance string `json:"previous_unit_balance"`
- NewUnitBalance int `json:"new_unit_balance"`
- UsageQuantity int `json:"usage_quantity"`
- ComponentId int `json:"component_id"`
- ComponentHandle string `json:"component_handle"`
- Memo string `json:"memo"`
- AdditionalProperties map[string]any `json:"_"`
+ PreviousUnitBalance string `json:"previous_unit_balance"`
+ NewUnitBalance int `json:"new_unit_balance"`
+ UsageQuantity int `json:"usage_quantity"`
+ ComponentId int `json:"component_id"`
+ ComponentHandle string `json:"component_handle"`
+ Memo string `json:"memo"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for MeteredUsage.
@@ -27,13 +27,17 @@ type MeteredUsage struct {
func (m MeteredUsage) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "previous_unit_balance", "new_unit_balance", "usage_quantity", "component_id", "component_handle", "memo"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the MeteredUsage object to a map representation for JSON marshaling.
func (m MeteredUsage) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
structMap["previous_unit_balance"] = m.PreviousUnitBalance
structMap["new_unit_balance"] = m.NewUnitBalance
structMap["usage_quantity"] = m.UsageQuantity
@@ -55,12 +59,12 @@ func (m *MeteredUsage) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "previous_unit_balance", "new_unit_balance", "usage_quantity", "component_id", "component_handle", "memo")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "previous_unit_balance", "new_unit_balance", "usage_quantity", "component_id", "component_handle", "memo")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.PreviousUnitBalance = *temp.PreviousUnitBalance
m.NewUnitBalance = *temp.NewUnitBalance
m.UsageQuantity = *temp.UsageQuantity
diff --git a/models/movement.go b/models/movement.go
index 8b3d97d3..41336cdc 100644
--- a/models/movement.go
+++ b/models/movement.go
@@ -13,16 +13,16 @@ import (
// Movement represents a Movement struct.
type Movement struct {
- Timestamp *time.Time `json:"timestamp,omitempty"`
- AmountInCents *int64 `json:"amount_in_cents,omitempty"`
- AmountFormatted *string `json:"amount_formatted,omitempty"`
- Description *string `json:"description,omitempty"`
- Category *string `json:"category,omitempty"`
- Breakouts *Breakouts `json:"breakouts,omitempty"`
- LineItems []MovementLineItem `json:"line_items,omitempty"`
- SubscriptionId *int `json:"subscription_id,omitempty"`
- SubscriberName *string `json:"subscriber_name,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Timestamp *time.Time `json:"timestamp,omitempty"`
+ AmountInCents *int64 `json:"amount_in_cents,omitempty"`
+ AmountFormatted *string `json:"amount_formatted,omitempty"`
+ Description *string `json:"description,omitempty"`
+ Category *string `json:"category,omitempty"`
+ Breakouts *Breakouts `json:"breakouts,omitempty"`
+ LineItems []MovementLineItem `json:"line_items,omitempty"`
+ SubscriptionId *int `json:"subscription_id,omitempty"`
+ SubscriberName *string `json:"subscriber_name,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Movement.
@@ -30,13 +30,17 @@ type Movement struct {
func (m Movement) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "timestamp", "amount_in_cents", "amount_formatted", "description", "category", "breakouts", "line_items", "subscription_id", "subscriber_name"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the Movement object to a map representation for JSON marshaling.
func (m Movement) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
if m.Timestamp != nil {
structMap["timestamp"] = m.Timestamp.Format(time.RFC3339)
}
@@ -75,12 +79,12 @@ func (m *Movement) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "timestamp", "amount_in_cents", "amount_formatted", "description", "category", "breakouts", "line_items", "subscription_id", "subscriber_name")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "timestamp", "amount_in_cents", "amount_formatted", "description", "category", "breakouts", "line_items", "subscription_id", "subscriber_name")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
if temp.Timestamp != nil {
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/movement_line_item.go b/models/movement_line_item.go
index dfa80b3a..a584c496 100644
--- a/models/movement_line_item.go
+++ b/models/movement_line_item.go
@@ -11,18 +11,18 @@ import (
// MovementLineItem represents a MovementLineItem struct.
type MovementLineItem struct {
- ProductId *int `json:"product_id,omitempty"`
+ ProductId *int `json:"product_id,omitempty"`
// For Product (or "baseline") line items, this field will have a value of `0`.
- ComponentId *int `json:"component_id,omitempty"`
- PricePointId *int `json:"price_point_id,omitempty"`
- Name *string `json:"name,omitempty"`
- Mrr *int `json:"mrr,omitempty"`
- MrrMovements []MRRMovement `json:"mrr_movements,omitempty"`
- Quantity *int `json:"quantity,omitempty"`
- PrevQuantity *int `json:"prev_quantity,omitempty"`
+ ComponentId *int `json:"component_id,omitempty"`
+ PricePointId *int `json:"price_point_id,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Mrr *int `json:"mrr,omitempty"`
+ MrrMovements []MRRMovement `json:"mrr_movements,omitempty"`
+ Quantity *int `json:"quantity,omitempty"`
+ PrevQuantity *int `json:"prev_quantity,omitempty"`
// When `true`, the line item's MRR value will contribute to the `plan` breakout. When `false`, the line item contributes to the `usage` breakout.
- Recurring *bool `json:"recurring,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Recurring *bool `json:"recurring,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for MovementLineItem.
@@ -30,13 +30,17 @@ type MovementLineItem struct {
func (m MovementLineItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "product_id", "component_id", "price_point_id", "name", "mrr", "mrr_movements", "quantity", "prev_quantity", "recurring"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the MovementLineItem object to a map representation for JSON marshaling.
func (m MovementLineItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
if m.ProductId != nil {
structMap["product_id"] = m.ProductId
}
@@ -75,12 +79,12 @@ func (m *MovementLineItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product_id", "component_id", "price_point_id", "name", "mrr", "mrr_movements", "quantity", "prev_quantity", "recurring")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product_id", "component_id", "price_point_id", "name", "mrr", "mrr_movements", "quantity", "prev_quantity", "recurring")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.ProductId = temp.ProductId
m.ComponentId = temp.ComponentId
m.PricePointId = temp.PricePointId
diff --git a/models/mrr.go b/models/mrr.go
index 4c8440db..3a7f4550 100644
--- a/models/mrr.go
+++ b/models/mrr.go
@@ -13,14 +13,14 @@ import (
// MRR represents a MRR struct.
type MRR struct {
- AmountInCents *int64 `json:"amount_in_cents,omitempty"`
- AmountFormatted *string `json:"amount_formatted,omitempty"`
- Currency *string `json:"currency,omitempty"`
- CurrencySymbol *string `json:"currency_symbol,omitempty"`
- Breakouts *Breakouts `json:"breakouts,omitempty"`
+ AmountInCents *int64 `json:"amount_in_cents,omitempty"`
+ AmountFormatted *string `json:"amount_formatted,omitempty"`
+ Currency *string `json:"currency,omitempty"`
+ CurrencySymbol *string `json:"currency_symbol,omitempty"`
+ Breakouts *Breakouts `json:"breakouts,omitempty"`
// ISO8601 timestamp
- AtTime *time.Time `json:"at_time,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AtTime *time.Time `json:"at_time,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for MRR.
@@ -28,13 +28,17 @@ type MRR struct {
func (m MRR) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "amount_in_cents", "amount_formatted", "currency", "currency_symbol", "breakouts", "at_time"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the MRR object to a map representation for JSON marshaling.
func (m MRR) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
if m.AmountInCents != nil {
structMap["amount_in_cents"] = m.AmountInCents
}
@@ -64,12 +68,12 @@ func (m *MRR) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "amount_in_cents", "amount_formatted", "currency", "currency_symbol", "breakouts", "at_time")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "amount_in_cents", "amount_formatted", "currency", "currency_symbol", "breakouts", "at_time")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.AmountInCents = temp.AmountInCents
m.AmountFormatted = temp.AmountFormatted
m.Currency = temp.Currency
diff --git a/models/mrr_movement.go b/models/mrr_movement.go
index 2259f235..d2d36c99 100644
--- a/models/mrr_movement.go
+++ b/models/mrr_movement.go
@@ -11,11 +11,11 @@ import (
// MRRMovement represents a MRRMovement struct.
type MRRMovement struct {
- Amount *int `json:"amount,omitempty"`
- Category *string `json:"category,omitempty"`
- SubscriberDelta *int `json:"subscriber_delta,omitempty"`
- LeadDelta *int `json:"lead_delta,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Amount *int `json:"amount,omitempty"`
+ Category *string `json:"category,omitempty"`
+ SubscriberDelta *int `json:"subscriber_delta,omitempty"`
+ LeadDelta *int `json:"lead_delta,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for MRRMovement.
@@ -23,13 +23,17 @@ type MRRMovement struct {
func (m MRRMovement) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "amount", "category", "subscriber_delta", "lead_delta"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the MRRMovement object to a map representation for JSON marshaling.
func (m MRRMovement) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
if m.Amount != nil {
structMap["amount"] = m.Amount
}
@@ -53,12 +57,12 @@ func (m *MRRMovement) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "amount", "category", "subscriber_delta", "lead_delta")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "amount", "category", "subscriber_delta", "lead_delta")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.Amount = temp.Amount
m.Category = temp.Category
m.SubscriberDelta = temp.SubscriberDelta
diff --git a/models/mrr_response.go b/models/mrr_response.go
index db17de6a..20f7e7fc 100644
--- a/models/mrr_response.go
+++ b/models/mrr_response.go
@@ -13,8 +13,8 @@ import (
// MRRResponse represents a MRRResponse struct.
type MRRResponse struct {
- Mrr MRR `json:"mrr"`
- AdditionalProperties map[string]any `json:"_"`
+ Mrr MRR `json:"mrr"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for MRRResponse.
@@ -22,13 +22,17 @@ type MRRResponse struct {
func (m MRRResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "mrr"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the MRRResponse object to a map representation for JSON marshaling.
func (m MRRResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
structMap["mrr"] = m.Mrr.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (m *MRRResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "mrr")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "mrr")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.Mrr = *temp.Mrr
return nil
}
diff --git a/models/multi_invoice_payment.go b/models/multi_invoice_payment.go
index 5ccd456c..bdc04823 100644
--- a/models/multi_invoice_payment.go
+++ b/models/multi_invoice_payment.go
@@ -18,7 +18,7 @@ type MultiInvoicePayment struct {
// The ISO 4217 currency code (3 character string) representing the currency of invoice transaction.
CurrencyCode *string `json:"currency_code,omitempty"`
Applications []InvoicePaymentApplication `json:"applications,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for MultiInvoicePayment.
@@ -26,13 +26,17 @@ type MultiInvoicePayment struct {
func (m MultiInvoicePayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "transaction_id", "total_amount", "currency_code", "applications"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the MultiInvoicePayment object to a map representation for JSON marshaling.
func (m MultiInvoicePayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
if m.TransactionId != nil {
structMap["transaction_id"] = m.TransactionId
}
@@ -56,12 +60,12 @@ func (m *MultiInvoicePayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "transaction_id", "total_amount", "currency_code", "applications")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "transaction_id", "total_amount", "currency_code", "applications")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.TransactionId = temp.TransactionId
m.TotalAmount = temp.TotalAmount
m.CurrencyCode = temp.CurrencyCode
diff --git a/models/multi_invoice_payment_response.go b/models/multi_invoice_payment_response.go
index 3d5e7cfa..5271c559 100644
--- a/models/multi_invoice_payment_response.go
+++ b/models/multi_invoice_payment_response.go
@@ -13,8 +13,8 @@ import (
// MultiInvoicePaymentResponse represents a MultiInvoicePaymentResponse struct.
type MultiInvoicePaymentResponse struct {
- Payment MultiInvoicePayment `json:"payment"`
- AdditionalProperties map[string]any `json:"_"`
+ Payment MultiInvoicePayment `json:"payment"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for MultiInvoicePaymentResponse.
@@ -22,13 +22,17 @@ type MultiInvoicePaymentResponse struct {
func (m MultiInvoicePaymentResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(m.AdditionalProperties,
+ "payment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(m.toMap())
}
// toMap converts the MultiInvoicePaymentResponse object to a map representation for JSON marshaling.
func (m MultiInvoicePaymentResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, m.AdditionalProperties)
+ MergeAdditionalProperties(structMap, m.AdditionalProperties)
structMap["payment"] = m.Payment.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (m *MultiInvoicePaymentResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payment")
if err != nil {
return err
}
-
m.AdditionalProperties = additionalProperties
+
m.Payment = *temp.Payment
return nil
}
diff --git a/models/nested_subscription_group.go b/models/nested_subscription_group.go
index e1ada874..f717b63f 100644
--- a/models/nested_subscription_group.go
+++ b/models/nested_subscription_group.go
@@ -12,14 +12,14 @@ import (
// NestedSubscriptionGroup represents a NestedSubscriptionGroup struct.
type NestedSubscriptionGroup struct {
// The UID for the group
- Uid *string `json:"uid,omitempty"`
+ Uid *string `json:"uid,omitempty"`
// Whether the group is configured to rely on a primary subscription for billing. At this time, it will always be 1.
- Scheme *int `json:"scheme,omitempty"`
+ Scheme *int `json:"scheme,omitempty"`
// The subscription ID of the primary within the group. Applicable to scheme 1.
- PrimarySubscriptionId *int `json:"primary_subscription_id,omitempty"`
+ PrimarySubscriptionId *int `json:"primary_subscription_id,omitempty"`
// A boolean indicating whether the subscription is the primary in the group. Applicable to scheme 1.
- Primary *bool `json:"primary,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Primary *bool `json:"primary,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for NestedSubscriptionGroup.
@@ -27,13 +27,17 @@ type NestedSubscriptionGroup struct {
func (n NestedSubscriptionGroup) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(n.AdditionalProperties,
+ "uid", "scheme", "primary_subscription_id", "primary"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(n.toMap())
}
// toMap converts the NestedSubscriptionGroup object to a map representation for JSON marshaling.
func (n NestedSubscriptionGroup) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, n.AdditionalProperties)
+ MergeAdditionalProperties(structMap, n.AdditionalProperties)
if n.Uid != nil {
structMap["uid"] = n.Uid
}
@@ -57,12 +61,12 @@ func (n *NestedSubscriptionGroup) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "scheme", "primary_subscription_id", "primary")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "scheme", "primary_subscription_id", "primary")
if err != nil {
return err
}
-
n.AdditionalProperties = additionalProperties
+
n.Uid = temp.Uid
n.Scheme = temp.Scheme
n.PrimarySubscriptionId = temp.PrimarySubscriptionId
diff --git a/models/net_terms.go b/models/net_terms.go
index 7aa77be4..678df7ae 100644
--- a/models/net_terms.go
+++ b/models/net_terms.go
@@ -11,12 +11,12 @@ import (
// NetTerms represents a NetTerms struct.
type NetTerms struct {
- DefaultNetTerms *int `json:"default_net_terms,omitempty"`
- AutomaticNetTerms *int `json:"automatic_net_terms,omitempty"`
- RemittanceNetTerms *int `json:"remittance_net_terms,omitempty"`
- NetTermsOnRemittanceSignupsEnabled *bool `json:"net_terms_on_remittance_signups_enabled,omitempty"`
- CustomNetTermsEnabled *bool `json:"custom_net_terms_enabled,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ DefaultNetTerms *int `json:"default_net_terms,omitempty"`
+ AutomaticNetTerms *int `json:"automatic_net_terms,omitempty"`
+ RemittanceNetTerms *int `json:"remittance_net_terms,omitempty"`
+ NetTermsOnRemittanceSignupsEnabled *bool `json:"net_terms_on_remittance_signups_enabled,omitempty"`
+ CustomNetTermsEnabled *bool `json:"custom_net_terms_enabled,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for NetTerms.
@@ -24,13 +24,17 @@ type NetTerms struct {
func (n NetTerms) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(n.AdditionalProperties,
+ "default_net_terms", "automatic_net_terms", "remittance_net_terms", "net_terms_on_remittance_signups_enabled", "custom_net_terms_enabled"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(n.toMap())
}
// toMap converts the NetTerms object to a map representation for JSON marshaling.
func (n NetTerms) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, n.AdditionalProperties)
+ MergeAdditionalProperties(structMap, n.AdditionalProperties)
if n.DefaultNetTerms != nil {
structMap["default_net_terms"] = n.DefaultNetTerms
}
@@ -57,12 +61,12 @@ func (n *NetTerms) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "default_net_terms", "automatic_net_terms", "remittance_net_terms", "net_terms_on_remittance_signups_enabled", "custom_net_terms_enabled")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "default_net_terms", "automatic_net_terms", "remittance_net_terms", "net_terms_on_remittance_signups_enabled", "custom_net_terms_enabled")
if err != nil {
return err
}
-
n.AdditionalProperties = additionalProperties
+
n.DefaultNetTerms = temp.DefaultNetTerms
n.AutomaticNetTerms = temp.AutomaticNetTerms
n.RemittanceNetTerms = temp.RemittanceNetTerms
diff --git a/models/offer.go b/models/offer.go
index 4ea4c510..14185c9b 100644
--- a/models/offer.go
+++ b/models/offer.go
@@ -13,26 +13,26 @@ import (
// Offer represents a Offer struct.
type Offer struct {
- Id *int `json:"id,omitempty"`
- SiteId *int `json:"site_id,omitempty"`
- ProductFamilyId *int `json:"product_family_id,omitempty"`
- ProductId *int `json:"product_id,omitempty"`
- ProductPricePointId *int `json:"product_price_point_id,omitempty"`
- ProductRevisableNumber *int `json:"product_revisable_number,omitempty"`
- Name *string `json:"name,omitempty"`
- Handle *string `json:"handle,omitempty"`
- Description Optional[string] `json:"description"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- ArchivedAt Optional[time.Time] `json:"archived_at"`
- OfferItems []OfferItem `json:"offer_items,omitempty"`
- OfferDiscounts []OfferDiscount `json:"offer_discounts,omitempty"`
- ProductFamilyName *string `json:"product_family_name,omitempty"`
- ProductName *string `json:"product_name,omitempty"`
- ProductPricePointName *string `json:"product_price_point_name,omitempty"`
- ProductPriceInCents *int64 `json:"product_price_in_cents,omitempty"`
- OfferSignupPages []OfferSignupPage `json:"offer_signup_pages,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ SiteId *int `json:"site_id,omitempty"`
+ ProductFamilyId *int `json:"product_family_id,omitempty"`
+ ProductId *int `json:"product_id,omitempty"`
+ ProductPricePointId *int `json:"product_price_point_id,omitempty"`
+ ProductRevisableNumber *int `json:"product_revisable_number,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Handle *string `json:"handle,omitempty"`
+ Description Optional[string] `json:"description"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ UpdatedAt *time.Time `json:"updated_at,omitempty"`
+ ArchivedAt Optional[time.Time] `json:"archived_at"`
+ OfferItems []OfferItem `json:"offer_items,omitempty"`
+ OfferDiscounts []OfferDiscount `json:"offer_discounts,omitempty"`
+ ProductFamilyName *string `json:"product_family_name,omitempty"`
+ ProductName *string `json:"product_name,omitempty"`
+ ProductPricePointName *string `json:"product_price_point_name,omitempty"`
+ ProductPriceInCents *int64 `json:"product_price_in_cents,omitempty"`
+ OfferSignupPages []OfferSignupPage `json:"offer_signup_pages,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Offer.
@@ -40,13 +40,17 @@ type Offer struct {
func (o Offer) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "id", "site_id", "product_family_id", "product_id", "product_price_point_id", "product_revisable_number", "name", "handle", "description", "created_at", "updated_at", "archived_at", "offer_items", "offer_discounts", "product_family_name", "product_name", "product_price_point_name", "product_price_in_cents", "offer_signup_pages"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(o.toMap())
}
// toMap converts the Offer object to a map representation for JSON marshaling.
func (o Offer) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, o.AdditionalProperties)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
if o.Id != nil {
structMap["id"] = o.Id
}
@@ -128,12 +132,12 @@ func (o *Offer) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "site_id", "product_family_id", "product_id", "product_price_point_id", "product_revisable_number", "name", "handle", "description", "created_at", "updated_at", "archived_at", "offer_items", "offer_discounts", "product_family_name", "product_name", "product_price_point_name", "product_price_in_cents", "offer_signup_pages")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "site_id", "product_family_id", "product_id", "product_price_point_id", "product_revisable_number", "name", "handle", "description", "created_at", "updated_at", "archived_at", "offer_items", "offer_discounts", "product_family_name", "product_name", "product_price_point_name", "product_price_in_cents", "offer_signup_pages")
if err != nil {
return err
}
-
o.AdditionalProperties = additionalProperties
+
o.Id = temp.Id
o.SiteId = temp.SiteId
o.ProductFamilyId = temp.ProductFamilyId
diff --git a/models/offer_discount.go b/models/offer_discount.go
index 2c1e559b..ecd8f315 100644
--- a/models/offer_discount.go
+++ b/models/offer_discount.go
@@ -11,10 +11,10 @@ import (
// OfferDiscount represents a OfferDiscount struct.
type OfferDiscount struct {
- CouponCode *string `json:"coupon_code,omitempty"`
- CouponId *int `json:"coupon_id,omitempty"`
- CouponName *string `json:"coupon_name,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CouponCode *string `json:"coupon_code,omitempty"`
+ CouponId *int `json:"coupon_id,omitempty"`
+ CouponName *string `json:"coupon_name,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for OfferDiscount.
@@ -22,13 +22,17 @@ type OfferDiscount struct {
func (o OfferDiscount) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "coupon_code", "coupon_id", "coupon_name"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(o.toMap())
}
// toMap converts the OfferDiscount object to a map representation for JSON marshaling.
func (o OfferDiscount) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, o.AdditionalProperties)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
if o.CouponCode != nil {
structMap["coupon_code"] = o.CouponCode
}
@@ -49,12 +53,12 @@ func (o *OfferDiscount) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "coupon_code", "coupon_id", "coupon_name")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "coupon_code", "coupon_id", "coupon_name")
if err != nil {
return err
}
-
o.AdditionalProperties = additionalProperties
+
o.CouponCode = temp.CouponCode
o.CouponId = temp.CouponId
o.CouponName = temp.CouponName
diff --git a/models/offer_item.go b/models/offer_item.go
index a4acf81d..dc4e2e41 100644
--- a/models/offer_item.go
+++ b/models/offer_item.go
@@ -23,7 +23,7 @@ type OfferItem struct {
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 Optional[IntervalUnit] `json:"interval_unit"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for OfferItem.
@@ -31,13 +31,17 @@ type OfferItem struct {
func (o OfferItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "component_id", "price_point_id", "starting_quantity", "editable", "component_unit_price", "component_name", "price_point_name", "currency_prices", "interval", "interval_unit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(o.toMap())
}
// toMap converts the OfferItem object to a map representation for JSON marshaling.
func (o OfferItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, o.AdditionalProperties)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
if o.ComponentId != nil {
structMap["component_id"] = o.ComponentId
}
@@ -83,12 +87,12 @@ func (o *OfferItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component_id", "price_point_id", "starting_quantity", "editable", "component_unit_price", "component_name", "price_point_name", "currency_prices", "interval", "interval_unit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component_id", "price_point_id", "starting_quantity", "editable", "component_unit_price", "component_name", "price_point_name", "currency_prices", "interval", "interval_unit")
if err != nil {
return err
}
-
o.AdditionalProperties = additionalProperties
+
o.ComponentId = temp.ComponentId
o.PricePointId = temp.PricePointId
o.StartingQuantity = temp.StartingQuantity
diff --git a/models/offer_response.go b/models/offer_response.go
index 5a2d5584..0e05aaa4 100644
--- a/models/offer_response.go
+++ b/models/offer_response.go
@@ -11,8 +11,8 @@ import (
// OfferResponse represents a OfferResponse struct.
type OfferResponse struct {
- Offer *Offer `json:"offer,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Offer *Offer `json:"offer,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for OfferResponse.
@@ -20,13 +20,17 @@ type OfferResponse struct {
func (o OfferResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "offer"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(o.toMap())
}
// toMap converts the OfferResponse object to a map representation for JSON marshaling.
func (o OfferResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, o.AdditionalProperties)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
if o.Offer != nil {
structMap["offer"] = o.Offer.toMap()
}
@@ -41,12 +45,12 @@ func (o *OfferResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "offer")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "offer")
if err != nil {
return err
}
-
o.AdditionalProperties = additionalProperties
+
o.Offer = temp.Offer
return nil
}
diff --git a/models/offer_signup_page.go b/models/offer_signup_page.go
index 8bad21e4..37bcdcea 100644
--- a/models/offer_signup_page.go
+++ b/models/offer_signup_page.go
@@ -11,13 +11,13 @@ import (
// OfferSignupPage represents a OfferSignupPage struct.
type OfferSignupPage struct {
- Id *int `json:"id,omitempty"`
- Nickname *string `json:"nickname,omitempty"`
- Enabled *bool `json:"enabled,omitempty"`
- ReturnUrl *string `json:"return_url,omitempty"`
- ReturnParams *string `json:"return_params,omitempty"`
- Url *string `json:"url,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ Nickname *string `json:"nickname,omitempty"`
+ Enabled *bool `json:"enabled,omitempty"`
+ ReturnUrl *string `json:"return_url,omitempty"`
+ ReturnParams *string `json:"return_params,omitempty"`
+ Url *string `json:"url,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for OfferSignupPage.
@@ -25,13 +25,17 @@ type OfferSignupPage struct {
func (o OfferSignupPage) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "id", "nickname", "enabled", "return_url", "return_params", "url"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(o.toMap())
}
// toMap converts the OfferSignupPage object to a map representation for JSON marshaling.
func (o OfferSignupPage) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, o.AdditionalProperties)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
if o.Id != nil {
structMap["id"] = o.Id
}
@@ -61,12 +65,12 @@ func (o *OfferSignupPage) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "nickname", "enabled", "return_url", "return_params", "url")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "nickname", "enabled", "return_url", "return_params", "url")
if err != nil {
return err
}
-
o.AdditionalProperties = additionalProperties
+
o.Id = temp.Id
o.Nickname = temp.Nickname
o.Enabled = temp.Enabled
diff --git a/models/ok_response.go b/models/ok_response.go
new file mode 100644
index 00000000..0d10eaf3
--- /dev/null
+++ b/models/ok_response.go
@@ -0,0 +1,61 @@
+/*
+Package advancedbilling
+
+This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
+*/
+package models
+
+import (
+ "encoding/json"
+)
+
+// OkResponse represents a OkResponse struct.
+type OkResponse struct {
+ Ok *string `json:"ok,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
+}
+
+// MarshalJSON implements the json.Marshaler interface for OkResponse.
+// It customizes the JSON marshaling process for OkResponse objects.
+func (o OkResponse) MarshalJSON() (
+ []byte,
+ error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "ok"); err != nil {
+ return []byte{}, err
+ }
+ return json.Marshal(o.toMap())
+}
+
+// toMap converts the OkResponse object to a map representation for JSON marshaling.
+func (o OkResponse) toMap() map[string]any {
+ structMap := make(map[string]any)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
+ if o.Ok != nil {
+ structMap["ok"] = o.Ok
+ }
+ return structMap
+}
+
+// UnmarshalJSON implements the json.Unmarshaler interface for OkResponse.
+// It customizes the JSON unmarshaling process for OkResponse objects.
+func (o *OkResponse) UnmarshalJSON(input []byte) error {
+ var temp tempOkResponse
+ err := json.Unmarshal(input, &temp)
+ if err != nil {
+ return err
+ }
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "ok")
+ if err != nil {
+ return err
+ }
+ o.AdditionalProperties = additionalProperties
+
+ o.Ok = temp.Ok
+ return nil
+}
+
+// tempOkResponse is a temporary struct used for validating the fields of OkResponse.
+type tempOkResponse struct {
+ Ok *string `json:"ok,omitempty"`
+}
diff --git a/models/on_off_component.go b/models/on_off_component.go
index 2d40ad3b..704e27d0 100644
--- a/models/on_off_component.go
+++ b/models/on_off_component.go
@@ -21,8 +21,6 @@ type OnOffComponent struct {
Handle *string `json:"handle,omitempty"`
// Boolean flag describing whether a component is taxable or not.
Taxable *bool `json:"taxable,omitempty"`
- // (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261191737101-Price-Points-Components) for an overview of how price brackets work for different pricing schemes.
- Prices []Price `json:"prices,omitempty"`
// The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
// Available values: `full`, `prorated`, `none`.
UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
@@ -30,14 +28,12 @@ type OnOffComponent struct {
// Available values: `full`, `prorated`, `none`.
DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
PricePoints []ComponentPricePointItem `json:"price_points,omitempty"`
- // The amount the customer will be charged per unit when the pricing scheme is “per_unit”. For On/Off Components, this is the amount that the customer will be charged when they turn the component on for the subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065
- UnitPrice *OnOffComponentUnitPrice `json:"unit_price,omitempty"`
+ // This is the amount that the customer will be charged when they turn the component on for the subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065
+ UnitPrice OnOffComponentUnitPrice `json:"unit_price"`
// A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters.
TaxCode *string `json:"tax_code,omitempty"`
// (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices.
HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
- // deprecated May 2011 - use unit_price instead
- PriceInCents *string `json:"price_in_cents,omitempty"`
DisplayOnHostedPage *bool `json:"display_on_hosted_page,omitempty"`
AllowFractionalQuantities *bool `json:"allow_fractional_quantities,omitempty"`
PublicSignupPageIds []int `json:"public_signup_page_ids,omitempty"`
@@ -45,7 +41,7 @@ type OnOffComponent struct {
Interval *int `json:"interval,omitempty"`
// A string representing the interval unit for this component's default price point, either month or day. This property is only available for sites with Multifrequency enabled.
IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for OnOffComponent.
@@ -53,13 +49,17 @@ type OnOffComponent struct {
func (o OnOffComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "name", "description", "handle", "taxable", "upgrade_charge", "downgrade_credit", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids", "interval", "interval_unit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(o.toMap())
}
// toMap converts the OnOffComponent object to a map representation for JSON marshaling.
func (o OnOffComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, o.AdditionalProperties)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
structMap["name"] = o.Name
if o.Description != nil {
structMap["description"] = o.Description
@@ -70,9 +70,6 @@ func (o OnOffComponent) toMap() map[string]any {
if o.Taxable != nil {
structMap["taxable"] = o.Taxable
}
- if o.Prices != nil {
- structMap["prices"] = o.Prices
- }
if o.UpgradeCharge.IsValueSet() {
if o.UpgradeCharge.Value() != nil {
structMap["upgrade_charge"] = o.UpgradeCharge.Value()
@@ -90,18 +87,13 @@ func (o OnOffComponent) toMap() map[string]any {
if o.PricePoints != nil {
structMap["price_points"] = o.PricePoints
}
- if o.UnitPrice != nil {
- structMap["unit_price"] = o.UnitPrice.toMap()
- }
+ structMap["unit_price"] = o.UnitPrice.toMap()
if o.TaxCode != nil {
structMap["tax_code"] = o.TaxCode
}
if o.HideDateRangeOnInvoice != nil {
structMap["hide_date_range_on_invoice"] = o.HideDateRangeOnInvoice
}
- if o.PriceInCents != nil {
- structMap["price_in_cents"] = o.PriceInCents
- }
if o.DisplayOnHostedPage != nil {
structMap["display_on_hosted_page"] = o.DisplayOnHostedPage
}
@@ -136,24 +128,22 @@ func (o *OnOffComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "description", "handle", "taxable", "prices", "upgrade_charge", "downgrade_credit", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "price_in_cents", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids", "interval", "interval_unit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "description", "handle", "taxable", "upgrade_charge", "downgrade_credit", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids", "interval", "interval_unit")
if err != nil {
return err
}
-
o.AdditionalProperties = additionalProperties
+
o.Name = *temp.Name
o.Description = temp.Description
o.Handle = temp.Handle
o.Taxable = temp.Taxable
- o.Prices = temp.Prices
o.UpgradeCharge = temp.UpgradeCharge
o.DowngradeCredit = temp.DowngradeCredit
o.PricePoints = temp.PricePoints
- o.UnitPrice = temp.UnitPrice
+ o.UnitPrice = *temp.UnitPrice
o.TaxCode = temp.TaxCode
o.HideDateRangeOnInvoice = temp.HideDateRangeOnInvoice
- o.PriceInCents = temp.PriceInCents
o.DisplayOnHostedPage = temp.DisplayOnHostedPage
o.AllowFractionalQuantities = temp.AllowFractionalQuantities
o.PublicSignupPageIds = temp.PublicSignupPageIds
@@ -168,14 +158,12 @@ type tempOnOffComponent struct {
Description *string `json:"description,omitempty"`
Handle *string `json:"handle,omitempty"`
Taxable *bool `json:"taxable,omitempty"`
- Prices []Price `json:"prices,omitempty"`
UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
PricePoints []ComponentPricePointItem `json:"price_points,omitempty"`
- UnitPrice *OnOffComponentUnitPrice `json:"unit_price,omitempty"`
+ UnitPrice *OnOffComponentUnitPrice `json:"unit_price"`
TaxCode *string `json:"tax_code,omitempty"`
HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
- PriceInCents *string `json:"price_in_cents,omitempty"`
DisplayOnHostedPage *bool `json:"display_on_hosted_page,omitempty"`
AllowFractionalQuantities *bool `json:"allow_fractional_quantities,omitempty"`
PublicSignupPageIds []int `json:"public_signup_page_ids,omitempty"`
@@ -188,6 +176,9 @@ func (o *tempOnOffComponent) validate() error {
if o.Name == nil {
errs = append(errs, "required field `name` is missing for type `On/Off Component`")
}
+ if o.UnitPrice == nil {
+ errs = append(errs, "required field `unit_price` is missing for type `On/Off Component`")
+ }
if len(errs) == 0 {
return nil
}
diff --git a/models/organization_address.go b/models/organization_address.go
index 6ab8a584..4ccc5162 100644
--- a/models/organization_address.go
+++ b/models/organization_address.go
@@ -11,15 +11,15 @@ import (
// OrganizationAddress represents a OrganizationAddress struct.
type OrganizationAddress struct {
- Street Optional[string] `json:"street"`
- Line2 Optional[string] `json:"line2"`
- City Optional[string] `json:"city"`
- State Optional[string] `json:"state"`
- Zip Optional[string] `json:"zip"`
- Country Optional[string] `json:"country"`
- Name Optional[string] `json:"name"`
- Phone Optional[string] `json:"phone"`
- AdditionalProperties map[string]any `json:"_"`
+ Street Optional[string] `json:"street"`
+ Line2 Optional[string] `json:"line2"`
+ City Optional[string] `json:"city"`
+ State Optional[string] `json:"state"`
+ Zip Optional[string] `json:"zip"`
+ Country Optional[string] `json:"country"`
+ Name Optional[string] `json:"name"`
+ Phone Optional[string] `json:"phone"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for OrganizationAddress.
@@ -27,13 +27,17 @@ type OrganizationAddress struct {
func (o OrganizationAddress) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "street", "line2", "city", "state", "zip", "country", "name", "phone"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(o.toMap())
}
// toMap converts the OrganizationAddress object to a map representation for JSON marshaling.
func (o OrganizationAddress) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, o.AdditionalProperties)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
if o.Street.IsValueSet() {
if o.Street.Value() != nil {
structMap["street"] = o.Street.Value()
@@ -101,12 +105,12 @@ func (o *OrganizationAddress) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "street", "line2", "city", "state", "zip", "country", "name", "phone")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "street", "line2", "city", "state", "zip", "country", "name", "phone")
if err != nil {
return err
}
-
o.AdditionalProperties = additionalProperties
+
o.Street = temp.Street
o.Line2 = temp.Line2
o.City = temp.City
diff --git a/models/origin_invoice.go b/models/origin_invoice.go
index 87f5590a..6cb02b4c 100644
--- a/models/origin_invoice.go
+++ b/models/origin_invoice.go
@@ -12,10 +12,10 @@ import (
// OriginInvoice represents a OriginInvoice struct.
type OriginInvoice struct {
// The UID of the invoice serving as an origin invoice.
- Uid *string `json:"uid,omitempty"`
+ Uid *string `json:"uid,omitempty"`
// The number of the invoice serving as an origin invoice.
- Number *string `json:"number,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Number *string `json:"number,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for OriginInvoice.
@@ -23,13 +23,17 @@ type OriginInvoice struct {
func (o OriginInvoice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "uid", "number"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(o.toMap())
}
// toMap converts the OriginInvoice object to a map representation for JSON marshaling.
func (o OriginInvoice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, o.AdditionalProperties)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
if o.Uid != nil {
structMap["uid"] = o.Uid
}
@@ -47,12 +51,12 @@ func (o *OriginInvoice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "number")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "number")
if err != nil {
return err
}
-
o.AdditionalProperties = additionalProperties
+
o.Uid = temp.Uid
o.Number = temp.Number
return nil
diff --git a/models/overage_pricing.go b/models/overage_pricing.go
index 827b68db..2bbd880f 100644
--- a/models/overage_pricing.go
+++ b/models/overage_pricing.go
@@ -14,9 +14,9 @@ import (
// OveragePricing represents a OveragePricing struct.
type OveragePricing struct {
// 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"`
- Prices []Price `json:"prices,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PricingScheme PricingScheme `json:"pricing_scheme"`
+ Prices []Price `json:"prices,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for OveragePricing.
@@ -24,13 +24,17 @@ type OveragePricing struct {
func (o OveragePricing) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "pricing_scheme", "prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(o.toMap())
}
// toMap converts the OveragePricing object to a map representation for JSON marshaling.
func (o OveragePricing) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, o.AdditionalProperties)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
structMap["pricing_scheme"] = o.PricingScheme
if o.Prices != nil {
structMap["prices"] = o.Prices
@@ -50,12 +54,12 @@ func (o *OveragePricing) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "pricing_scheme", "prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "pricing_scheme", "prices")
if err != nil {
return err
}
-
o.AdditionalProperties = additionalProperties
+
o.PricingScheme = *temp.PricingScheme
o.Prices = temp.Prices
return nil
diff --git a/models/override_subscription.go b/models/override_subscription.go
index d23ef2bb..f811dc31 100644
--- a/models/override_subscription.go
+++ b/models/override_subscription.go
@@ -14,16 +14,16 @@ import (
// OverrideSubscription represents a OverrideSubscription struct.
type OverrideSubscription struct {
// Can be used to record an external signup date. Chargify uses this field to record when a subscription first goes active (either at signup or at trial end). Only ISO8601 format is supported.
- ActivatedAt *time.Time `json:"activated_at,omitempty"`
+ ActivatedAt *time.Time `json:"activated_at,omitempty"`
// Can be used to record an external cancellation date. Chargify sets this field automatically when a subscription is canceled, whether by request or via dunning. Only ISO8601 format is supported.
- CanceledAt *time.Time `json:"canceled_at,omitempty"`
+ CanceledAt *time.Time `json:"canceled_at,omitempty"`
// Can be used to record a reason for the original cancellation.
- CancellationMessage *string `json:"cancellation_message,omitempty"`
+ CancellationMessage *string `json:"cancellation_message,omitempty"`
// Can be used to record an external expiration date. Chargify sets this field automatically when a subscription expires (ceases billing) after a prescribed amount of time. Only ISO8601 format is supported.
- ExpiresAt *time.Time `json:"expires_at,omitempty"`
+ ExpiresAt *time.Time `json:"expires_at,omitempty"`
// Can only be used when a subscription is unbilled, which happens when a future initial billing date is passed at subscription creation. The value passed must be before the current date and time. Allows you to set when the period started so mid period component allocations have the correct proration. Only ISO8601 format is supported.
- CurrentPeriodStartsAt *time.Time `json:"current_period_starts_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CurrentPeriodStartsAt *time.Time `json:"current_period_starts_at,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for OverrideSubscription.
@@ -31,13 +31,17 @@ type OverrideSubscription struct {
func (o OverrideSubscription) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "activated_at", "canceled_at", "cancellation_message", "expires_at", "current_period_starts_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(o.toMap())
}
// toMap converts the OverrideSubscription object to a map representation for JSON marshaling.
func (o OverrideSubscription) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, o.AdditionalProperties)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
if o.ActivatedAt != nil {
structMap["activated_at"] = o.ActivatedAt.Format(time.RFC3339)
}
@@ -64,12 +68,12 @@ func (o *OverrideSubscription) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "activated_at", "canceled_at", "cancellation_message", "expires_at", "current_period_starts_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "activated_at", "canceled_at", "cancellation_message", "expires_at", "current_period_starts_at")
if err != nil {
return err
}
-
o.AdditionalProperties = additionalProperties
+
if temp.ActivatedAt != nil {
ActivatedAtVal, err := time.Parse(time.RFC3339, *temp.ActivatedAt)
if err != nil {
diff --git a/models/override_subscription_request.go b/models/override_subscription_request.go
index cde23ea8..92bebd07 100644
--- a/models/override_subscription_request.go
+++ b/models/override_subscription_request.go
@@ -13,8 +13,8 @@ import (
// OverrideSubscriptionRequest represents a OverrideSubscriptionRequest struct.
type OverrideSubscriptionRequest struct {
- Subscription OverrideSubscription `json:"subscription"`
- AdditionalProperties map[string]any `json:"_"`
+ Subscription OverrideSubscription `json:"subscription"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for OverrideSubscriptionRequest.
@@ -22,13 +22,17 @@ type OverrideSubscriptionRequest struct {
func (o OverrideSubscriptionRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(o.AdditionalProperties,
+ "subscription"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(o.toMap())
}
// toMap converts the OverrideSubscriptionRequest object to a map representation for JSON marshaling.
func (o OverrideSubscriptionRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, o.AdditionalProperties)
+ MergeAdditionalProperties(structMap, o.AdditionalProperties)
structMap["subscription"] = o.Subscription.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (o *OverrideSubscriptionRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription")
if err != nil {
return err
}
-
o.AdditionalProperties = additionalProperties
+
o.Subscription = *temp.Subscription
return nil
}
diff --git a/models/paginated_metadata.go b/models/paginated_metadata.go
index 8b09179d..bfe369a4 100644
--- a/models/paginated_metadata.go
+++ b/models/paginated_metadata.go
@@ -11,12 +11,12 @@ import (
// PaginatedMetadata represents a PaginatedMetadata struct.
type PaginatedMetadata struct {
- TotalCount *int `json:"total_count,omitempty"`
- CurrentPage *int `json:"current_page,omitempty"`
- TotalPages *int `json:"total_pages,omitempty"`
- PerPage *int `json:"per_page,omitempty"`
- Metadata []Metadata `json:"metadata,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ TotalCount *int `json:"total_count,omitempty"`
+ CurrentPage *int `json:"current_page,omitempty"`
+ TotalPages *int `json:"total_pages,omitempty"`
+ PerPage *int `json:"per_page,omitempty"`
+ Metadata []Metadata `json:"metadata,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaginatedMetadata.
@@ -24,13 +24,17 @@ type PaginatedMetadata struct {
func (p PaginatedMetadata) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "total_count", "current_page", "total_pages", "per_page", "metadata"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaginatedMetadata object to a map representation for JSON marshaling.
func (p PaginatedMetadata) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.TotalCount != nil {
structMap["total_count"] = p.TotalCount
}
@@ -57,12 +61,12 @@ func (p *PaginatedMetadata) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "total_count", "current_page", "total_pages", "per_page", "metadata")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "total_count", "current_page", "total_pages", "per_page", "metadata")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.TotalCount = temp.TotalCount
p.CurrentPage = temp.CurrentPage
p.TotalPages = temp.TotalPages
diff --git a/models/paid_invoice.go b/models/paid_invoice.go
index 01b95bb5..d7689192 100644
--- a/models/paid_invoice.go
+++ b/models/paid_invoice.go
@@ -12,14 +12,14 @@ import (
// PaidInvoice represents a PaidInvoice struct.
type PaidInvoice struct {
// The uid of the paid invoice
- InvoiceId *string `json:"invoice_id,omitempty"`
+ InvoiceId *string `json:"invoice_id,omitempty"`
// The current status of the invoice. See [Invoice Statuses](https://maxio.zendesk.com/hc/en-us/articles/24252287829645-Advanced-Billing-Invoices-Overview#invoice-statuses) for more.
- Status *InvoiceStatus `json:"status,omitempty"`
+ Status *InvoiceStatus `json:"status,omitempty"`
// The remaining due amount on the invoice
- DueAmount *string `json:"due_amount,omitempty"`
+ DueAmount *string `json:"due_amount,omitempty"`
// The total amount paid on this invoice (including any prior payments)
- PaidAmount *string `json:"paid_amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PaidAmount *string `json:"paid_amount,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaidInvoice.
@@ -27,13 +27,17 @@ type PaidInvoice struct {
func (p PaidInvoice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "invoice_id", "status", "due_amount", "paid_amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaidInvoice object to a map representation for JSON marshaling.
func (p PaidInvoice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.InvoiceId != nil {
structMap["invoice_id"] = p.InvoiceId
}
@@ -57,12 +61,12 @@ func (p *PaidInvoice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "invoice_id", "status", "due_amount", "paid_amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "invoice_id", "status", "due_amount", "paid_amount")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.InvoiceId = temp.InvoiceId
p.Status = temp.Status
p.DueAmount = temp.DueAmount
diff --git a/models/pause_request.go b/models/pause_request.go
index 9b72d49e..aa1fe48e 100644
--- a/models/pause_request.go
+++ b/models/pause_request.go
@@ -12,8 +12,8 @@ import (
// PauseRequest represents a PauseRequest struct.
// Allows to pause a Subscription
type PauseRequest struct {
- Hold *AutoResume `json:"hold,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Hold *AutoResume `json:"hold,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PauseRequest.
@@ -21,13 +21,17 @@ type PauseRequest struct {
func (p PauseRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "hold"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PauseRequest object to a map representation for JSON marshaling.
func (p PauseRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Hold != nil {
structMap["hold"] = p.Hold.toMap()
}
@@ -42,12 +46,12 @@ func (p *PauseRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "hold")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "hold")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Hold = temp.Hold
return nil
}
diff --git a/models/payer_attributes.go b/models/payer_attributes.go
index f8ecc38d..7f031c5e 100644
--- a/models/payer_attributes.go
+++ b/models/payer_attributes.go
@@ -11,26 +11,26 @@ import (
// PayerAttributes represents a PayerAttributes struct.
type PayerAttributes struct {
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- Email *string `json:"email,omitempty"`
- CcEmails *string `json:"cc_emails,omitempty"`
- Organization *string `json:"organization,omitempty"`
- Reference *string `json:"reference,omitempty"`
- Address *string `json:"address,omitempty"`
- Address2 *string `json:"address_2,omitempty"`
- City *string `json:"city,omitempty"`
- State *string `json:"state,omitempty"`
- Zip *string `json:"zip,omitempty"`
- Country *string `json:"country,omitempty"`
- Phone *string `json:"phone,omitempty"`
- Locale *string `json:"locale,omitempty"`
- VatNumber *string `json:"vat_number,omitempty"`
- TaxExempt *bool `json:"tax_exempt,omitempty"`
- TaxExemptReason *string `json:"tax_exempt_reason,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
+ Email *string `json:"email,omitempty"`
+ CcEmails *string `json:"cc_emails,omitempty"`
+ Organization *string `json:"organization,omitempty"`
+ Reference *string `json:"reference,omitempty"`
+ Address *string `json:"address,omitempty"`
+ Address2 *string `json:"address_2,omitempty"`
+ City *string `json:"city,omitempty"`
+ State *string `json:"state,omitempty"`
+ Zip *string `json:"zip,omitempty"`
+ Country *string `json:"country,omitempty"`
+ Phone *string `json:"phone,omitempty"`
+ Locale *string `json:"locale,omitempty"`
+ VatNumber *string `json:"vat_number,omitempty"`
+ TaxExempt *bool `json:"tax_exempt,omitempty"`
+ TaxExemptReason *string `json:"tax_exempt_reason,omitempty"`
// (Optional) A set of key/value pairs representing custom fields and their values. Metafields will be created “on-the-fly” in your site for a given key, if they have not been created yet.
- Metafields map[string]string `json:"metafields,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Metafields map[string]string `json:"metafields,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PayerAttributes.
@@ -38,13 +38,17 @@ type PayerAttributes struct {
func (p PayerAttributes) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "locale", "vat_number", "tax_exempt", "tax_exempt_reason", "metafields"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PayerAttributes object to a map representation for JSON marshaling.
func (p PayerAttributes) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.FirstName != nil {
structMap["first_name"] = p.FirstName
}
@@ -110,12 +114,12 @@ func (p *PayerAttributes) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "locale", "vat_number", "tax_exempt", "tax_exempt_reason", "metafields")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "locale", "vat_number", "tax_exempt", "tax_exempt_reason", "metafields")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.FirstName = temp.FirstName
p.LastName = temp.LastName
p.Email = temp.Email
diff --git a/models/payer_error.go b/models/payer_error.go
index 32b5f373..8e5ea889 100644
--- a/models/payer_error.go
+++ b/models/payer_error.go
@@ -11,10 +11,10 @@ import (
// PayerError represents a PayerError struct.
type PayerError struct {
- LastName []string `json:"last_name,omitempty"`
- FirstName []string `json:"first_name,omitempty"`
- Email []string `json:"email,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ LastName []string `json:"last_name,omitempty"`
+ FirstName []string `json:"first_name,omitempty"`
+ Email []string `json:"email,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PayerError.
@@ -22,13 +22,17 @@ type PayerError struct {
func (p PayerError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "last_name", "first_name", "email"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PayerError object to a map representation for JSON marshaling.
func (p PayerError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.LastName != nil {
structMap["last_name"] = p.LastName
}
@@ -49,12 +53,12 @@ func (p *PayerError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "last_name", "first_name", "email")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "last_name", "first_name", "email")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.LastName = temp.LastName
p.FirstName = temp.FirstName
p.Email = temp.Email
diff --git a/models/payment_collection_method_changed.go b/models/payment_collection_method_changed.go
index fd58d5ff..49890a75 100644
--- a/models/payment_collection_method_changed.go
+++ b/models/payment_collection_method_changed.go
@@ -13,9 +13,9 @@ import (
// PaymentCollectionMethodChanged represents a PaymentCollectionMethodChanged struct.
type PaymentCollectionMethodChanged struct {
- PreviousValue string `json:"previous_value"`
- CurrentValue string `json:"current_value"`
- AdditionalProperties map[string]any `json:"_"`
+ PreviousValue string `json:"previous_value"`
+ CurrentValue string `json:"current_value"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaymentCollectionMethodChanged.
@@ -23,13 +23,17 @@ type PaymentCollectionMethodChanged struct {
func (p PaymentCollectionMethodChanged) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "previous_value", "current_value"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaymentCollectionMethodChanged object to a map representation for JSON marshaling.
func (p PaymentCollectionMethodChanged) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["previous_value"] = p.PreviousValue
structMap["current_value"] = p.CurrentValue
return structMap
@@ -47,12 +51,12 @@ func (p *PaymentCollectionMethodChanged) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "previous_value", "current_value")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "previous_value", "current_value")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.PreviousValue = *temp.PreviousValue
p.CurrentValue = *temp.CurrentValue
return nil
diff --git a/models/payment_for_allocation.go b/models/payment_for_allocation.go
index 54d653bf..4ce8d443 100644
--- a/models/payment_for_allocation.go
+++ b/models/payment_for_allocation.go
@@ -12,11 +12,11 @@ import (
// PaymentForAllocation represents a PaymentForAllocation struct.
// Information for captured payment, if applicable
type PaymentForAllocation struct {
- Id *int `json:"id,omitempty"`
- AmountInCents *int64 `json:"amount_in_cents,omitempty"`
- Success *bool `json:"success,omitempty"`
- Memo *string `json:"memo,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ AmountInCents *int64 `json:"amount_in_cents,omitempty"`
+ Success *bool `json:"success,omitempty"`
+ Memo *string `json:"memo,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaymentForAllocation.
@@ -24,13 +24,17 @@ type PaymentForAllocation struct {
func (p PaymentForAllocation) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "id", "amount_in_cents", "success", "memo"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaymentForAllocation object to a map representation for JSON marshaling.
func (p PaymentForAllocation) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Id != nil {
structMap["id"] = p.Id
}
@@ -54,12 +58,12 @@ func (p *PaymentForAllocation) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "amount_in_cents", "success", "memo")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "amount_in_cents", "success", "memo")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Id = temp.Id
p.AmountInCents = temp.AmountInCents
p.Success = temp.Success
diff --git a/models/payment_method_apple_pay.go b/models/payment_method_apple_pay.go
index 4b02c56a..3a95c957 100644
--- a/models/payment_method_apple_pay.go
+++ b/models/payment_method_apple_pay.go
@@ -14,7 +14,7 @@ import (
// PaymentMethodApplePay represents a PaymentMethodApplePay struct.
type PaymentMethodApplePay struct {
Type InvoiceEventPaymentMethod `json:"type"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaymentMethodApplePay.
@@ -22,13 +22,17 @@ type PaymentMethodApplePay struct {
func (p PaymentMethodApplePay) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "type"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaymentMethodApplePay object to a map representation for JSON marshaling.
func (p PaymentMethodApplePay) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["type"] = p.Type
return structMap
}
@@ -45,12 +49,12 @@ func (p *PaymentMethodApplePay) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "type")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "type")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Type = *temp.Type
return nil
}
diff --git a/models/payment_method_bank_account.go b/models/payment_method_bank_account.go
index 93d08a75..ca1f0ef2 100644
--- a/models/payment_method_bank_account.go
+++ b/models/payment_method_bank_account.go
@@ -16,7 +16,7 @@ type PaymentMethodBankAccount struct {
MaskedAccountNumber string `json:"masked_account_number"`
MaskedRoutingNumber string `json:"masked_routing_number"`
Type InvoiceEventPaymentMethod `json:"type"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaymentMethodBankAccount.
@@ -24,13 +24,17 @@ type PaymentMethodBankAccount struct {
func (p PaymentMethodBankAccount) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "masked_account_number", "masked_routing_number", "type"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaymentMethodBankAccount object to a map representation for JSON marshaling.
func (p PaymentMethodBankAccount) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["masked_account_number"] = p.MaskedAccountNumber
structMap["masked_routing_number"] = p.MaskedRoutingNumber
structMap["type"] = p.Type
@@ -49,12 +53,12 @@ func (p *PaymentMethodBankAccount) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "masked_account_number", "masked_routing_number", "type")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "masked_account_number", "masked_routing_number", "type")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.MaskedAccountNumber = *temp.MaskedAccountNumber
p.MaskedRoutingNumber = *temp.MaskedRoutingNumber
p.Type = *temp.Type
diff --git a/models/payment_method_credit_card.go b/models/payment_method_credit_card.go
index d9320175..b7fa8577 100644
--- a/models/payment_method_credit_card.go
+++ b/models/payment_method_credit_card.go
@@ -18,7 +18,7 @@ type PaymentMethodCreditCard struct {
LastFour Optional[string] `json:"last_four"`
MaskedCardNumber string `json:"masked_card_number"`
Type InvoiceEventPaymentMethod `json:"type"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaymentMethodCreditCard.
@@ -26,13 +26,17 @@ type PaymentMethodCreditCard struct {
func (p PaymentMethodCreditCard) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "card_brand", "card_expiration", "last_four", "masked_card_number", "type"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaymentMethodCreditCard object to a map representation for JSON marshaling.
func (p PaymentMethodCreditCard) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["card_brand"] = p.CardBrand
if p.CardExpiration != nil {
structMap["card_expiration"] = p.CardExpiration
@@ -61,12 +65,12 @@ func (p *PaymentMethodCreditCard) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "card_brand", "card_expiration", "last_four", "masked_card_number", "type")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "card_brand", "card_expiration", "last_four", "masked_card_number", "type")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.CardBrand = *temp.CardBrand
p.CardExpiration = temp.CardExpiration
p.LastFour = temp.LastFour
diff --git a/models/payment_method_external.go b/models/payment_method_external.go
index 96b4c7f7..f4227112 100644
--- a/models/payment_method_external.go
+++ b/models/payment_method_external.go
@@ -17,7 +17,7 @@ type PaymentMethodExternal struct {
Kind string `json:"kind"`
Memo *string `json:"memo"`
Type InvoiceEventPaymentMethod `json:"type"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaymentMethodExternal.
@@ -25,13 +25,17 @@ type PaymentMethodExternal struct {
func (p PaymentMethodExternal) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "details", "kind", "memo", "type"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaymentMethodExternal object to a map representation for JSON marshaling.
func (p PaymentMethodExternal) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Details != nil {
structMap["details"] = p.Details
} else {
@@ -59,12 +63,12 @@ func (p *PaymentMethodExternal) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "details", "kind", "memo", "type")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "details", "kind", "memo", "type")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Details = temp.Details
p.Kind = *temp.Kind
p.Memo = temp.Memo
diff --git a/models/payment_method_paypal.go b/models/payment_method_paypal.go
index d62e50cc..5a783561 100644
--- a/models/payment_method_paypal.go
+++ b/models/payment_method_paypal.go
@@ -15,7 +15,7 @@ import (
type PaymentMethodPaypal struct {
Email string `json:"email"`
Type InvoiceEventPaymentMethod `json:"type"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaymentMethodPaypal.
@@ -23,13 +23,17 @@ type PaymentMethodPaypal struct {
func (p PaymentMethodPaypal) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "email", "type"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaymentMethodPaypal object to a map representation for JSON marshaling.
func (p PaymentMethodPaypal) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["email"] = p.Email
structMap["type"] = p.Type
return structMap
@@ -47,12 +51,12 @@ func (p *PaymentMethodPaypal) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "email", "type")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "email", "type")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Email = *temp.Email
p.Type = *temp.Type
return nil
diff --git a/models/payment_profile_attributes.go b/models/payment_profile_attributes.go
index 651d5d3c..44aca146 100644
--- a/models/payment_profile_attributes.go
+++ b/models/payment_profile_attributes.go
@@ -57,7 +57,7 @@ type PaymentProfileAttributes struct {
Cvv *string `json:"cvv,omitempty"`
// (Optional, used only for Subscription Import) If you have the last 4 digits of the credit card number, you may supply them here so that we may create a masked card number (i.e. XXXX-XXXX-XXXX-1234) for display in the UI. Last 4 digits are required for refunds in Auth.Net.
LastFour *string `json:"last_four,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaymentProfileAttributes.
@@ -65,13 +65,17 @@ type PaymentProfileAttributes struct {
func (p PaymentProfileAttributes) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "chargify_token", "id", "payment_type", "first_name", "last_name", "masked_card_number", "full_number", "card_type", "expiration_month", "expiration_year", "billing_address", "billing_address_2", "billing_city", "billing_state", "billing_country", "billing_zip", "current_vault", "vault_token", "customer_vault_token", "customer_id", "paypal_email", "payment_method_nonce", "gateway_handle", "cvv", "last_four"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaymentProfileAttributes object to a map representation for JSON marshaling.
func (p PaymentProfileAttributes) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.ChargifyToken != nil {
structMap["chargify_token"] = p.ChargifyToken
}
@@ -162,12 +166,12 @@ func (p *PaymentProfileAttributes) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "chargify_token", "id", "payment_type", "first_name", "last_name", "masked_card_number", "full_number", "card_type", "expiration_month", "expiration_year", "billing_address", "billing_address_2", "billing_city", "billing_state", "billing_country", "billing_zip", "current_vault", "vault_token", "customer_vault_token", "customer_id", "paypal_email", "payment_method_nonce", "gateway_handle", "cvv", "last_four")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "chargify_token", "id", "payment_type", "first_name", "last_name", "masked_card_number", "full_number", "card_type", "expiration_month", "expiration_year", "billing_address", "billing_address_2", "billing_city", "billing_state", "billing_country", "billing_zip", "current_vault", "vault_token", "customer_vault_token", "customer_id", "paypal_email", "payment_method_nonce", "gateway_handle", "cvv", "last_four")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.ChargifyToken = temp.ChargifyToken
p.Id = temp.Id
p.PaymentType = temp.PaymentType
diff --git a/models/payment_profile_response.go b/models/payment_profile_response.go
index b6eb86e5..dd43e6d5 100644
--- a/models/payment_profile_response.go
+++ b/models/payment_profile_response.go
@@ -13,8 +13,8 @@ import (
// PaymentProfileResponse represents a PaymentProfileResponse struct.
type PaymentProfileResponse struct {
- PaymentProfile PaymentProfile `json:"payment_profile"`
- AdditionalProperties map[string]any `json:"_"`
+ PaymentProfile PaymentProfile `json:"payment_profile"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaymentProfileResponse.
@@ -22,13 +22,17 @@ type PaymentProfileResponse struct {
func (p PaymentProfileResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "payment_profile"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaymentProfileResponse object to a map representation for JSON marshaling.
func (p PaymentProfileResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["payment_profile"] = p.PaymentProfile.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (p *PaymentProfileResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payment_profile")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payment_profile")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.PaymentProfile = *temp.PaymentProfile
return nil
}
diff --git a/models/payment_related_events.go b/models/payment_related_events.go
index f254c4e1..7e4a3025 100644
--- a/models/payment_related_events.go
+++ b/models/payment_related_events.go
@@ -13,9 +13,9 @@ import (
// PaymentRelatedEvents represents a PaymentRelatedEvents struct.
type PaymentRelatedEvents struct {
- ProductId int `json:"product_id"`
- AccountTransactionId int `json:"account_transaction_id"`
- AdditionalProperties map[string]any `json:"_"`
+ ProductId int `json:"product_id"`
+ AccountTransactionId int `json:"account_transaction_id"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaymentRelatedEvents.
@@ -23,13 +23,17 @@ type PaymentRelatedEvents struct {
func (p PaymentRelatedEvents) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "product_id", "account_transaction_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaymentRelatedEvents object to a map representation for JSON marshaling.
func (p PaymentRelatedEvents) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["product_id"] = p.ProductId
structMap["account_transaction_id"] = p.AccountTransactionId
return structMap
@@ -47,12 +51,12 @@ func (p *PaymentRelatedEvents) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product_id", "account_transaction_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product_id", "account_transaction_id")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.ProductId = *temp.ProductId
p.AccountTransactionId = *temp.AccountTransactionId
return nil
diff --git a/models/paypal_payment_profile.go b/models/paypal_payment_profile.go
index ee587311..f0892dad 100644
--- a/models/paypal_payment_profile.go
+++ b/models/paypal_payment_profile.go
@@ -14,35 +14,35 @@ import (
// PaypalPaymentProfile represents a PaypalPaymentProfile struct.
type PaypalPaymentProfile struct {
// The Chargify-assigned ID of the stored PayPal payment profile.
- Id *int `json:"id,omitempty"`
+ Id *int `json:"id,omitempty"`
// The first name of the PayPal account holder
- FirstName *string `json:"first_name,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
// The last name of the PayPal account holder
- LastName *string `json:"last_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
// The Chargify-assigned id for the customer record to which the PayPal account belongs
- CustomerId *int `json:"customer_id,omitempty"`
+ CustomerId *int `json:"customer_id,omitempty"`
// The vault that stores the payment profile with the provided vault_token.
- CurrentVault *PayPalVault `json:"current_vault,omitempty"`
+ CurrentVault *PayPalVault `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"`
// The current billing street address for the PayPal account
- BillingAddress Optional[string] `json:"billing_address"`
+ BillingAddress Optional[string] `json:"billing_address"`
// The current billing address city for the PayPal account
- BillingCity Optional[string] `json:"billing_city"`
+ BillingCity Optional[string] `json:"billing_city"`
// The current billing address state for the PayPal account
- BillingState Optional[string] `json:"billing_state"`
+ BillingState Optional[string] `json:"billing_state"`
// The current billing address zip code for the PayPal account
- BillingZip Optional[string] `json:"billing_zip"`
+ BillingZip Optional[string] `json:"billing_zip"`
// The current billing address country for the PayPal account
- BillingCountry Optional[string] `json:"billing_country"`
- CustomerVaultToken Optional[string] `json:"customer_vault_token"`
+ BillingCountry Optional[string] `json:"billing_country"`
+ CustomerVaultToken Optional[string] `json:"customer_vault_token"`
// The current billing street address, second line, for the PayPal account
- BillingAddress2 Optional[string] `json:"billing_address_2"`
- PaymentType PaymentType `json:"payment_type"`
- SiteGatewaySettingId Optional[int] `json:"site_gateway_setting_id"`
- GatewayHandle Optional[string] `json:"gateway_handle"`
- PaypalEmail *string `json:"paypal_email,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ BillingAddress2 Optional[string] `json:"billing_address_2"`
+ PaymentType PaymentType `json:"payment_type"`
+ SiteGatewaySettingId Optional[int] `json:"site_gateway_setting_id"`
+ GatewayHandle Optional[string] `json:"gateway_handle"`
+ PaypalEmail *string `json:"paypal_email,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PaypalPaymentProfile.
@@ -50,13 +50,17 @@ type PaypalPaymentProfile struct {
func (p PaypalPaymentProfile) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "id", "first_name", "last_name", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "payment_type", "site_gateway_setting_id", "gateway_handle", "paypal_email"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PaypalPaymentProfile object to a map representation for JSON marshaling.
func (p PaypalPaymentProfile) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Id != nil {
structMap["id"] = p.Id
}
@@ -157,12 +161,12 @@ func (p *PaypalPaymentProfile) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "first_name", "last_name", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "payment_type", "site_gateway_setting_id", "gateway_handle", "paypal_email")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "first_name", "last_name", "customer_id", "current_vault", "vault_token", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "customer_vault_token", "billing_address_2", "payment_type", "site_gateway_setting_id", "gateway_handle", "paypal_email")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Id = temp.Id
p.FirstName = temp.FirstName
p.LastName = temp.LastName
diff --git a/models/pending_cancellation_change.go b/models/pending_cancellation_change.go
index 3cb64a02..9e5ef899 100644
--- a/models/pending_cancellation_change.go
+++ b/models/pending_cancellation_change.go
@@ -15,9 +15,9 @@ import (
// PendingCancellationChange represents a PendingCancellationChange struct.
type PendingCancellationChange struct {
- CancellationState string `json:"cancellation_state"`
- CancelsAt time.Time `json:"cancels_at"`
- AdditionalProperties map[string]any `json:"_"`
+ CancellationState string `json:"cancellation_state"`
+ CancelsAt time.Time `json:"cancels_at"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PendingCancellationChange.
@@ -25,13 +25,17 @@ type PendingCancellationChange struct {
func (p PendingCancellationChange) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "cancellation_state", "cancels_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PendingCancellationChange object to a map representation for JSON marshaling.
func (p PendingCancellationChange) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["cancellation_state"] = p.CancellationState
structMap["cancels_at"] = p.CancelsAt.Format(time.RFC3339)
return structMap
@@ -49,12 +53,12 @@ func (p *PendingCancellationChange) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "cancellation_state", "cancels_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "cancellation_state", "cancels_at")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.CancellationState = *temp.CancellationState
CancelsAtVal, err := time.Parse(time.RFC3339, *temp.CancelsAt)
if err != nil {
diff --git a/models/portal_management_link.go b/models/portal_management_link.go
index 1e0919ec..8107cf15 100644
--- a/models/portal_management_link.go
+++ b/models/portal_management_link.go
@@ -13,13 +13,13 @@ import (
// PortalManagementLink represents a PortalManagementLink struct.
type PortalManagementLink struct {
- Url *string `json:"url,omitempty"`
- FetchCount *int `json:"fetch_count,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- NewLinkAvailableAt *time.Time `json:"new_link_available_at,omitempty"`
- ExpiresAt *time.Time `json:"expires_at,omitempty"`
- LastInviteSentAt Optional[time.Time] `json:"last_invite_sent_at"`
- AdditionalProperties map[string]any `json:"_"`
+ Url *string `json:"url,omitempty"`
+ FetchCount *int `json:"fetch_count,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ NewLinkAvailableAt *time.Time `json:"new_link_available_at,omitempty"`
+ ExpiresAt *time.Time `json:"expires_at,omitempty"`
+ LastInviteSentAt Optional[time.Time] `json:"last_invite_sent_at"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PortalManagementLink.
@@ -27,13 +27,17 @@ type PortalManagementLink struct {
func (p PortalManagementLink) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "url", "fetch_count", "created_at", "new_link_available_at", "expires_at", "last_invite_sent_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PortalManagementLink object to a map representation for JSON marshaling.
func (p PortalManagementLink) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Url != nil {
structMap["url"] = p.Url
}
@@ -72,12 +76,12 @@ func (p *PortalManagementLink) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "url", "fetch_count", "created_at", "new_link_available_at", "expires_at", "last_invite_sent_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "url", "fetch_count", "created_at", "new_link_available_at", "expires_at", "last_invite_sent_at")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Url = temp.Url
p.FetchCount = temp.FetchCount
if temp.CreatedAt != nil {
diff --git a/models/prepaid_component_price_point.go b/models/prepaid_component_price_point.go
deleted file mode 100644
index 3f5b8d14..00000000
--- a/models/prepaid_component_price_point.go
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-Package advancedbilling
-
-This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
-*/
-package models
-
-import (
- "encoding/json"
-)
-
-// PrepaidComponentPricePoint represents a PrepaidComponentPricePoint struct.
-type PrepaidComponentPricePoint struct {
- 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"`
- Prices []Price `json:"prices,omitempty"`
- OveragePricing *OveragePricing `json:"overage_pricing,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for PrepaidComponentPricePoint.
-// It customizes the JSON marshaling process for PrepaidComponentPricePoint objects.
-func (p PrepaidComponentPricePoint) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(p.toMap())
-}
-
-// toMap converts the PrepaidComponentPricePoint object to a map representation for JSON marshaling.
-func (p PrepaidComponentPricePoint) toMap() map[string]any {
- structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
- if p.Name != nil {
- structMap["name"] = p.Name
- }
- if p.Handle != nil {
- structMap["handle"] = p.Handle
- }
- if p.PricingScheme != nil {
- structMap["pricing_scheme"] = p.PricingScheme
- }
- if p.Prices != nil {
- structMap["prices"] = p.Prices
- }
- if p.OveragePricing != nil {
- structMap["overage_pricing"] = p.OveragePricing.toMap()
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for PrepaidComponentPricePoint.
-// It customizes the JSON unmarshaling process for PrepaidComponentPricePoint objects.
-func (p *PrepaidComponentPricePoint) UnmarshalJSON(input []byte) error {
- var temp tempPrepaidComponentPricePoint
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "handle", "pricing_scheme", "prices", "overage_pricing")
- if err != nil {
- return err
- }
-
- p.AdditionalProperties = additionalProperties
- p.Name = temp.Name
- p.Handle = temp.Handle
- p.PricingScheme = temp.PricingScheme
- p.Prices = temp.Prices
- p.OveragePricing = temp.OveragePricing
- return nil
-}
-
-// tempPrepaidComponentPricePoint is a temporary struct used for validating the fields of PrepaidComponentPricePoint.
-type tempPrepaidComponentPricePoint struct {
- Name *string `json:"name,omitempty"`
- Handle *string `json:"handle,omitempty"`
- PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
- Prices []Price `json:"prices,omitempty"`
- OveragePricing *OveragePricing `json:"overage_pricing,omitempty"`
-}
diff --git a/models/prepaid_configuration.go b/models/prepaid_configuration.go
index ef919e01..933e72e0 100644
--- a/models/prepaid_configuration.go
+++ b/models/prepaid_configuration.go
@@ -11,12 +11,12 @@ import (
// PrepaidConfiguration represents a PrepaidConfiguration struct.
type PrepaidConfiguration struct {
- Id *int `json:"id,omitempty"`
- InitialFundingAmountInCents *int64 `json:"initial_funding_amount_in_cents,omitempty"`
- ReplenishToAmountInCents *int64 `json:"replenish_to_amount_in_cents,omitempty"`
- AutoReplenish *bool `json:"auto_replenish,omitempty"`
- ReplenishThresholdAmountInCents *int64 `json:"replenish_threshold_amount_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ InitialFundingAmountInCents *int64 `json:"initial_funding_amount_in_cents,omitempty"`
+ ReplenishToAmountInCents *int64 `json:"replenish_to_amount_in_cents,omitempty"`
+ AutoReplenish *bool `json:"auto_replenish,omitempty"`
+ ReplenishThresholdAmountInCents *int64 `json:"replenish_threshold_amount_in_cents,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PrepaidConfiguration.
@@ -24,13 +24,17 @@ type PrepaidConfiguration struct {
func (p PrepaidConfiguration) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "id", "initial_funding_amount_in_cents", "replenish_to_amount_in_cents", "auto_replenish", "replenish_threshold_amount_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PrepaidConfiguration object to a map representation for JSON marshaling.
func (p PrepaidConfiguration) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Id != nil {
structMap["id"] = p.Id
}
@@ -57,12 +61,12 @@ func (p *PrepaidConfiguration) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "initial_funding_amount_in_cents", "replenish_to_amount_in_cents", "auto_replenish", "replenish_threshold_amount_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "initial_funding_amount_in_cents", "replenish_to_amount_in_cents", "auto_replenish", "replenish_threshold_amount_in_cents")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Id = temp.Id
p.InitialFundingAmountInCents = temp.InitialFundingAmountInCents
p.ReplenishToAmountInCents = temp.ReplenishToAmountInCents
diff --git a/models/prepaid_configuration_response.go b/models/prepaid_configuration_response.go
index 87ba87be..e5ee055c 100644
--- a/models/prepaid_configuration_response.go
+++ b/models/prepaid_configuration_response.go
@@ -13,8 +13,8 @@ import (
// PrepaidConfigurationResponse represents a PrepaidConfigurationResponse struct.
type PrepaidConfigurationResponse struct {
- PrepaidConfiguration PrepaidConfiguration `json:"prepaid_configuration"`
- AdditionalProperties map[string]any `json:"_"`
+ PrepaidConfiguration PrepaidConfiguration `json:"prepaid_configuration"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PrepaidConfigurationResponse.
@@ -22,13 +22,17 @@ type PrepaidConfigurationResponse struct {
func (p PrepaidConfigurationResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "prepaid_configuration"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PrepaidConfigurationResponse object to a map representation for JSON marshaling.
func (p PrepaidConfigurationResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["prepaid_configuration"] = p.PrepaidConfiguration.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (p *PrepaidConfigurationResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prepaid_configuration")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prepaid_configuration")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.PrepaidConfiguration = *temp.PrepaidConfiguration
return nil
}
diff --git a/models/prepaid_product_price_point_filter.go b/models/prepaid_product_price_point_filter.go
index 829217da..4ae4b20d 100644
--- a/models/prepaid_product_price_point_filter.go
+++ b/models/prepaid_product_price_point_filter.go
@@ -14,8 +14,8 @@ import (
// PrepaidProductPricePointFilter represents a PrepaidProductPricePointFilter struct.
type PrepaidProductPricePointFilter struct {
// Passed as a parameter to list methods to return only non null values.
- ProductPricePointId string `json:"product_price_point_id"`
- AdditionalProperties map[string]any `json:"_"`
+ ProductPricePointId string `json:"product_price_point_id"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PrepaidProductPricePointFilter.
@@ -23,13 +23,17 @@ type PrepaidProductPricePointFilter struct {
func (p PrepaidProductPricePointFilter) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "product_price_point_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PrepaidProductPricePointFilter object to a map representation for JSON marshaling.
func (p PrepaidProductPricePointFilter) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["product_price_point_id"] = p.ProductPricePointId
return structMap
}
@@ -46,12 +50,12 @@ func (p *PrepaidProductPricePointFilter) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product_price_point_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product_price_point_id")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.ProductPricePointId = *temp.ProductPricePointId
return nil
}
diff --git a/models/prepaid_subscription_balance_changed.go b/models/prepaid_subscription_balance_changed.go
index d1eff58a..cc554635 100644
--- a/models/prepaid_subscription_balance_changed.go
+++ b/models/prepaid_subscription_balance_changed.go
@@ -13,11 +13,11 @@ import (
// PrepaidSubscriptionBalanceChanged represents a PrepaidSubscriptionBalanceChanged struct.
type PrepaidSubscriptionBalanceChanged struct {
- Reason string `json:"reason"`
- CurrentAccountBalanceInCents int64 `json:"current_account_balance_in_cents"`
- PrepaymentAccountBalanceInCents int64 `json:"prepayment_account_balance_in_cents"`
- CurrentUsageAmountInCents int64 `json:"current_usage_amount_in_cents"`
- AdditionalProperties map[string]any `json:"_"`
+ Reason string `json:"reason"`
+ CurrentAccountBalanceInCents int64 `json:"current_account_balance_in_cents"`
+ PrepaymentAccountBalanceInCents int64 `json:"prepayment_account_balance_in_cents"`
+ CurrentUsageAmountInCents int64 `json:"current_usage_amount_in_cents"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PrepaidSubscriptionBalanceChanged.
@@ -25,13 +25,17 @@ type PrepaidSubscriptionBalanceChanged struct {
func (p PrepaidSubscriptionBalanceChanged) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "reason", "current_account_balance_in_cents", "prepayment_account_balance_in_cents", "current_usage_amount_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PrepaidSubscriptionBalanceChanged object to a map representation for JSON marshaling.
func (p PrepaidSubscriptionBalanceChanged) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["reason"] = p.Reason
structMap["current_account_balance_in_cents"] = p.CurrentAccountBalanceInCents
structMap["prepayment_account_balance_in_cents"] = p.PrepaymentAccountBalanceInCents
@@ -51,12 +55,12 @@ func (p *PrepaidSubscriptionBalanceChanged) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "reason", "current_account_balance_in_cents", "prepayment_account_balance_in_cents", "current_usage_amount_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "reason", "current_account_balance_in_cents", "prepayment_account_balance_in_cents", "current_usage_amount_in_cents")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Reason = *temp.Reason
p.CurrentAccountBalanceInCents = *temp.CurrentAccountBalanceInCents
p.PrepaymentAccountBalanceInCents = *temp.PrepaymentAccountBalanceInCents
diff --git a/models/prepaid_usage.go b/models/prepaid_usage.go
index 9e4d5f72..1899d781 100644
--- a/models/prepaid_usage.go
+++ b/models/prepaid_usage.go
@@ -23,7 +23,7 @@ type PrepaidUsage struct {
ComponentHandle string `json:"component_handle"`
Memo string `json:"memo"`
AllocationDetails []PrepaidUsageAllocationDetail `json:"allocation_details"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PrepaidUsage.
@@ -31,13 +31,17 @@ type PrepaidUsage struct {
func (p PrepaidUsage) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "previous_unit_balance", "previous_overage_unit_balance", "new_unit_balance", "new_overage_unit_balance", "usage_quantity", "overage_usage_quantity", "component_id", "component_handle", "memo", "allocation_details"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PrepaidUsage object to a map representation for JSON marshaling.
func (p PrepaidUsage) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["previous_unit_balance"] = p.PreviousUnitBalance
structMap["previous_overage_unit_balance"] = p.PreviousOverageUnitBalance
structMap["new_unit_balance"] = p.NewUnitBalance
@@ -63,12 +67,12 @@ func (p *PrepaidUsage) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "previous_unit_balance", "previous_overage_unit_balance", "new_unit_balance", "new_overage_unit_balance", "usage_quantity", "overage_usage_quantity", "component_id", "component_handle", "memo", "allocation_details")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "previous_unit_balance", "previous_overage_unit_balance", "new_unit_balance", "new_overage_unit_balance", "usage_quantity", "overage_usage_quantity", "component_id", "component_handle", "memo", "allocation_details")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.PreviousUnitBalance = *temp.PreviousUnitBalance
p.PreviousOverageUnitBalance = *temp.PreviousOverageUnitBalance
p.NewUnitBalance = *temp.NewUnitBalance
diff --git a/models/prepaid_usage_allocation_detail.go b/models/prepaid_usage_allocation_detail.go
index d71ff1e8..60f54c4e 100644
--- a/models/prepaid_usage_allocation_detail.go
+++ b/models/prepaid_usage_allocation_detail.go
@@ -11,10 +11,10 @@ import (
// PrepaidUsageAllocationDetail represents a PrepaidUsageAllocationDetail struct.
type PrepaidUsageAllocationDetail struct {
- AllocationId *int `json:"allocation_id,omitempty"`
- ChargeId *int `json:"charge_id,omitempty"`
- UsageQuantity *int `json:"usage_quantity,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AllocationId *int `json:"allocation_id,omitempty"`
+ ChargeId *int `json:"charge_id,omitempty"`
+ UsageQuantity *int `json:"usage_quantity,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PrepaidUsageAllocationDetail.
@@ -22,13 +22,17 @@ type PrepaidUsageAllocationDetail struct {
func (p PrepaidUsageAllocationDetail) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "allocation_id", "charge_id", "usage_quantity"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PrepaidUsageAllocationDetail object to a map representation for JSON marshaling.
func (p PrepaidUsageAllocationDetail) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.AllocationId != nil {
structMap["allocation_id"] = p.AllocationId
}
@@ -49,12 +53,12 @@ func (p *PrepaidUsageAllocationDetail) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "allocation_id", "charge_id", "usage_quantity")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "allocation_id", "charge_id", "usage_quantity")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.AllocationId = temp.AllocationId
p.ChargeId = temp.ChargeId
p.UsageQuantity = temp.UsageQuantity
diff --git a/models/prepaid_usage_component.go b/models/prepaid_usage_component.go
index 18c199b5..4b7b44c9 100644
--- a/models/prepaid_usage_component.go
+++ b/models/prepaid_usage_component.go
@@ -14,46 +14,44 @@ import (
// PrepaidUsageComponent represents a PrepaidUsageComponent struct.
type PrepaidUsageComponent struct {
// A name for this component that is suitable for showing customers and displaying on billing statements, ie. "Minutes".
- Name string `json:"name"`
+ Name string `json:"name"`
// The name of the unit of measurement for the component. It should be singular since it will be automatically pluralized when necessary. i.e. “message”, which may then be shown as “5 messages” on a subscription’s component line-item
- UnitName *string `json:"unit_name,omitempty"`
+ UnitName string `json:"unit_name"`
// A description for the component that will be displayed to the user on the hosted signup page.
- Description *string `json:"description,omitempty"`
+ Description *string `json:"description,omitempty"`
// A unique identifier for your use that can be used to retrieve this component is subsequent requests. Must start with a letter or number and may only contain lowercase letters, numbers, or the characters '.', ':', '-', or '_'.
- Handle *string `json:"handle,omitempty"`
+ Handle *string `json:"handle,omitempty"`
// Boolean flag describing whether a component is taxable or not.
- Taxable *bool `json:"taxable,omitempty"`
+ Taxable *bool `json:"taxable,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"`
+ PricingScheme PricingScheme `json:"pricing_scheme"`
// (Not required for ‘per_unit’ pricing schemes) One or more price brackets. See [Price Bracket Rules](https://maxio.zendesk.com/hc/en-us/articles/24261149166733-Component-Pricing-Schemes#price-bracket-rules) for an overview of how price brackets work for different pricing schemes.
- Prices []Price `json:"prices,omitempty"`
+ Prices []Price `json:"prices,omitempty"`
// The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
// Available values: `full`, `prorated`, `none`.
- UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
+ UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
// The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
// Available values: `full`, `prorated`, `none`.
- DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
- PricePoints []PrepaidComponentPricePoint `json:"price_points,omitempty"`
+ DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
+ PricePoints []CreatePrepaidUsageComponentPricePoint `json:"price_points,omitempty"`
// The amount the customer will be charged per unit when the pricing scheme is “per_unit”. For On/Off Components, this is the amount that the customer will be charged when they turn the component on for the subscription. The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065
- UnitPrice *PrepaidUsageComponentUnitPrice `json:"unit_price,omitempty"`
+ UnitPrice *PrepaidUsageComponentUnitPrice `json:"unit_price,omitempty"`
// A string representing the tax code related to the component type. This is especially important when using the Avalara service to tax based on locale. This attribute has a max length of 10 characters.
- TaxCode *string `json:"tax_code,omitempty"`
+ TaxCode *string `json:"tax_code,omitempty"`
// (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices.
- HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
- // deprecated May 2011 - use unit_price instead
- PriceInCents *string `json:"price_in_cents,omitempty"`
- OveragePricing *OveragePricing `json:"overage_pricing,omitempty"`
+ HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
+ OveragePricing OveragePricing `json:"overage_pricing"`
// Boolean which controls whether or not remaining units should be rolled over to the next period
- RolloverPrepaidRemainder *bool `json:"rollover_prepaid_remainder,omitempty"`
+ RolloverPrepaidRemainder *bool `json:"rollover_prepaid_remainder,omitempty"`
// Boolean which controls whether or not the allocated quantity should be renewed at the beginning of each period
- RenewPrepaidAllocation *bool `json:"renew_prepaid_allocation,omitempty"`
+ RenewPrepaidAllocation *bool `json:"renew_prepaid_allocation,omitempty"`
// (only for prepaid usage components where rollover_prepaid_remainder is true) The number of `expiration_interval_unit`s after which rollover amounts should expire
- ExpirationInterval *float64 `json:"expiration_interval,omitempty"`
- ExpirationIntervalUnit Optional[ExpirationIntervalUnit] `json:"expiration_interval_unit"`
- DisplayOnHostedPage *bool `json:"display_on_hosted_page,omitempty"`
- AllowFractionalQuantities *bool `json:"allow_fractional_quantities,omitempty"`
- PublicSignupPageIds []int `json:"public_signup_page_ids,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ExpirationInterval *float64 `json:"expiration_interval,omitempty"`
+ ExpirationIntervalUnit Optional[ExpirationIntervalUnit] `json:"expiration_interval_unit"`
+ DisplayOnHostedPage *bool `json:"display_on_hosted_page,omitempty"`
+ AllowFractionalQuantities *bool `json:"allow_fractional_quantities,omitempty"`
+ PublicSignupPageIds []int `json:"public_signup_page_ids,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PrepaidUsageComponent.
@@ -61,17 +59,19 @@ type PrepaidUsageComponent struct {
func (p PrepaidUsageComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "upgrade_charge", "downgrade_credit", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "overage_pricing", "rollover_prepaid_remainder", "renew_prepaid_allocation", "expiration_interval", "expiration_interval_unit", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PrepaidUsageComponent object to a map representation for JSON marshaling.
func (p PrepaidUsageComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["name"] = p.Name
- if p.UnitName != nil {
- structMap["unit_name"] = p.UnitName
- }
+ structMap["unit_name"] = p.UnitName
if p.Description != nil {
structMap["description"] = p.Description
}
@@ -81,9 +81,7 @@ func (p PrepaidUsageComponent) toMap() map[string]any {
if p.Taxable != nil {
structMap["taxable"] = p.Taxable
}
- if p.PricingScheme != nil {
- structMap["pricing_scheme"] = p.PricingScheme
- }
+ structMap["pricing_scheme"] = p.PricingScheme
if p.Prices != nil {
structMap["prices"] = p.Prices
}
@@ -113,12 +111,7 @@ func (p PrepaidUsageComponent) toMap() map[string]any {
if p.HideDateRangeOnInvoice != nil {
structMap["hide_date_range_on_invoice"] = p.HideDateRangeOnInvoice
}
- if p.PriceInCents != nil {
- structMap["price_in_cents"] = p.PriceInCents
- }
- if p.OveragePricing != nil {
- structMap["overage_pricing"] = p.OveragePricing.toMap()
- }
+ structMap["overage_pricing"] = p.OveragePricing.toMap()
if p.RolloverPrepaidRemainder != nil {
structMap["rollover_prepaid_remainder"] = p.RolloverPrepaidRemainder
}
@@ -159,18 +152,18 @@ func (p *PrepaidUsageComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "upgrade_charge", "downgrade_credit", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "price_in_cents", "overage_pricing", "rollover_prepaid_remainder", "renew_prepaid_allocation", "expiration_interval", "expiration_interval_unit", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "upgrade_charge", "downgrade_credit", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "overage_pricing", "rollover_prepaid_remainder", "renew_prepaid_allocation", "expiration_interval", "expiration_interval_unit", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Name = *temp.Name
- p.UnitName = temp.UnitName
+ p.UnitName = *temp.UnitName
p.Description = temp.Description
p.Handle = temp.Handle
p.Taxable = temp.Taxable
- p.PricingScheme = temp.PricingScheme
+ p.PricingScheme = *temp.PricingScheme
p.Prices = temp.Prices
p.UpgradeCharge = temp.UpgradeCharge
p.DowngradeCredit = temp.DowngradeCredit
@@ -178,8 +171,7 @@ func (p *PrepaidUsageComponent) UnmarshalJSON(input []byte) error {
p.UnitPrice = temp.UnitPrice
p.TaxCode = temp.TaxCode
p.HideDateRangeOnInvoice = temp.HideDateRangeOnInvoice
- p.PriceInCents = temp.PriceInCents
- p.OveragePricing = temp.OveragePricing
+ p.OveragePricing = *temp.OveragePricing
p.RolloverPrepaidRemainder = temp.RolloverPrepaidRemainder
p.RenewPrepaidAllocation = temp.RenewPrepaidAllocation
p.ExpirationInterval = temp.ExpirationInterval
@@ -192,28 +184,27 @@ func (p *PrepaidUsageComponent) UnmarshalJSON(input []byte) error {
// tempPrepaidUsageComponent is a temporary struct used for validating the fields of PrepaidUsageComponent.
type tempPrepaidUsageComponent struct {
- Name *string `json:"name"`
- UnitName *string `json:"unit_name,omitempty"`
- Description *string `json:"description,omitempty"`
- Handle *string `json:"handle,omitempty"`
- Taxable *bool `json:"taxable,omitempty"`
- PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
- Prices []Price `json:"prices,omitempty"`
- UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
- DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
- PricePoints []PrepaidComponentPricePoint `json:"price_points,omitempty"`
- UnitPrice *PrepaidUsageComponentUnitPrice `json:"unit_price,omitempty"`
- TaxCode *string `json:"tax_code,omitempty"`
- HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
- PriceInCents *string `json:"price_in_cents,omitempty"`
- OveragePricing *OveragePricing `json:"overage_pricing,omitempty"`
- RolloverPrepaidRemainder *bool `json:"rollover_prepaid_remainder,omitempty"`
- RenewPrepaidAllocation *bool `json:"renew_prepaid_allocation,omitempty"`
- ExpirationInterval *float64 `json:"expiration_interval,omitempty"`
- ExpirationIntervalUnit Optional[ExpirationIntervalUnit] `json:"expiration_interval_unit"`
- DisplayOnHostedPage *bool `json:"display_on_hosted_page,omitempty"`
- AllowFractionalQuantities *bool `json:"allow_fractional_quantities,omitempty"`
- PublicSignupPageIds []int `json:"public_signup_page_ids,omitempty"`
+ Name *string `json:"name"`
+ UnitName *string `json:"unit_name"`
+ Description *string `json:"description,omitempty"`
+ Handle *string `json:"handle,omitempty"`
+ Taxable *bool `json:"taxable,omitempty"`
+ PricingScheme *PricingScheme `json:"pricing_scheme"`
+ Prices []Price `json:"prices,omitempty"`
+ UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
+ DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
+ PricePoints []CreatePrepaidUsageComponentPricePoint `json:"price_points,omitempty"`
+ UnitPrice *PrepaidUsageComponentUnitPrice `json:"unit_price,omitempty"`
+ TaxCode *string `json:"tax_code,omitempty"`
+ HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
+ OveragePricing *OveragePricing `json:"overage_pricing"`
+ RolloverPrepaidRemainder *bool `json:"rollover_prepaid_remainder,omitempty"`
+ RenewPrepaidAllocation *bool `json:"renew_prepaid_allocation,omitempty"`
+ ExpirationInterval *float64 `json:"expiration_interval,omitempty"`
+ ExpirationIntervalUnit Optional[ExpirationIntervalUnit] `json:"expiration_interval_unit"`
+ DisplayOnHostedPage *bool `json:"display_on_hosted_page,omitempty"`
+ AllowFractionalQuantities *bool `json:"allow_fractional_quantities,omitempty"`
+ PublicSignupPageIds []int `json:"public_signup_page_ids,omitempty"`
}
func (p *tempPrepaidUsageComponent) validate() error {
@@ -221,6 +212,15 @@ func (p *tempPrepaidUsageComponent) validate() error {
if p.Name == nil {
errs = append(errs, "required field `name` is missing for type `Prepaid Usage Component`")
}
+ if p.UnitName == nil {
+ errs = append(errs, "required field `unit_name` is missing for type `Prepaid Usage Component`")
+ }
+ if p.PricingScheme == nil {
+ errs = append(errs, "required field `pricing_scheme` is missing for type `Prepaid Usage Component`")
+ }
+ if p.OveragePricing == nil {
+ errs = append(errs, "required field `overage_pricing` is missing for type `Prepaid Usage Component`")
+ }
if len(errs) == 0 {
return nil
}
diff --git a/models/prepayment.go b/models/prepayment.go
index 15f5968b..2fbe46cd 100644
--- a/models/prepayment.go
+++ b/models/prepayment.go
@@ -15,18 +15,18 @@ import (
// Prepayment represents a Prepayment struct.
type Prepayment struct {
- Id int `json:"id"`
- SubscriptionId int `json:"subscription_id"`
- AmountInCents int64 `json:"amount_in_cents"`
- RemainingAmountInCents int64 `json:"remaining_amount_in_cents"`
- RefundedAmountInCents *int64 `json:"refunded_amount_in_cents,omitempty"`
- Details *string `json:"details,omitempty"`
- External bool `json:"external"`
- Memo string `json:"memo"`
+ Id int `json:"id"`
+ SubscriptionId int `json:"subscription_id"`
+ AmountInCents int64 `json:"amount_in_cents"`
+ RemainingAmountInCents int64 `json:"remaining_amount_in_cents"`
+ RefundedAmountInCents *int64 `json:"refunded_amount_in_cents,omitempty"`
+ Details *string `json:"details,omitempty"`
+ External bool `json:"external"`
+ Memo string `json:"memo"`
// The payment type of the prepayment.
- PaymentType *PrepaymentMethod `json:"payment_type,omitempty"`
- CreatedAt time.Time `json:"created_at"`
- AdditionalProperties map[string]any `json:"_"`
+ PaymentType *PrepaymentMethod `json:"payment_type,omitempty"`
+ CreatedAt time.Time `json:"created_at"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Prepayment.
@@ -34,13 +34,17 @@ type Prepayment struct {
func (p Prepayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "id", "subscription_id", "amount_in_cents", "remaining_amount_in_cents", "refunded_amount_in_cents", "details", "external", "memo", "payment_type", "created_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the Prepayment object to a map representation for JSON marshaling.
func (p Prepayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["id"] = p.Id
structMap["subscription_id"] = p.SubscriptionId
structMap["amount_in_cents"] = p.AmountInCents
@@ -72,12 +76,12 @@ func (p *Prepayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "subscription_id", "amount_in_cents", "remaining_amount_in_cents", "refunded_amount_in_cents", "details", "external", "memo", "payment_type", "created_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "subscription_id", "amount_in_cents", "remaining_amount_in_cents", "refunded_amount_in_cents", "details", "external", "memo", "payment_type", "created_at")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Id = *temp.Id
p.SubscriptionId = *temp.SubscriptionId
p.AmountInCents = *temp.AmountInCents
diff --git a/models/prepayment_account_balance_changed.go b/models/prepayment_account_balance_changed.go
index 75f5aedf..450416a2 100644
--- a/models/prepayment_account_balance_changed.go
+++ b/models/prepayment_account_balance_changed.go
@@ -13,11 +13,11 @@ import (
// PrepaymentAccountBalanceChanged represents a PrepaymentAccountBalanceChanged struct.
type PrepaymentAccountBalanceChanged struct {
- Reason string `json:"reason"`
- PrepaymentAccountBalanceInCents int64 `json:"prepayment_account_balance_in_cents"`
- PrepaymentBalanceChangeInCents int64 `json:"prepayment_balance_change_in_cents"`
- CurrencyCode string `json:"currency_code"`
- AdditionalProperties map[string]any `json:"_"`
+ Reason string `json:"reason"`
+ PrepaymentAccountBalanceInCents int64 `json:"prepayment_account_balance_in_cents"`
+ PrepaymentBalanceChangeInCents int64 `json:"prepayment_balance_change_in_cents"`
+ CurrencyCode string `json:"currency_code"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PrepaymentAccountBalanceChanged.
@@ -25,13 +25,17 @@ type PrepaymentAccountBalanceChanged struct {
func (p PrepaymentAccountBalanceChanged) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "reason", "prepayment_account_balance_in_cents", "prepayment_balance_change_in_cents", "currency_code"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PrepaymentAccountBalanceChanged object to a map representation for JSON marshaling.
func (p PrepaymentAccountBalanceChanged) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["reason"] = p.Reason
structMap["prepayment_account_balance_in_cents"] = p.PrepaymentAccountBalanceInCents
structMap["prepayment_balance_change_in_cents"] = p.PrepaymentBalanceChangeInCents
@@ -51,12 +55,12 @@ func (p *PrepaymentAccountBalanceChanged) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "reason", "prepayment_account_balance_in_cents", "prepayment_balance_change_in_cents", "currency_code")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "reason", "prepayment_account_balance_in_cents", "prepayment_balance_change_in_cents", "currency_code")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Reason = *temp.Reason
p.PrepaymentAccountBalanceInCents = *temp.PrepaymentAccountBalanceInCents
p.PrepaymentBalanceChangeInCents = *temp.PrepaymentBalanceChangeInCents
diff --git a/models/prepayment_response.go b/models/prepayment_response.go
index 3c559956..7e54b682 100644
--- a/models/prepayment_response.go
+++ b/models/prepayment_response.go
@@ -13,8 +13,8 @@ import (
// PrepaymentResponse represents a PrepaymentResponse struct.
type PrepaymentResponse struct {
- Prepayment Prepayment `json:"prepayment"`
- AdditionalProperties map[string]any `json:"_"`
+ Prepayment Prepayment `json:"prepayment"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PrepaymentResponse.
@@ -22,13 +22,17 @@ type PrepaymentResponse struct {
func (p PrepaymentResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "prepayment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PrepaymentResponse object to a map representation for JSON marshaling.
func (p PrepaymentResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["prepayment"] = p.Prepayment.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (p *PrepaymentResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prepayment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prepayment")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Prepayment = *temp.Prepayment
return nil
}
diff --git a/models/prepayments_response.go b/models/prepayments_response.go
index 19a97262..032a3746 100644
--- a/models/prepayments_response.go
+++ b/models/prepayments_response.go
@@ -11,8 +11,8 @@ import (
// PrepaymentsResponse represents a PrepaymentsResponse struct.
type PrepaymentsResponse struct {
- Prepayments []Prepayment `json:"prepayments,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Prepayments []Prepayment `json:"prepayments,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PrepaymentsResponse.
@@ -20,13 +20,17 @@ type PrepaymentsResponse struct {
func (p PrepaymentsResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "prepayments"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PrepaymentsResponse object to a map representation for JSON marshaling.
func (p PrepaymentsResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Prepayments != nil {
structMap["prepayments"] = p.Prepayments
}
@@ -41,12 +45,12 @@ func (p *PrepaymentsResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prepayments")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prepayments")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Prepayments = temp.Prepayments
return nil
}
diff --git a/models/preview_allocations_request.go b/models/preview_allocations_request.go
index a6fe8868..afb2a4ab 100644
--- a/models/preview_allocations_request.go
+++ b/models/preview_allocations_request.go
@@ -15,16 +15,16 @@ import (
// PreviewAllocationsRequest represents a PreviewAllocationsRequest struct.
type PreviewAllocationsRequest struct {
- Allocations []CreateAllocation `json:"allocations"`
+ Allocations []CreateAllocation `json:"allocations"`
// To calculate proration amounts for a future time. Only within a current subscription period. Only ISO8601 format is supported.
- EffectiveProrationDate *time.Time `json:"effective_proration_date,omitempty"`
+ EffectiveProrationDate *time.Time `json:"effective_proration_date,omitempty"`
// The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
// Available values: `full`, `prorated`, `none`.
- UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
+ UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
// The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
// Available values: `full`, `prorated`, `none`.
- DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
- AdditionalProperties map[string]any `json:"_"`
+ DowngradeCredit Optional[CreditType] `json:"downgrade_credit"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PreviewAllocationsRequest.
@@ -32,13 +32,17 @@ type PreviewAllocationsRequest struct {
func (p PreviewAllocationsRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "allocations", "effective_proration_date", "upgrade_charge", "downgrade_credit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PreviewAllocationsRequest object to a map representation for JSON marshaling.
func (p PreviewAllocationsRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["allocations"] = p.Allocations
if p.EffectiveProrationDate != nil {
structMap["effective_proration_date"] = p.EffectiveProrationDate.Format(DEFAULT_DATE)
@@ -72,12 +76,12 @@ func (p *PreviewAllocationsRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "allocations", "effective_proration_date", "upgrade_charge", "downgrade_credit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "allocations", "effective_proration_date", "upgrade_charge", "downgrade_credit")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Allocations = *temp.Allocations
if temp.EffectiveProrationDate != nil {
EffectiveProrationDateVal, err := time.Parse(DEFAULT_DATE, *temp.EffectiveProrationDate)
diff --git a/models/price.go b/models/price.go
index 2f70e334..ab9d012c 100644
--- a/models/price.go
+++ b/models/price.go
@@ -17,7 +17,7 @@ type Price struct {
EndingQuantity Optional[PriceEndingQuantity] `json:"ending_quantity"`
// The price can contain up to 8 decimal places. i.e. 1.00 or 0.0012 or 0.00000065
UnitPrice PriceUnitPrice `json:"unit_price"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Price.
@@ -25,13 +25,17 @@ type Price struct {
func (p Price) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "starting_quantity", "ending_quantity", "unit_price"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the Price object to a map representation for JSON marshaling.
func (p Price) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["starting_quantity"] = p.StartingQuantity.toMap()
if p.EndingQuantity.IsValueSet() {
if p.EndingQuantity.Value() != nil {
@@ -56,12 +60,12 @@ func (p *Price) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "starting_quantity", "ending_quantity", "unit_price")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "starting_quantity", "ending_quantity", "unit_price")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.StartingQuantity = *temp.StartingQuantity
p.EndingQuantity = temp.EndingQuantity
p.UnitPrice = *temp.UnitPrice
diff --git a/models/product.go b/models/product.go
index c5e0d9a1..69c7830e 100644
--- a/models/product.go
+++ b/models/product.go
@@ -76,7 +76,7 @@ type Product struct {
ItemCategory Optional[string] `json:"item_category"`
ProductPricePointId *int `json:"product_price_point_id,omitempty"`
ProductPricePointHandle Optional[string] `json:"product_price_point_handle"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Product.
@@ -84,13 +84,17 @@ type Product struct {
func (p Product) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "id", "name", "handle", "description", "accounting_code", "request_credit_card", "expiration_interval", "expiration_interval_unit", "created_at", "updated_at", "price_in_cents", "interval", "interval_unit", "initial_charge_in_cents", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "archived_at", "require_credit_card", "return_params", "taxable", "update_return_url", "initial_charge_after_trial", "version_number", "update_return_params", "product_family", "public_signup_pages", "product_price_point_name", "request_billing_address", "require_billing_address", "require_shipping_address", "tax_code", "default_product_price_point_id", "use_site_exchange_rate", "item_category", "product_price_point_id", "product_price_point_handle"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the Product object to a map representation for JSON marshaling.
func (p Product) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Id != nil {
structMap["id"] = p.Id
}
@@ -290,12 +294,12 @@ func (p *Product) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "name", "handle", "description", "accounting_code", "request_credit_card", "expiration_interval", "expiration_interval_unit", "created_at", "updated_at", "price_in_cents", "interval", "interval_unit", "initial_charge_in_cents", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "archived_at", "require_credit_card", "return_params", "taxable", "update_return_url", "initial_charge_after_trial", "version_number", "update_return_params", "product_family", "public_signup_pages", "product_price_point_name", "request_billing_address", "require_billing_address", "require_shipping_address", "tax_code", "default_product_price_point_id", "use_site_exchange_rate", "item_category", "product_price_point_id", "product_price_point_handle")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "name", "handle", "description", "accounting_code", "request_credit_card", "expiration_interval", "expiration_interval_unit", "created_at", "updated_at", "price_in_cents", "interval", "interval_unit", "initial_charge_in_cents", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "archived_at", "require_credit_card", "return_params", "taxable", "update_return_url", "initial_charge_after_trial", "version_number", "update_return_params", "product_family", "public_signup_pages", "product_price_point_name", "request_billing_address", "require_billing_address", "require_shipping_address", "tax_code", "default_product_price_point_id", "use_site_exchange_rate", "item_category", "product_price_point_id", "product_price_point_handle")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Id = temp.Id
p.Name = temp.Name
p.Handle = temp.Handle
diff --git a/models/product_family.go b/models/product_family.go
index b9df32e6..1f2e1300 100644
--- a/models/product_family.go
+++ b/models/product_family.go
@@ -13,14 +13,14 @@ import (
// ProductFamily represents a ProductFamily struct.
type ProductFamily struct {
- Id *int `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- Handle *string `json:"handle,omitempty"`
- AccountingCode Optional[string] `json:"accounting_code"`
- Description Optional[string] `json:"description"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Handle *string `json:"handle,omitempty"`
+ AccountingCode Optional[string] `json:"accounting_code"`
+ Description Optional[string] `json:"description"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ UpdatedAt *time.Time `json:"updated_at,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProductFamily.
@@ -28,13 +28,17 @@ type ProductFamily struct {
func (p ProductFamily) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "id", "name", "handle", "accounting_code", "description", "created_at", "updated_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProductFamily object to a map representation for JSON marshaling.
func (p ProductFamily) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Id != nil {
structMap["id"] = p.Id
}
@@ -75,12 +79,12 @@ func (p *ProductFamily) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "name", "handle", "accounting_code", "description", "created_at", "updated_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "name", "handle", "accounting_code", "description", "created_at", "updated_at")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Id = temp.Id
p.Name = temp.Name
p.Handle = temp.Handle
diff --git a/models/product_family_response.go b/models/product_family_response.go
index d331f063..edd9e8c1 100644
--- a/models/product_family_response.go
+++ b/models/product_family_response.go
@@ -11,8 +11,8 @@ import (
// ProductFamilyResponse represents a ProductFamilyResponse struct.
type ProductFamilyResponse struct {
- ProductFamily *ProductFamily `json:"product_family,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ProductFamily *ProductFamily `json:"product_family,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProductFamilyResponse.
@@ -20,13 +20,17 @@ type ProductFamilyResponse struct {
func (p ProductFamilyResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "product_family"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProductFamilyResponse object to a map representation for JSON marshaling.
func (p ProductFamilyResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.ProductFamily != nil {
structMap["product_family"] = p.ProductFamily.toMap()
}
@@ -41,12 +45,12 @@ func (p *ProductFamilyResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product_family")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product_family")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.ProductFamily = temp.ProductFamily
return nil
}
diff --git a/models/product_price_point.go b/models/product_price_point.go
index 442c1206..8ed22b12 100644
--- a/models/product_price_point.go
+++ b/models/product_price_point.go
@@ -58,7 +58,7 @@ type ProductPricePoint struct {
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"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProductPricePoint.
@@ -66,13 +66,17 @@ type ProductPricePoint struct {
func (p ProductPricePoint) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "id", "name", "handle", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "trial_type", "introductory_offer", "initial_charge_in_cents", "initial_charge_after_trial", "expiration_interval", "expiration_interval_unit", "product_id", "archived_at", "created_at", "updated_at", "use_site_exchange_rate", "type", "tax_included", "subscription_id", "currency_prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProductPricePoint object to a map representation for JSON marshaling.
func (p ProductPricePoint) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Id != nil {
structMap["id"] = p.Id
}
@@ -205,12 +209,12 @@ func (p *ProductPricePoint) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "name", "handle", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "trial_type", "introductory_offer", "initial_charge_in_cents", "initial_charge_after_trial", "expiration_interval", "expiration_interval_unit", "product_id", "archived_at", "created_at", "updated_at", "use_site_exchange_rate", "type", "tax_included", "subscription_id", "currency_prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "name", "handle", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "trial_type", "introductory_offer", "initial_charge_in_cents", "initial_charge_after_trial", "expiration_interval", "expiration_interval_unit", "product_id", "archived_at", "created_at", "updated_at", "use_site_exchange_rate", "type", "tax_included", "subscription_id", "currency_prices")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Id = temp.Id
p.Name = temp.Name
p.Handle = temp.Handle
diff --git a/models/product_price_point_errors.go b/models/product_price_point_errors.go
index e63c2f51..1c23f467 100644
--- a/models/product_price_point_errors.go
+++ b/models/product_price_point_errors.go
@@ -11,13 +11,13 @@ import (
// ProductPricePointErrors represents a ProductPricePointErrors struct.
type ProductPricePointErrors struct {
- PricePoint *string `json:"price_point,omitempty"`
- Interval []string `json:"interval,omitempty"`
- IntervalUnit []string `json:"interval_unit,omitempty"`
- Name []string `json:"name,omitempty"`
- Price []string `json:"price,omitempty"`
- PriceInCents []string `json:"price_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PricePoint *string `json:"price_point,omitempty"`
+ Interval []string `json:"interval,omitempty"`
+ IntervalUnit []string `json:"interval_unit,omitempty"`
+ Name []string `json:"name,omitempty"`
+ Price []string `json:"price,omitempty"`
+ PriceInCents []string `json:"price_in_cents,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProductPricePointErrors.
@@ -25,13 +25,17 @@ type ProductPricePointErrors struct {
func (p ProductPricePointErrors) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "price_point", "interval", "interval_unit", "name", "price", "price_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProductPricePointErrors object to a map representation for JSON marshaling.
func (p ProductPricePointErrors) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.PricePoint != nil {
structMap["price_point"] = p.PricePoint
}
@@ -61,12 +65,12 @@ func (p *ProductPricePointErrors) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_point", "interval", "interval_unit", "name", "price", "price_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_point", "interval", "interval_unit", "name", "price", "price_in_cents")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.PricePoint = temp.PricePoint
p.Interval = temp.Interval
p.IntervalUnit = temp.IntervalUnit
diff --git a/models/product_price_point_response.go b/models/product_price_point_response.go
index 62f5a4a4..41bdcad0 100644
--- a/models/product_price_point_response.go
+++ b/models/product_price_point_response.go
@@ -13,8 +13,8 @@ import (
// ProductPricePointResponse represents a ProductPricePointResponse struct.
type ProductPricePointResponse struct {
- PricePoint ProductPricePoint `json:"price_point"`
- AdditionalProperties map[string]any `json:"_"`
+ PricePoint ProductPricePoint `json:"price_point"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProductPricePointResponse.
@@ -22,13 +22,17 @@ type ProductPricePointResponse struct {
func (p ProductPricePointResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "price_point"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProductPricePointResponse object to a map representation for JSON marshaling.
func (p ProductPricePointResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["price_point"] = p.PricePoint.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (p *ProductPricePointResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_point")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_point")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.PricePoint = *temp.PricePoint
return nil
}
diff --git a/models/product_response.go b/models/product_response.go
index ed7d46e3..8235691b 100644
--- a/models/product_response.go
+++ b/models/product_response.go
@@ -13,8 +13,8 @@ import (
// ProductResponse represents a ProductResponse struct.
type ProductResponse struct {
- Product Product `json:"product"`
- AdditionalProperties map[string]any `json:"_"`
+ Product Product `json:"product"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProductResponse.
@@ -22,13 +22,17 @@ type ProductResponse struct {
func (p ProductResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "product"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProductResponse object to a map representation for JSON marshaling.
func (p ProductResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["product"] = p.Product.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (p *ProductResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Product = *temp.Product
return nil
}
diff --git a/models/proforma_error.go b/models/proforma_error.go
index 9bcaa493..685aff0e 100644
--- a/models/proforma_error.go
+++ b/models/proforma_error.go
@@ -12,8 +12,8 @@ import (
// ProformaError represents a ProformaError struct.
type ProformaError struct {
// The error is base if it is not directly associated with a single attribute.
- Subscription *BaseStringError `json:"subscription,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Subscription *BaseStringError `json:"subscription,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProformaError.
@@ -21,13 +21,17 @@ type ProformaError struct {
func (p ProformaError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "subscription"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProformaError object to a map representation for JSON marshaling.
func (p ProformaError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Subscription != nil {
structMap["subscription"] = p.Subscription.toMap()
}
@@ -42,12 +46,12 @@ func (p *ProformaError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Subscription = temp.Subscription
return nil
}
diff --git a/models/proforma_invoice.go b/models/proforma_invoice.go
index 75a7ae9b..0173cd08 100644
--- a/models/proforma_invoice.go
+++ b/models/proforma_invoice.go
@@ -59,7 +59,7 @@ type ProformaInvoice struct {
Payments []ProformaInvoicePayment `json:"payments,omitempty"`
CustomFields []InvoiceCustomField `json:"custom_fields,omitempty"`
PublicUrl Optional[string] `json:"public_url"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProformaInvoice.
@@ -67,13 +67,17 @@ type ProformaInvoice struct {
func (p ProformaInvoice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "created_at", "delivery_date", "status", "collection_method", "payment_instructions", "currency", "consolidation_level", "product_name", "product_family_name", "role", "seller", "customer", "memo", "billing_address", "shipping_address", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "credit_amount", "paid_amount", "refund_amount", "due_amount", "line_items", "discounts", "taxes", "credits", "payments", "custom_fields", "public_url"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProformaInvoice object to a map representation for JSON marshaling.
func (p ProformaInvoice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Uid != nil {
structMap["uid"] = p.Uid
}
@@ -213,12 +217,12 @@ func (p *ProformaInvoice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "created_at", "delivery_date", "status", "collection_method", "payment_instructions", "currency", "consolidation_level", "product_name", "product_family_name", "role", "seller", "customer", "memo", "billing_address", "shipping_address", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "credit_amount", "paid_amount", "refund_amount", "due_amount", "line_items", "discounts", "taxes", "credits", "payments", "custom_fields", "public_url")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "site_id", "customer_id", "subscription_id", "number", "sequence_number", "created_at", "delivery_date", "status", "collection_method", "payment_instructions", "currency", "consolidation_level", "product_name", "product_family_name", "role", "seller", "customer", "memo", "billing_address", "shipping_address", "subtotal_amount", "discount_amount", "tax_amount", "total_amount", "credit_amount", "paid_amount", "refund_amount", "due_amount", "line_items", "discounts", "taxes", "credits", "payments", "custom_fields", "public_url")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Uid = temp.Uid
p.SiteId = temp.SiteId
p.CustomerId = temp.CustomerId
diff --git a/models/proforma_invoice_credit.go b/models/proforma_invoice_credit.go
index 70950c2b..88f17521 100644
--- a/models/proforma_invoice_credit.go
+++ b/models/proforma_invoice_credit.go
@@ -11,11 +11,11 @@ import (
// ProformaInvoiceCredit represents a ProformaInvoiceCredit struct.
type ProformaInvoiceCredit struct {
- Uid *string `json:"uid,omitempty"`
- Memo *string `json:"memo,omitempty"`
- OriginalAmount *string `json:"original_amount,omitempty"`
- AppliedAmount *string `json:"applied_amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Uid *string `json:"uid,omitempty"`
+ Memo *string `json:"memo,omitempty"`
+ OriginalAmount *string `json:"original_amount,omitempty"`
+ AppliedAmount *string `json:"applied_amount,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProformaInvoiceCredit.
@@ -23,13 +23,17 @@ type ProformaInvoiceCredit struct {
func (p ProformaInvoiceCredit) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "uid", "memo", "original_amount", "applied_amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProformaInvoiceCredit object to a map representation for JSON marshaling.
func (p ProformaInvoiceCredit) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Uid != nil {
structMap["uid"] = p.Uid
}
@@ -53,12 +57,12 @@ func (p *ProformaInvoiceCredit) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "memo", "original_amount", "applied_amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "memo", "original_amount", "applied_amount")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Uid = temp.Uid
p.Memo = temp.Memo
p.OriginalAmount = temp.OriginalAmount
diff --git a/models/proforma_invoice_discount.go b/models/proforma_invoice_discount.go
index 510b0521..f3f243a4 100644
--- a/models/proforma_invoice_discount.go
+++ b/models/proforma_invoice_discount.go
@@ -19,7 +19,7 @@ type ProformaInvoiceDiscount struct {
EligibleAmount *string `json:"eligible_amount,omitempty"`
DiscountAmount *string `json:"discount_amount,omitempty"`
LineItemBreakouts []InvoiceDiscountBreakout `json:"line_item_breakouts,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProformaInvoiceDiscount.
@@ -27,13 +27,17 @@ type ProformaInvoiceDiscount struct {
func (p ProformaInvoiceDiscount) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "uid", "title", "code", "source_type", "discount_type", "eligible_amount", "discount_amount", "line_item_breakouts"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProformaInvoiceDiscount object to a map representation for JSON marshaling.
func (p ProformaInvoiceDiscount) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Uid != nil {
structMap["uid"] = p.Uid
}
@@ -69,12 +73,12 @@ func (p *ProformaInvoiceDiscount) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "title", "code", "source_type", "discount_type", "eligible_amount", "discount_amount", "line_item_breakouts")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "title", "code", "source_type", "discount_type", "eligible_amount", "discount_amount", "line_item_breakouts")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Uid = temp.Uid
p.Title = temp.Title
p.Code = temp.Code
diff --git a/models/proforma_invoice_issued.go b/models/proforma_invoice_issued.go
index 0b268565..fede66e0 100644
--- a/models/proforma_invoice_issued.go
+++ b/models/proforma_invoice_issued.go
@@ -26,7 +26,7 @@ type ProformaInvoiceIssued struct {
TotalAmount string `json:"total_amount"`
ProductName string `json:"product_name"`
LineItems []InvoiceLineItemEventData `json:"line_items"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProformaInvoiceIssued.
@@ -34,13 +34,17 @@ type ProformaInvoiceIssued struct {
func (p ProformaInvoiceIssued) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "uid", "number", "role", "delivery_date", "created_at", "due_amount", "paid_amount", "tax_amount", "total_amount", "product_name", "line_items"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProformaInvoiceIssued object to a map representation for JSON marshaling.
func (p ProformaInvoiceIssued) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
structMap["uid"] = p.Uid
structMap["number"] = p.Number
structMap["role"] = p.Role
@@ -67,12 +71,12 @@ func (p *ProformaInvoiceIssued) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "number", "role", "delivery_date", "created_at", "due_amount", "paid_amount", "tax_amount", "total_amount", "product_name", "line_items")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "number", "role", "delivery_date", "created_at", "due_amount", "paid_amount", "tax_amount", "total_amount", "product_name", "line_items")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Uid = *temp.Uid
p.Number = *temp.Number
p.Role = *temp.Role
diff --git a/models/proforma_invoice_payment.go b/models/proforma_invoice_payment.go
index fe9ee675..533fd318 100644
--- a/models/proforma_invoice_payment.go
+++ b/models/proforma_invoice_payment.go
@@ -11,11 +11,11 @@ import (
// ProformaInvoicePayment represents a ProformaInvoicePayment struct.
type ProformaInvoicePayment struct {
- Memo *string `json:"memo,omitempty"`
- OriginalAmount *string `json:"original_amount,omitempty"`
- AppliedAmount *string `json:"applied_amount,omitempty"`
- Prepayment *bool `json:"prepayment,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Memo *string `json:"memo,omitempty"`
+ OriginalAmount *string `json:"original_amount,omitempty"`
+ AppliedAmount *string `json:"applied_amount,omitempty"`
+ Prepayment *bool `json:"prepayment,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProformaInvoicePayment.
@@ -23,13 +23,17 @@ type ProformaInvoicePayment struct {
func (p ProformaInvoicePayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "memo", "original_amount", "applied_amount", "prepayment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProformaInvoicePayment object to a map representation for JSON marshaling.
func (p ProformaInvoicePayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Memo != nil {
structMap["memo"] = p.Memo
}
@@ -53,12 +57,12 @@ func (p *ProformaInvoicePayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "memo", "original_amount", "applied_amount", "prepayment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "memo", "original_amount", "applied_amount", "prepayment")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Memo = temp.Memo
p.OriginalAmount = temp.OriginalAmount
p.AppliedAmount = temp.AppliedAmount
diff --git a/models/proforma_invoice_tax.go b/models/proforma_invoice_tax.go
index 967250ef..5a3b815f 100644
--- a/models/proforma_invoice_tax.go
+++ b/models/proforma_invoice_tax.go
@@ -18,7 +18,7 @@ type ProformaInvoiceTax struct {
TaxableAmount *string `json:"taxable_amount,omitempty"`
TaxAmount *string `json:"tax_amount,omitempty"`
LineItemBreakouts []InvoiceTaxBreakout `json:"line_item_breakouts,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ProformaInvoiceTax.
@@ -26,13 +26,17 @@ type ProformaInvoiceTax struct {
func (p ProformaInvoiceTax) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "uid", "title", "source_type", "percentage", "taxable_amount", "tax_amount", "line_item_breakouts"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the ProformaInvoiceTax object to a map representation for JSON marshaling.
func (p ProformaInvoiceTax) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Uid != nil {
structMap["uid"] = p.Uid
}
@@ -65,12 +69,12 @@ func (p *ProformaInvoiceTax) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "title", "source_type", "percentage", "taxable_amount", "tax_amount", "line_item_breakouts")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "title", "source_type", "percentage", "taxable_amount", "tax_amount", "line_item_breakouts")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Uid = temp.Uid
p.Title = temp.Title
p.SourceType = temp.SourceType
diff --git a/models/proration.go b/models/proration.go
index ae6bc3a4..2a87ebe5 100644
--- a/models/proration.go
+++ b/models/proration.go
@@ -12,8 +12,8 @@ import (
// Proration represents a Proration struct.
type Proration struct {
// The alternative to sending preserve_period as a direct attribute to migration
- PreservePeriod *bool `json:"preserve_period,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PreservePeriod *bool `json:"preserve_period,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Proration.
@@ -21,13 +21,17 @@ type Proration struct {
func (p Proration) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "preserve_period"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the Proration object to a map representation for JSON marshaling.
func (p Proration) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.PreservePeriod != nil {
structMap["preserve_period"] = p.PreservePeriod
}
@@ -42,12 +46,12 @@ func (p *Proration) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "preserve_period")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "preserve_period")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.PreservePeriod = temp.PreservePeriod
return nil
}
diff --git a/models/public_key.go b/models/public_key.go
index 60cc44bd..c54ff30c 100644
--- a/models/public_key.go
+++ b/models/public_key.go
@@ -13,10 +13,10 @@ import (
// PublicKey represents a PublicKey struct.
type PublicKey struct {
- PublicKey *string `json:"public_key,omitempty"`
- RequiresSecurityToken *bool `json:"requires_security_token,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ PublicKey *string `json:"public_key,omitempty"`
+ RequiresSecurityToken *bool `json:"requires_security_token,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PublicKey.
@@ -24,13 +24,17 @@ type PublicKey struct {
func (p PublicKey) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "public_key", "requires_security_token", "created_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PublicKey object to a map representation for JSON marshaling.
func (p PublicKey) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.PublicKey != nil {
structMap["public_key"] = p.PublicKey
}
@@ -51,12 +55,12 @@ func (p *PublicKey) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "public_key", "requires_security_token", "created_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "public_key", "requires_security_token", "created_at")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.PublicKey = temp.PublicKey
p.RequiresSecurityToken = temp.RequiresSecurityToken
if temp.CreatedAt != nil {
diff --git a/models/public_signup_page.go b/models/public_signup_page.go
index 58d380df..e9bbf1e8 100644
--- a/models/public_signup_page.go
+++ b/models/public_signup_page.go
@@ -12,14 +12,14 @@ import (
// PublicSignupPage represents a PublicSignupPage struct.
type PublicSignupPage struct {
// The id of the signup page (public_signup_pages only)
- Id *int `json:"id,omitempty"`
+ Id *int `json:"id,omitempty"`
// The url to which a customer will be returned after a successful signup (public_signup_pages only)
- ReturnUrl Optional[string] `json:"return_url"`
+ ReturnUrl Optional[string] `json:"return_url"`
// The params to be appended to the return_url (public_signup_pages only)
- ReturnParams Optional[string] `json:"return_params"`
+ ReturnParams Optional[string] `json:"return_params"`
// The url where the signup page can be viewed (public_signup_pages only)
- Url *string `json:"url,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Url *string `json:"url,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for PublicSignupPage.
@@ -27,13 +27,17 @@ type PublicSignupPage struct {
func (p PublicSignupPage) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(p.AdditionalProperties,
+ "id", "return_url", "return_params", "url"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(p.toMap())
}
// toMap converts the PublicSignupPage object to a map representation for JSON marshaling.
func (p PublicSignupPage) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, p.AdditionalProperties)
+ MergeAdditionalProperties(structMap, p.AdditionalProperties)
if p.Id != nil {
structMap["id"] = p.Id
}
@@ -65,12 +69,12 @@ func (p *PublicSignupPage) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "return_url", "return_params", "url")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "return_url", "return_params", "url")
if err != nil {
return err
}
-
p.AdditionalProperties = additionalProperties
+
p.Id = temp.Id
p.ReturnUrl = temp.ReturnUrl
p.ReturnParams = temp.ReturnParams
diff --git a/models/quantity_based_component.go b/models/quantity_based_component.go
index df3cda7d..72838574 100644
--- a/models/quantity_based_component.go
+++ b/models/quantity_based_component.go
@@ -40,8 +40,6 @@ type QuantityBasedComponent struct {
TaxCode *string `json:"tax_code,omitempty"`
// (Only available on Relationship Invoicing sites) Boolean flag describing if the service date range should show for the component on generated invoices.
HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
- // deprecated May 2011 - use unit_price instead
- PriceInCents *string `json:"price_in_cents,omitempty"`
Recurring *bool `json:"recurring,omitempty"`
DisplayOnHostedPage *bool `json:"display_on_hosted_page,omitempty"`
AllowFractionalQuantities *bool `json:"allow_fractional_quantities,omitempty"`
@@ -50,7 +48,7 @@ type QuantityBasedComponent struct {
Interval *int `json:"interval,omitempty"`
// A string representing the interval unit for this component's default price point, either month or day. This property is only available for sites with Multifrequency enabled.
IntervalUnit Optional[IntervalUnit] `json:"interval_unit"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for QuantityBasedComponent.
@@ -58,13 +56,17 @@ type QuantityBasedComponent struct {
func (q QuantityBasedComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(q.AdditionalProperties,
+ "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "upgrade_charge", "downgrade_credit", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "recurring", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids", "interval", "interval_unit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(q.toMap())
}
// toMap converts the QuantityBasedComponent object to a map representation for JSON marshaling.
func (q QuantityBasedComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, q.AdditionalProperties)
+ MergeAdditionalProperties(structMap, q.AdditionalProperties)
structMap["name"] = q.Name
structMap["unit_name"] = q.UnitName
if q.Description != nil {
@@ -106,9 +108,6 @@ func (q QuantityBasedComponent) toMap() map[string]any {
if q.HideDateRangeOnInvoice != nil {
structMap["hide_date_range_on_invoice"] = q.HideDateRangeOnInvoice
}
- if q.PriceInCents != nil {
- structMap["price_in_cents"] = q.PriceInCents
- }
if q.Recurring != nil {
structMap["recurring"] = q.Recurring
}
@@ -146,12 +145,12 @@ func (q *QuantityBasedComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "upgrade_charge", "downgrade_credit", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "price_in_cents", "recurring", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids", "interval", "interval_unit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "unit_name", "description", "handle", "taxable", "pricing_scheme", "prices", "upgrade_charge", "downgrade_credit", "price_points", "unit_price", "tax_code", "hide_date_range_on_invoice", "recurring", "display_on_hosted_page", "allow_fractional_quantities", "public_signup_page_ids", "interval", "interval_unit")
if err != nil {
return err
}
-
q.AdditionalProperties = additionalProperties
+
q.Name = *temp.Name
q.UnitName = *temp.UnitName
q.Description = temp.Description
@@ -165,7 +164,6 @@ func (q *QuantityBasedComponent) UnmarshalJSON(input []byte) error {
q.UnitPrice = temp.UnitPrice
q.TaxCode = temp.TaxCode
q.HideDateRangeOnInvoice = temp.HideDateRangeOnInvoice
- q.PriceInCents = temp.PriceInCents
q.Recurring = temp.Recurring
q.DisplayOnHostedPage = temp.DisplayOnHostedPage
q.AllowFractionalQuantities = temp.AllowFractionalQuantities
@@ -190,7 +188,6 @@ type tempQuantityBasedComponent struct {
UnitPrice *QuantityBasedComponentUnitPrice `json:"unit_price,omitempty"`
TaxCode *string `json:"tax_code,omitempty"`
HideDateRangeOnInvoice *bool `json:"hide_date_range_on_invoice,omitempty"`
- PriceInCents *string `json:"price_in_cents,omitempty"`
Recurring *bool `json:"recurring,omitempty"`
DisplayOnHostedPage *bool `json:"display_on_hosted_page,omitempty"`
AllowFractionalQuantities *bool `json:"allow_fractional_quantities,omitempty"`
diff --git a/models/reactivate_subscription_group_request.go b/models/reactivate_subscription_group_request.go
index b2ee3133..92c948d2 100644
--- a/models/reactivate_subscription_group_request.go
+++ b/models/reactivate_subscription_group_request.go
@@ -11,9 +11,9 @@ import (
// ReactivateSubscriptionGroupRequest represents a ReactivateSubscriptionGroupRequest struct.
type ReactivateSubscriptionGroupRequest struct {
- Resume *bool `json:"resume,omitempty"`
- ResumeMembers *bool `json:"resume_members,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Resume *bool `json:"resume,omitempty"`
+ ResumeMembers *bool `json:"resume_members,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ReactivateSubscriptionGroupRequest.
@@ -21,13 +21,17 @@ type ReactivateSubscriptionGroupRequest struct {
func (r ReactivateSubscriptionGroupRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "resume", "resume_members"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ReactivateSubscriptionGroupRequest object to a map representation for JSON marshaling.
func (r ReactivateSubscriptionGroupRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.Resume != nil {
structMap["resume"] = r.Resume
}
@@ -45,12 +49,12 @@ func (r *ReactivateSubscriptionGroupRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "resume", "resume_members")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "resume", "resume_members")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Resume = temp.Resume
r.ResumeMembers = temp.ResumeMembers
return nil
diff --git a/models/reactivate_subscription_group_response.go b/models/reactivate_subscription_group_response.go
index 8f3ba169..5457a397 100644
--- a/models/reactivate_subscription_group_response.go
+++ b/models/reactivate_subscription_group_response.go
@@ -13,16 +13,16 @@ import (
// ReactivateSubscriptionGroupResponse represents a ReactivateSubscriptionGroupResponse struct.
type ReactivateSubscriptionGroupResponse struct {
- Uid *string `json:"uid,omitempty"`
- Scheme *int `json:"scheme,omitempty"`
- CustomerId *int `json:"customer_id,omitempty"`
- PaymentProfileId *int `json:"payment_profile_id,omitempty"`
- SubscriptionIds []int `json:"subscription_ids,omitempty"`
- PrimarySubscriptionId *int `json:"primary_subscription_id,omitempty"`
- NextAssessmentAt *time.Time `json:"next_assessment_at,omitempty"`
- State *string `json:"state,omitempty"`
- CancelAtEndOfPeriod *bool `json:"cancel_at_end_of_period,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Uid *string `json:"uid,omitempty"`
+ Scheme *int `json:"scheme,omitempty"`
+ CustomerId *int `json:"customer_id,omitempty"`
+ PaymentProfileId *int `json:"payment_profile_id,omitempty"`
+ SubscriptionIds []int `json:"subscription_ids,omitempty"`
+ PrimarySubscriptionId *int `json:"primary_subscription_id,omitempty"`
+ NextAssessmentAt *time.Time `json:"next_assessment_at,omitempty"`
+ State *string `json:"state,omitempty"`
+ CancelAtEndOfPeriod *bool `json:"cancel_at_end_of_period,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ReactivateSubscriptionGroupResponse.
@@ -30,13 +30,17 @@ type ReactivateSubscriptionGroupResponse struct {
func (r ReactivateSubscriptionGroupResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ReactivateSubscriptionGroupResponse object to a map representation for JSON marshaling.
func (r ReactivateSubscriptionGroupResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.Uid != nil {
structMap["uid"] = r.Uid
}
@@ -75,12 +79,12 @@ func (r *ReactivateSubscriptionGroupResponse) UnmarshalJSON(input []byte) error
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Uid = temp.Uid
r.Scheme = temp.Scheme
r.CustomerId = temp.CustomerId
diff --git a/models/reactivate_subscription_request.go b/models/reactivate_subscription_request.go
index 6d585382..6a95df93 100644
--- a/models/reactivate_subscription_request.go
+++ b/models/reactivate_subscription_request.go
@@ -23,7 +23,7 @@ type ReactivateSubscriptionRequest struct {
UseCreditsAndPrepayments *bool `json:"use_credits_and_prepayments,omitempty"`
// If `true`, Chargify will attempt to resume the subscription's billing period. if not resumable, the subscription will be reactivated with a new billing period. If `false`: Chargify will only attempt to reactivate the subscription.
Resume *ReactivateSubscriptionRequestResume `json:"resume,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ReactivateSubscriptionRequest.
@@ -31,13 +31,17 @@ type ReactivateSubscriptionRequest struct {
func (r ReactivateSubscriptionRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "calendar_billing", "include_trial", "preserve_balance", "coupon_code", "use_credits_and_prepayments", "resume"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ReactivateSubscriptionRequest object to a map representation for JSON marshaling.
func (r ReactivateSubscriptionRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.CalendarBilling != nil {
structMap["calendar_billing"] = r.CalendarBilling.toMap()
}
@@ -67,12 +71,12 @@ func (r *ReactivateSubscriptionRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "calendar_billing", "include_trial", "preserve_balance", "coupon_code", "use_credits_and_prepayments", "resume")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "calendar_billing", "include_trial", "preserve_balance", "coupon_code", "use_credits_and_prepayments", "resume")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.CalendarBilling = temp.CalendarBilling
r.IncludeTrial = temp.IncludeTrial
r.PreserveBalance = temp.PreserveBalance
diff --git a/models/reactivation_billing.go b/models/reactivation_billing.go
index b3f202cf..4cdf0905 100644
--- a/models/reactivation_billing.go
+++ b/models/reactivation_billing.go
@@ -13,8 +13,8 @@ import (
// These values are only applicable to subscriptions using calendar billing
type ReactivationBilling struct {
// You may choose how to handle the reactivation charge for that subscription: 1) `prorated` A prorated charge for the product price will be attempted for to complete the period 2) `immediate` A full-price charge for the product price will be attempted immediately 3) `delayed` A full-price charge for the product price will be attempted at the next renewal
- ReactivationCharge *ReactivationCharge `json:"reactivation_charge,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ReactivationCharge *ReactivationCharge `json:"reactivation_charge,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ReactivationBilling.
@@ -22,13 +22,17 @@ type ReactivationBilling struct {
func (r ReactivationBilling) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "reactivation_charge"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ReactivationBilling object to a map representation for JSON marshaling.
func (r ReactivationBilling) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.ReactivationCharge != nil {
structMap["reactivation_charge"] = r.ReactivationCharge
}
@@ -43,12 +47,12 @@ func (r *ReactivationBilling) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "reactivation_charge")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "reactivation_charge")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.ReactivationCharge = temp.ReactivationCharge
return nil
}
diff --git a/models/reason_code.go b/models/reason_code.go
index 40895cdf..6ef5b318 100644
--- a/models/reason_code.go
+++ b/models/reason_code.go
@@ -13,14 +13,14 @@ import (
// ReasonCode represents a ReasonCode struct.
type ReasonCode struct {
- Id *int `json:"id,omitempty"`
- SiteId *int `json:"site_id,omitempty"`
- Code *string `json:"code,omitempty"`
- Description *string `json:"description,omitempty"`
- Position *int `json:"position,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ SiteId *int `json:"site_id,omitempty"`
+ Code *string `json:"code,omitempty"`
+ Description *string `json:"description,omitempty"`
+ Position *int `json:"position,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ UpdatedAt *time.Time `json:"updated_at,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ReasonCode.
@@ -28,13 +28,17 @@ type ReasonCode struct {
func (r ReasonCode) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "id", "site_id", "code", "description", "position", "created_at", "updated_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ReasonCode object to a map representation for JSON marshaling.
func (r ReasonCode) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.Id != nil {
structMap["id"] = r.Id
}
@@ -67,12 +71,12 @@ func (r *ReasonCode) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "site_id", "code", "description", "position", "created_at", "updated_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "site_id", "code", "description", "position", "created_at", "updated_at")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Id = temp.Id
r.SiteId = temp.SiteId
r.Code = temp.Code
diff --git a/models/reason_code_response.go b/models/reason_code_response.go
index b994ff7b..b1462fc6 100644
--- a/models/reason_code_response.go
+++ b/models/reason_code_response.go
@@ -13,8 +13,8 @@ import (
// ReasonCodeResponse represents a ReasonCodeResponse struct.
type ReasonCodeResponse struct {
- ReasonCode ReasonCode `json:"reason_code"`
- AdditionalProperties map[string]any `json:"_"`
+ ReasonCode ReasonCode `json:"reason_code"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ReasonCodeResponse.
@@ -22,13 +22,17 @@ type ReasonCodeResponse struct {
func (r ReasonCodeResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "reason_code"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ReasonCodeResponse object to a map representation for JSON marshaling.
func (r ReasonCodeResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["reason_code"] = r.ReasonCode.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (r *ReasonCodeResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "reason_code")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "reason_code")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.ReasonCode = *temp.ReasonCode
return nil
}
diff --git a/models/reason_codes_json_response.go b/models/reason_codes_json_response.go
deleted file mode 100644
index fabfd4e8..00000000
--- a/models/reason_codes_json_response.go
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-Package advancedbilling
-
-This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
-*/
-package models
-
-import (
- "encoding/json"
-)
-
-// ReasonCodesJsonResponse represents a ReasonCodesJsonResponse struct.
-type ReasonCodesJsonResponse struct {
- Ok *string `json:"ok,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for ReasonCodesJsonResponse.
-// It customizes the JSON marshaling process for ReasonCodesJsonResponse objects.
-func (r ReasonCodesJsonResponse) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(r.toMap())
-}
-
-// toMap converts the ReasonCodesJsonResponse object to a map representation for JSON marshaling.
-func (r ReasonCodesJsonResponse) toMap() map[string]any {
- structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
- if r.Ok != nil {
- structMap["ok"] = r.Ok
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for ReasonCodesJsonResponse.
-// It customizes the JSON unmarshaling process for ReasonCodesJsonResponse objects.
-func (r *ReasonCodesJsonResponse) UnmarshalJSON(input []byte) error {
- var temp tempReasonCodesJsonResponse
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
- additionalProperties, err := UnmarshalAdditionalProperties(input, "ok")
- if err != nil {
- return err
- }
-
- r.AdditionalProperties = additionalProperties
- r.Ok = temp.Ok
- return nil
-}
-
-// tempReasonCodesJsonResponse is a temporary struct used for validating the fields of ReasonCodesJsonResponse.
-type tempReasonCodesJsonResponse struct {
- Ok *string `json:"ok,omitempty"`
-}
diff --git a/models/record_payment_request.go b/models/record_payment_request.go
index 78680820..31640d28 100644
--- a/models/record_payment_request.go
+++ b/models/record_payment_request.go
@@ -13,8 +13,8 @@ import (
// RecordPaymentRequest represents a RecordPaymentRequest struct.
type RecordPaymentRequest struct {
- Payment CreatePayment `json:"payment"`
- AdditionalProperties map[string]any `json:"_"`
+ Payment CreatePayment `json:"payment"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RecordPaymentRequest.
@@ -22,13 +22,17 @@ type RecordPaymentRequest struct {
func (r RecordPaymentRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "payment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RecordPaymentRequest object to a map representation for JSON marshaling.
func (r RecordPaymentRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["payment"] = r.Payment.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (r *RecordPaymentRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payment")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Payment = *temp.Payment
return nil
}
diff --git a/models/record_payment_response.go b/models/record_payment_response.go
index f7bab423..0777f90a 100644
--- a/models/record_payment_response.go
+++ b/models/record_payment_response.go
@@ -13,7 +13,7 @@ import (
type RecordPaymentResponse struct {
PaidInvoices []PaidInvoice `json:"paid_invoices,omitempty"`
Prepayment Optional[InvoicePrePayment] `json:"prepayment"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RecordPaymentResponse.
@@ -21,13 +21,17 @@ type RecordPaymentResponse struct {
func (r RecordPaymentResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "paid_invoices", "prepayment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RecordPaymentResponse object to a map representation for JSON marshaling.
func (r RecordPaymentResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.PaidInvoices != nil {
structMap["paid_invoices"] = r.PaidInvoices
}
@@ -49,12 +53,12 @@ func (r *RecordPaymentResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "paid_invoices", "prepayment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "paid_invoices", "prepayment")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.PaidInvoices = temp.PaidInvoices
r.Prepayment = temp.Prepayment
return nil
diff --git a/models/referral_code.go b/models/referral_code.go
index 5336cd2e..29826828 100644
--- a/models/referral_code.go
+++ b/models/referral_code.go
@@ -11,11 +11,11 @@ import (
// ReferralCode represents a ReferralCode struct.
type ReferralCode struct {
- Id *int `json:"id,omitempty"`
- SiteId *int `json:"site_id,omitempty"`
- SubscriptionId *int `json:"subscription_id,omitempty"`
- Code *string `json:"code,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ SiteId *int `json:"site_id,omitempty"`
+ SubscriptionId *int `json:"subscription_id,omitempty"`
+ Code *string `json:"code,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ReferralCode.
@@ -23,13 +23,17 @@ type ReferralCode struct {
func (r ReferralCode) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "id", "site_id", "subscription_id", "code"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ReferralCode object to a map representation for JSON marshaling.
func (r ReferralCode) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.Id != nil {
structMap["id"] = r.Id
}
@@ -53,12 +57,12 @@ func (r *ReferralCode) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "site_id", "subscription_id", "code")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "site_id", "subscription_id", "code")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Id = temp.Id
r.SiteId = temp.SiteId
r.SubscriptionId = temp.SubscriptionId
diff --git a/models/referral_validation_response.go b/models/referral_validation_response.go
index 6d9fa792..424f8918 100644
--- a/models/referral_validation_response.go
+++ b/models/referral_validation_response.go
@@ -11,8 +11,8 @@ import (
// ReferralValidationResponse represents a ReferralValidationResponse struct.
type ReferralValidationResponse struct {
- ReferralCode *ReferralCode `json:"referral_code,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ReferralCode *ReferralCode `json:"referral_code,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ReferralValidationResponse.
@@ -20,13 +20,17 @@ type ReferralValidationResponse struct {
func (r ReferralValidationResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "referral_code"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ReferralValidationResponse object to a map representation for JSON marshaling.
func (r ReferralValidationResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.ReferralCode != nil {
structMap["referral_code"] = r.ReferralCode.toMap()
}
@@ -41,12 +45,12 @@ func (r *ReferralValidationResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "referral_code")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "referral_code")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.ReferralCode = temp.ReferralCode
return nil
}
diff --git a/models/refund_consolidated_invoice.go b/models/refund_consolidated_invoice.go
index b936b24b..0fd5e835 100644
--- a/models/refund_consolidated_invoice.go
+++ b/models/refund_consolidated_invoice.go
@@ -26,7 +26,7 @@ type RefundConsolidatedInvoice struct {
ApplyCredit *bool `json:"apply_credit,omitempty"`
// The amount of payment to be refunded in decimal format. Example: "10.50". This will default to the full amount of the payment if not provided.
Amount *string `json:"amount,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RefundConsolidatedInvoice.
@@ -34,13 +34,17 @@ type RefundConsolidatedInvoice struct {
func (r RefundConsolidatedInvoice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "memo", "payment_id", "segment_uids", "external", "apply_credit", "amount"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RefundConsolidatedInvoice object to a map representation for JSON marshaling.
func (r RefundConsolidatedInvoice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["memo"] = r.Memo
structMap["payment_id"] = r.PaymentId
structMap["segment_uids"] = r.SegmentUids.toMap()
@@ -68,12 +72,12 @@ func (r *RefundConsolidatedInvoice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "memo", "payment_id", "segment_uids", "external", "apply_credit", "amount")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "memo", "payment_id", "segment_uids", "external", "apply_credit", "amount")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Memo = *temp.Memo
r.PaymentId = *temp.PaymentId
r.SegmentUids = *temp.SegmentUids
diff --git a/models/refund_invoice.go b/models/refund_invoice.go
index d60a9e65..aba96456 100644
--- a/models/refund_invoice.go
+++ b/models/refund_invoice.go
@@ -15,18 +15,18 @@ import (
// Refund an invoice or a segment of a consolidated invoice.
type RefundInvoice struct {
// The amount to be refunded in decimal format as a string. Example: "10.50". Must not exceed the remaining refundable balance of the payment.
- Amount string `json:"amount"`
+ Amount string `json:"amount"`
// A description that will be attached to the refund
- Memo string `json:"memo"`
+ Memo string `json:"memo"`
// The ID of the payment to be refunded
- PaymentId int `json:"payment_id"`
+ PaymentId int `json:"payment_id"`
// Flag that marks refund as external (no money is returned to the customer). Defaults to `false`.
- External *bool `json:"external,omitempty"`
+ External *bool `json:"external,omitempty"`
// If set to true, creates credit and applies it to an invoice. Defaults to `false`.
- ApplyCredit *bool `json:"apply_credit,omitempty"`
+ ApplyCredit *bool `json:"apply_credit,omitempty"`
// If `apply_credit` set to false and refunding full amount, if `void_invoice` set to true, invoice will be voided after refund. Defaults to `false`.
- VoidInvoice *bool `json:"void_invoice,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ VoidInvoice *bool `json:"void_invoice,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RefundInvoice.
@@ -34,13 +34,17 @@ type RefundInvoice struct {
func (r RefundInvoice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "amount", "memo", "payment_id", "external", "apply_credit", "void_invoice"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RefundInvoice object to a map representation for JSON marshaling.
func (r RefundInvoice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["amount"] = r.Amount
structMap["memo"] = r.Memo
structMap["payment_id"] = r.PaymentId
@@ -68,12 +72,12 @@ func (r *RefundInvoice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "amount", "memo", "payment_id", "external", "apply_credit", "void_invoice")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "amount", "memo", "payment_id", "external", "apply_credit", "void_invoice")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Amount = *temp.Amount
r.Memo = *temp.Memo
r.PaymentId = *temp.PaymentId
diff --git a/models/refund_invoice_event.go b/models/refund_invoice_event.go
index 2dfab03c..fe3ea507 100644
--- a/models/refund_invoice_event.go
+++ b/models/refund_invoice_event.go
@@ -21,7 +21,7 @@ type RefundInvoiceEvent struct {
EventType InvoiceEventType `json:"event_type"`
// Example schema for an `refund_invoice` event
EventData RefundInvoiceEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RefundInvoiceEvent.
@@ -29,13 +29,17 @@ type RefundInvoiceEvent struct {
func (r RefundInvoiceEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RefundInvoiceEvent object to a map representation for JSON marshaling.
func (r RefundInvoiceEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["id"] = r.Id
structMap["timestamp"] = r.Timestamp.Format(time.RFC3339)
structMap["invoice"] = r.Invoice.toMap()
@@ -56,12 +60,12 @@ func (r *RefundInvoiceEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/refund_invoice_event_data.go b/models/refund_invoice_event_data.go
index d3819b1f..4607cd30 100644
--- a/models/refund_invoice_event_data.go
+++ b/models/refund_invoice_event_data.go
@@ -38,7 +38,7 @@ type RefundInvoiceEventData struct {
RefundId int `json:"refund_id"`
// The time the refund was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z"
TransactionTime time.Time `json:"transaction_time"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RefundInvoiceEventData.
@@ -46,13 +46,17 @@ type RefundInvoiceEventData struct {
func (r RefundInvoiceEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "apply_credit", "consolidation_level", "credit_note_attributes", "memo", "original_amount", "payment_id", "refund_amount", "refund_id", "transaction_time"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RefundInvoiceEventData object to a map representation for JSON marshaling.
func (r RefundInvoiceEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["apply_credit"] = r.ApplyCredit
if r.ConsolidationLevel != nil {
structMap["consolidation_level"] = r.ConsolidationLevel
@@ -83,12 +87,12 @@ func (r *RefundInvoiceEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "apply_credit", "consolidation_level", "credit_note_attributes", "memo", "original_amount", "payment_id", "refund_amount", "refund_id", "transaction_time")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "apply_credit", "consolidation_level", "credit_note_attributes", "memo", "original_amount", "payment_id", "refund_amount", "refund_id", "transaction_time")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.ApplyCredit = *temp.ApplyCredit
r.ConsolidationLevel = temp.ConsolidationLevel
r.CreditNoteAttributes = *temp.CreditNoteAttributes
diff --git a/models/refund_invoice_request.go b/models/refund_invoice_request.go
index e99966a4..a0622766 100644
--- a/models/refund_invoice_request.go
+++ b/models/refund_invoice_request.go
@@ -14,7 +14,7 @@ import (
// RefundInvoiceRequest represents a RefundInvoiceRequest struct.
type RefundInvoiceRequest struct {
Refund RefundInvoiceRequestRefund `json:"refund"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RefundInvoiceRequest.
@@ -22,13 +22,17 @@ type RefundInvoiceRequest struct {
func (r RefundInvoiceRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "refund"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RefundInvoiceRequest object to a map representation for JSON marshaling.
func (r RefundInvoiceRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["refund"] = r.Refund.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (r *RefundInvoiceRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "refund")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "refund")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Refund = *temp.Refund
return nil
}
diff --git a/models/refund_prepayment.go b/models/refund_prepayment.go
index f55b1086..ae003114 100644
--- a/models/refund_prepayment.go
+++ b/models/refund_prepayment.go
@@ -20,7 +20,7 @@ type RefundPrepayment struct {
Memo string `json:"memo"`
// Specify the type of refund you wish to initiate. When the prepayment is external, the `external` flag is optional. But if the prepayment was made through a payment profile, the `external` flag is required.
External *bool `json:"external,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RefundPrepayment.
@@ -28,13 +28,17 @@ type RefundPrepayment struct {
func (r RefundPrepayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "amount_in_cents", "amount", "memo", "external"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RefundPrepayment object to a map representation for JSON marshaling.
func (r RefundPrepayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.AmountInCents != nil {
structMap["amount_in_cents"] = r.AmountInCents
} else {
@@ -60,12 +64,12 @@ func (r *RefundPrepayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "amount_in_cents", "amount", "memo", "external")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "amount_in_cents", "amount", "memo", "external")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.AmountInCents = temp.AmountInCents
r.Amount = *temp.Amount
r.Memo = *temp.Memo
diff --git a/models/refund_prepayment_base_refund_error.go b/models/refund_prepayment_base_refund_error.go
index f14ed40c..4bf2c5a7 100644
--- a/models/refund_prepayment_base_refund_error.go
+++ b/models/refund_prepayment_base_refund_error.go
@@ -11,8 +11,8 @@ import (
// RefundPrepaymentBaseRefundError represents a RefundPrepaymentBaseRefundError struct.
type RefundPrepaymentBaseRefundError struct {
- Refund *BaseRefundError `json:"refund,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Refund *BaseRefundError `json:"refund,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RefundPrepaymentBaseRefundError.
@@ -20,13 +20,17 @@ type RefundPrepaymentBaseRefundError struct {
func (r RefundPrepaymentBaseRefundError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "refund"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RefundPrepaymentBaseRefundError object to a map representation for JSON marshaling.
func (r RefundPrepaymentBaseRefundError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.Refund != nil {
structMap["refund"] = r.Refund.toMap()
}
@@ -41,12 +45,12 @@ func (r *RefundPrepaymentBaseRefundError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "refund")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "refund")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Refund = temp.Refund
return nil
}
diff --git a/models/refund_prepayment_request.go b/models/refund_prepayment_request.go
index b7afc68b..755b87e7 100644
--- a/models/refund_prepayment_request.go
+++ b/models/refund_prepayment_request.go
@@ -13,8 +13,8 @@ import (
// RefundPrepaymentRequest represents a RefundPrepaymentRequest struct.
type RefundPrepaymentRequest struct {
- Refund RefundPrepayment `json:"refund"`
- AdditionalProperties map[string]any `json:"_"`
+ Refund RefundPrepayment `json:"refund"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RefundPrepaymentRequest.
@@ -22,13 +22,17 @@ type RefundPrepaymentRequest struct {
func (r RefundPrepaymentRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "refund"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RefundPrepaymentRequest object to a map representation for JSON marshaling.
func (r RefundPrepaymentRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["refund"] = r.Refund.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (r *RefundPrepaymentRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "refund")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "refund")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Refund = *temp.Refund
return nil
}
diff --git a/models/refund_success.go b/models/refund_success.go
index 59886a03..1d57ffab 100644
--- a/models/refund_success.go
+++ b/models/refund_success.go
@@ -13,10 +13,10 @@ import (
// RefundSuccess represents a RefundSuccess struct.
type RefundSuccess struct {
- RefundId int `json:"refund_id"`
- GatewayTransactionId int `json:"gateway_transaction_id"`
- ProductId int `json:"product_id"`
- AdditionalProperties map[string]any `json:"_"`
+ RefundId int `json:"refund_id"`
+ GatewayTransactionId int `json:"gateway_transaction_id"`
+ ProductId int `json:"product_id"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RefundSuccess.
@@ -24,13 +24,17 @@ type RefundSuccess struct {
func (r RefundSuccess) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "refund_id", "gateway_transaction_id", "product_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RefundSuccess object to a map representation for JSON marshaling.
func (r RefundSuccess) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["refund_id"] = r.RefundId
structMap["gateway_transaction_id"] = r.GatewayTransactionId
structMap["product_id"] = r.ProductId
@@ -49,12 +53,12 @@ func (r *RefundSuccess) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "refund_id", "gateway_transaction_id", "product_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "refund_id", "gateway_transaction_id", "product_id")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.RefundId = *temp.RefundId
r.GatewayTransactionId = *temp.GatewayTransactionId
r.ProductId = *temp.ProductId
diff --git a/models/remove_payment_event.go b/models/remove_payment_event.go
index b587a3e5..bd492f31 100644
--- a/models/remove_payment_event.go
+++ b/models/remove_payment_event.go
@@ -21,7 +21,7 @@ type RemovePaymentEvent struct {
EventType InvoiceEventType `json:"event_type"`
// Example schema for an `remove_payment` event
EventData RemovePaymentEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RemovePaymentEvent.
@@ -29,13 +29,17 @@ type RemovePaymentEvent struct {
func (r RemovePaymentEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RemovePaymentEvent object to a map representation for JSON marshaling.
func (r RemovePaymentEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["id"] = r.Id
structMap["timestamp"] = r.Timestamp.Format(time.RFC3339)
structMap["invoice"] = r.Invoice.toMap()
@@ -56,12 +60,12 @@ func (r *RemovePaymentEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/remove_payment_event_data.go b/models/remove_payment_event_data.go
index 5c1a08e0..45805874 100644
--- a/models/remove_payment_event_data.go
+++ b/models/remove_payment_event_data.go
@@ -17,20 +17,20 @@ import (
// Example schema for an `remove_payment` event
type RemovePaymentEventData struct {
// Transaction ID of the original payment that was removed
- TransactionId int `json:"transaction_id"`
+ TransactionId int `json:"transaction_id"`
// Memo of the original payment
- Memo string `json:"memo"`
+ Memo string `json:"memo"`
// Full amount of the original payment
- OriginalAmount *string `json:"original_amount,omitempty"`
+ OriginalAmount *string `json:"original_amount,omitempty"`
// Applied amount of the original payment
- AppliedAmount string `json:"applied_amount"`
+ AppliedAmount string `json:"applied_amount"`
// Transaction time of the original payment, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z"
- TransactionTime time.Time `json:"transaction_time"`
+ TransactionTime time.Time `json:"transaction_time"`
// A nested data structure detailing the method of payment
- PaymentMethod InvoiceEventPayment `json:"payment_method"`
+ PaymentMethod InvoiceEventPayment `json:"payment_method"`
// The flag that shows whether the original payment was a prepayment or not
- Prepayment bool `json:"prepayment"`
- AdditionalProperties map[string]any `json:"_"`
+ Prepayment bool `json:"prepayment"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RemovePaymentEventData.
@@ -38,13 +38,17 @@ type RemovePaymentEventData struct {
func (r RemovePaymentEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "transaction_id", "memo", "original_amount", "applied_amount", "transaction_time", "payment_method", "prepayment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RemovePaymentEventData object to a map representation for JSON marshaling.
func (r RemovePaymentEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["transaction_id"] = r.TransactionId
structMap["memo"] = r.Memo
if r.OriginalAmount != nil {
@@ -69,12 +73,12 @@ func (r *RemovePaymentEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "transaction_id", "memo", "original_amount", "applied_amount", "transaction_time", "payment_method", "prepayment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "transaction_id", "memo", "original_amount", "applied_amount", "transaction_time", "payment_method", "prepayment")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.TransactionId = *temp.TransactionId
r.Memo = *temp.Memo
r.OriginalAmount = temp.OriginalAmount
diff --git a/models/renewal_preview.go b/models/renewal_preview.go
index c16cfdd4..7a2733e8 100644
--- a/models/renewal_preview.go
+++ b/models/renewal_preview.go
@@ -31,7 +31,7 @@ type RenewalPreview struct {
UncalculatedTaxes *bool `json:"uncalculated_taxes,omitempty"`
// An array of objects representing the individual transactions that will be created at the next renewal
LineItems []RenewalPreviewLineItem `json:"line_items,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RenewalPreview.
@@ -39,13 +39,17 @@ type RenewalPreview struct {
func (r RenewalPreview) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "next_assessment_at", "subtotal_in_cents", "total_tax_in_cents", "total_discount_in_cents", "total_in_cents", "existing_balance_in_cents", "total_amount_due_in_cents", "uncalculated_taxes", "line_items"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RenewalPreview object to a map representation for JSON marshaling.
func (r RenewalPreview) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.NextAssessmentAt != nil {
structMap["next_assessment_at"] = r.NextAssessmentAt.Format(time.RFC3339)
}
@@ -84,12 +88,12 @@ func (r *RenewalPreview) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "next_assessment_at", "subtotal_in_cents", "total_tax_in_cents", "total_discount_in_cents", "total_in_cents", "existing_balance_in_cents", "total_amount_due_in_cents", "uncalculated_taxes", "line_items")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "next_assessment_at", "subtotal_in_cents", "total_tax_in_cents", "total_discount_in_cents", "total_in_cents", "existing_balance_in_cents", "total_amount_due_in_cents", "uncalculated_taxes", "line_items")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
if temp.NextAssessmentAt != nil {
NextAssessmentAtVal, err := time.Parse(time.RFC3339, *temp.NextAssessmentAt)
if err != nil {
diff --git a/models/renewal_preview_component.go b/models/renewal_preview_component.go
index 3020f705..845f8c11 100644
--- a/models/renewal_preview_component.go
+++ b/models/renewal_preview_component.go
@@ -22,7 +22,7 @@ type RenewalPreviewComponent struct {
Quantity *int `json:"quantity,omitempty"`
// Either the component price point's Chargify id or its handle prefixed with `handle:`
PricePointId *RenewalPreviewComponentPricePointId `json:"price_point_id,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RenewalPreviewComponent.
@@ -30,13 +30,17 @@ type RenewalPreviewComponent struct {
func (r RenewalPreviewComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "component_id", "quantity", "price_point_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RenewalPreviewComponent object to a map representation for JSON marshaling.
func (r RenewalPreviewComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.ComponentId != nil {
structMap["component_id"] = r.ComponentId.toMap()
}
@@ -57,12 +61,12 @@ func (r *RenewalPreviewComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component_id", "quantity", "price_point_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component_id", "quantity", "price_point_id")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.ComponentId = temp.ComponentId
r.Quantity = temp.Quantity
r.PricePointId = temp.PricePointId
diff --git a/models/renewal_preview_line_item.go b/models/renewal_preview_line_item.go
index 1816acc9..be3b3596 100644
--- a/models/renewal_preview_line_item.go
+++ b/models/renewal_preview_line_item.go
@@ -27,7 +27,7 @@ type RenewalPreviewLineItem struct {
ProductHandle *string `json:"product_handle,omitempty"`
PeriodRangeStart *string `json:"period_range_start,omitempty"`
PeriodRangeEnd *string `json:"period_range_end,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RenewalPreviewLineItem.
@@ -35,13 +35,17 @@ type RenewalPreviewLineItem struct {
func (r RenewalPreviewLineItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "transaction_type", "kind", "amount_in_cents", "memo", "discount_amount_in_cents", "taxable_amount_in_cents", "product_id", "product_name", "component_id", "component_handle", "component_name", "product_handle", "period_range_start", "period_range_end"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RenewalPreviewLineItem object to a map representation for JSON marshaling.
func (r RenewalPreviewLineItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.TransactionType != nil {
structMap["transaction_type"] = r.TransactionType
}
@@ -95,12 +99,12 @@ func (r *RenewalPreviewLineItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "transaction_type", "kind", "amount_in_cents", "memo", "discount_amount_in_cents", "taxable_amount_in_cents", "product_id", "product_name", "component_id", "component_handle", "component_name", "product_handle", "period_range_start", "period_range_end")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "transaction_type", "kind", "amount_in_cents", "memo", "discount_amount_in_cents", "taxable_amount_in_cents", "product_id", "product_name", "component_id", "component_handle", "component_name", "product_handle", "period_range_start", "period_range_end")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.TransactionType = temp.TransactionType
r.Kind = temp.Kind
r.AmountInCents = temp.AmountInCents
diff --git a/models/renewal_preview_request.go b/models/renewal_preview_request.go
index f3fbf99d..fa0eea87 100644
--- a/models/renewal_preview_request.go
+++ b/models/renewal_preview_request.go
@@ -13,7 +13,7 @@ import (
type RenewalPreviewRequest struct {
// An optional array of component definitions to preview. Providing any component definitions here will override the actual components on the subscription (and their quantities), and the billing preview will contain only these components (in addition to any product base fees).
Components []RenewalPreviewComponent `json:"components,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RenewalPreviewRequest.
@@ -21,13 +21,17 @@ type RenewalPreviewRequest struct {
func (r RenewalPreviewRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "components"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RenewalPreviewRequest object to a map representation for JSON marshaling.
func (r RenewalPreviewRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.Components != nil {
structMap["components"] = r.Components
}
@@ -42,12 +46,12 @@ func (r *RenewalPreviewRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "components")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "components")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Components = temp.Components
return nil
}
diff --git a/models/renewal_preview_response.go b/models/renewal_preview_response.go
index e6069204..5aaad253 100644
--- a/models/renewal_preview_response.go
+++ b/models/renewal_preview_response.go
@@ -13,8 +13,8 @@ import (
// RenewalPreviewResponse represents a RenewalPreviewResponse struct.
type RenewalPreviewResponse struct {
- RenewalPreview RenewalPreview `json:"renewal_preview"`
- AdditionalProperties map[string]any `json:"_"`
+ RenewalPreview RenewalPreview `json:"renewal_preview"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RenewalPreviewResponse.
@@ -22,13 +22,17 @@ type RenewalPreviewResponse struct {
func (r RenewalPreviewResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "renewal_preview"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RenewalPreviewResponse object to a map representation for JSON marshaling.
func (r RenewalPreviewResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["renewal_preview"] = r.RenewalPreview.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (r *RenewalPreviewResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "renewal_preview")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "renewal_preview")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.RenewalPreview = *temp.RenewalPreview
return nil
}
diff --git a/models/replay_webhooks_request.go b/models/replay_webhooks_request.go
index dfb292da..56c43b3e 100644
--- a/models/replay_webhooks_request.go
+++ b/models/replay_webhooks_request.go
@@ -13,8 +13,8 @@ import (
// ReplayWebhooksRequest represents a ReplayWebhooksRequest struct.
type ReplayWebhooksRequest struct {
- Ids []int64 `json:"ids"`
- AdditionalProperties map[string]any `json:"_"`
+ Ids []int64 `json:"ids"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ReplayWebhooksRequest.
@@ -22,13 +22,17 @@ type ReplayWebhooksRequest struct {
func (r ReplayWebhooksRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "ids"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ReplayWebhooksRequest object to a map representation for JSON marshaling.
func (r ReplayWebhooksRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
structMap["ids"] = r.Ids
return structMap
}
@@ -45,12 +49,12 @@ func (r *ReplayWebhooksRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "ids")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "ids")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Ids = *temp.Ids
return nil
}
diff --git a/models/replay_webhooks_response.go b/models/replay_webhooks_response.go
index c3f3d5ce..ee0b0865 100644
--- a/models/replay_webhooks_response.go
+++ b/models/replay_webhooks_response.go
@@ -11,8 +11,8 @@ import (
// ReplayWebhooksResponse represents a ReplayWebhooksResponse struct.
type ReplayWebhooksResponse struct {
- Status *string `json:"status,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Status *string `json:"status,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ReplayWebhooksResponse.
@@ -20,13 +20,17 @@ type ReplayWebhooksResponse struct {
func (r ReplayWebhooksResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "status"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ReplayWebhooksResponse object to a map representation for JSON marshaling.
func (r ReplayWebhooksResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.Status != nil {
structMap["status"] = r.Status
}
@@ -41,12 +45,12 @@ func (r *ReplayWebhooksResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "status")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "status")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.Status = temp.Status
return nil
}
diff --git a/models/resent_invitation.go b/models/resent_invitation.go
index 33647cc6..c203eaa6 100644
--- a/models/resent_invitation.go
+++ b/models/resent_invitation.go
@@ -13,13 +13,13 @@ import (
// ResentInvitation represents a ResentInvitation struct.
type ResentInvitation struct {
- LastSentAt *string `json:"last_sent_at,omitempty"` // Deprecated
- LastAcceptedAt *string `json:"last_accepted_at,omitempty"` // Deprecated
- SendInviteLinkText *string `json:"send_invite_link_text,omitempty"`
- UninvitedCount *int `json:"uninvited_count,omitempty"`
- LastInviteSentAt *time.Time `json:"last_invite_sent_at,omitempty"`
- LastInviteAcceptedAt *time.Time `json:"last_invite_accepted_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ LastSentAt *string `json:"last_sent_at,omitempty"` // Deprecated
+ LastAcceptedAt *string `json:"last_accepted_at,omitempty"` // Deprecated
+ SendInviteLinkText *string `json:"send_invite_link_text,omitempty"`
+ UninvitedCount *int `json:"uninvited_count,omitempty"`
+ LastInviteSentAt *time.Time `json:"last_invite_sent_at,omitempty"`
+ LastInviteAcceptedAt *time.Time `json:"last_invite_accepted_at,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ResentInvitation.
@@ -27,13 +27,17 @@ type ResentInvitation struct {
func (r ResentInvitation) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "last_sent_at", "last_accepted_at", "send_invite_link_text", "uninvited_count", "last_invite_sent_at", "last_invite_accepted_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ResentInvitation object to a map representation for JSON marshaling.
func (r ResentInvitation) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.LastSentAt != nil {
structMap["last_sent_at"] = r.LastSentAt
}
@@ -63,12 +67,12 @@ func (r *ResentInvitation) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "last_sent_at", "last_accepted_at", "send_invite_link_text", "uninvited_count", "last_invite_sent_at", "last_invite_accepted_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "last_sent_at", "last_accepted_at", "send_invite_link_text", "uninvited_count", "last_invite_sent_at", "last_invite_accepted_at")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.LastSentAt = temp.LastSentAt
r.LastAcceptedAt = temp.LastAcceptedAt
r.SendInviteLinkText = temp.SendInviteLinkText
diff --git a/models/resume_options.go b/models/resume_options.go
index 3dd4cf2c..b3e2c9dd 100644
--- a/models/resume_options.go
+++ b/models/resume_options.go
@@ -12,10 +12,10 @@ import (
// ResumeOptions represents a ResumeOptions struct.
type ResumeOptions struct {
// Chargify will only attempt to resume the subscription's billing period. If not resumable, the subscription will be left in it's current state.
- RequireResume *bool `json:"require_resume,omitempty"`
+ RequireResume *bool `json:"require_resume,omitempty"`
// Indicates whether or not Chargify should clear the subscription's existing balance before attempting to resume the subscription. If subscription cannot be resumed, the balance will remain as it was before the attempt to resume was made.
- ForgiveBalance *bool `json:"forgive_balance,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ForgiveBalance *bool `json:"forgive_balance,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ResumeOptions.
@@ -23,13 +23,17 @@ type ResumeOptions struct {
func (r ResumeOptions) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "require_resume", "forgive_balance"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the ResumeOptions object to a map representation for JSON marshaling.
func (r ResumeOptions) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.RequireResume != nil {
structMap["require_resume"] = r.RequireResume
}
@@ -47,12 +51,12 @@ func (r *ResumeOptions) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "require_resume", "forgive_balance")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "require_resume", "forgive_balance")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.RequireResume = temp.RequireResume
r.ForgiveBalance = temp.ForgiveBalance
return nil
diff --git a/models/revoked_invitation.go b/models/revoked_invitation.go
index 16a470d4..09f9d4f0 100644
--- a/models/revoked_invitation.go
+++ b/models/revoked_invitation.go
@@ -11,10 +11,10 @@ import (
// RevokedInvitation represents a RevokedInvitation struct.
type RevokedInvitation struct {
- LastSentAt *string `json:"last_sent_at,omitempty"`
- LastAcceptedAt *string `json:"last_accepted_at,omitempty"`
- UninvitedCount *int `json:"uninvited_count,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ LastSentAt *string `json:"last_sent_at,omitempty"`
+ LastAcceptedAt *string `json:"last_accepted_at,omitempty"`
+ UninvitedCount *int `json:"uninvited_count,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for RevokedInvitation.
@@ -22,13 +22,17 @@ type RevokedInvitation struct {
func (r RevokedInvitation) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(r.AdditionalProperties,
+ "last_sent_at", "last_accepted_at", "uninvited_count"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(r.toMap())
}
// toMap converts the RevokedInvitation object to a map representation for JSON marshaling.
func (r RevokedInvitation) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, r.AdditionalProperties)
+ MergeAdditionalProperties(structMap, r.AdditionalProperties)
if r.LastSentAt != nil {
structMap["last_sent_at"] = r.LastSentAt
}
@@ -49,12 +53,12 @@ func (r *RevokedInvitation) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "last_sent_at", "last_accepted_at", "uninvited_count")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "last_sent_at", "last_accepted_at", "uninvited_count")
if err != nil {
return err
}
-
r.AdditionalProperties = additionalProperties
+
r.LastSentAt = temp.LastSentAt
r.LastAcceptedAt = temp.LastAcceptedAt
r.UninvitedCount = temp.UninvitedCount
diff --git a/models/sale_rep.go b/models/sale_rep.go
index 21b385f4..3ad0b425 100644
--- a/models/sale_rep.go
+++ b/models/sale_rep.go
@@ -11,12 +11,12 @@ import (
// SaleRep represents a SaleRep struct.
type SaleRep struct {
- Id *int `json:"id,omitempty"`
- FullName *string `json:"full_name,omitempty"`
- SubscriptionsCount *int `json:"subscriptions_count,omitempty"`
- TestMode *bool `json:"test_mode,omitempty"`
- Subscriptions []SaleRepSubscription `json:"subscriptions,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ FullName *string `json:"full_name,omitempty"`
+ SubscriptionsCount *int `json:"subscriptions_count,omitempty"`
+ TestMode *bool `json:"test_mode,omitempty"`
+ Subscriptions []SaleRepSubscription `json:"subscriptions,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SaleRep.
@@ -24,13 +24,17 @@ type SaleRep struct {
func (s SaleRep) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "full_name", "subscriptions_count", "test_mode", "subscriptions"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SaleRep object to a map representation for JSON marshaling.
func (s SaleRep) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -57,12 +61,12 @@ func (s *SaleRep) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "full_name", "subscriptions_count", "test_mode", "subscriptions")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "full_name", "subscriptions_count", "test_mode", "subscriptions")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.FullName = temp.FullName
s.SubscriptionsCount = temp.SubscriptionsCount
diff --git a/models/sale_rep_item_mrr.go b/models/sale_rep_item_mrr.go
index 85f15c12..68ee9f19 100644
--- a/models/sale_rep_item_mrr.go
+++ b/models/sale_rep_item_mrr.go
@@ -11,10 +11,10 @@ import (
// SaleRepItemMrr represents a SaleRepItemMrr struct.
type SaleRepItemMrr struct {
- Mrr *string `json:"mrr,omitempty"`
- Usage *string `json:"usage,omitempty"`
- Recurring *string `json:"recurring,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Mrr *string `json:"mrr,omitempty"`
+ Usage *string `json:"usage,omitempty"`
+ Recurring *string `json:"recurring,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SaleRepItemMrr.
@@ -22,13 +22,17 @@ type SaleRepItemMrr struct {
func (s SaleRepItemMrr) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "mrr", "usage", "recurring"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SaleRepItemMrr object to a map representation for JSON marshaling.
func (s SaleRepItemMrr) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Mrr != nil {
structMap["mrr"] = s.Mrr
}
@@ -49,12 +53,12 @@ func (s *SaleRepItemMrr) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "mrr", "usage", "recurring")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "mrr", "usage", "recurring")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Mrr = temp.Mrr
s.Usage = temp.Usage
s.Recurring = temp.Recurring
diff --git a/models/sale_rep_settings.go b/models/sale_rep_settings.go
index a39cd10f..89dcca38 100644
--- a/models/sale_rep_settings.go
+++ b/models/sale_rep_settings.go
@@ -11,14 +11,14 @@ import (
// SaleRepSettings represents a SaleRepSettings struct.
type SaleRepSettings struct {
- CustomerName *string `json:"customer_name,omitempty"`
- SubscriptionId *int `json:"subscription_id,omitempty"`
- SiteLink *string `json:"site_link,omitempty"`
- SiteName *string `json:"site_name,omitempty"`
- SubscriptionMrr *string `json:"subscription_mrr,omitempty"`
- SalesRepId *int `json:"sales_rep_id,omitempty"`
- SalesRepName *string `json:"sales_rep_name,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CustomerName *string `json:"customer_name,omitempty"`
+ SubscriptionId *int `json:"subscription_id,omitempty"`
+ SiteLink *string `json:"site_link,omitempty"`
+ SiteName *string `json:"site_name,omitempty"`
+ SubscriptionMrr *string `json:"subscription_mrr,omitempty"`
+ SalesRepId *int `json:"sales_rep_id,omitempty"`
+ SalesRepName *string `json:"sales_rep_name,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SaleRepSettings.
@@ -26,13 +26,17 @@ type SaleRepSettings struct {
func (s SaleRepSettings) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "customer_name", "subscription_id", "site_link", "site_name", "subscription_mrr", "sales_rep_id", "sales_rep_name"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SaleRepSettings object to a map representation for JSON marshaling.
func (s SaleRepSettings) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.CustomerName != nil {
structMap["customer_name"] = s.CustomerName
}
@@ -65,12 +69,12 @@ func (s *SaleRepSettings) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "customer_name", "subscription_id", "site_link", "site_name", "subscription_mrr", "sales_rep_id", "sales_rep_name")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "customer_name", "subscription_id", "site_link", "site_name", "subscription_mrr", "sales_rep_id", "sales_rep_name")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.CustomerName = temp.CustomerName
s.SubscriptionId = temp.SubscriptionId
s.SiteLink = temp.SiteLink
diff --git a/models/sale_rep_subscription.go b/models/sale_rep_subscription.go
index 272db93a..2e845c44 100644
--- a/models/sale_rep_subscription.go
+++ b/models/sale_rep_subscription.go
@@ -11,17 +11,17 @@ import (
// SaleRepSubscription represents a SaleRepSubscription struct.
type SaleRepSubscription struct {
- Id *int `json:"id,omitempty"`
- SiteName *string `json:"site_name,omitempty"`
- SubscriptionUrl *string `json:"subscription_url,omitempty"`
- CustomerName *string `json:"customer_name,omitempty"`
- CreatedAt *string `json:"created_at,omitempty"`
- Mrr *string `json:"mrr,omitempty"`
- Usage *string `json:"usage,omitempty"`
- Recurring *string `json:"recurring,omitempty"`
- LastPayment *string `json:"last_payment,omitempty"`
- ChurnDate Optional[string] `json:"churn_date"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ SiteName *string `json:"site_name,omitempty"`
+ SubscriptionUrl *string `json:"subscription_url,omitempty"`
+ CustomerName *string `json:"customer_name,omitempty"`
+ CreatedAt *string `json:"created_at,omitempty"`
+ Mrr *string `json:"mrr,omitempty"`
+ Usage *string `json:"usage,omitempty"`
+ Recurring *string `json:"recurring,omitempty"`
+ LastPayment *string `json:"last_payment,omitempty"`
+ ChurnDate Optional[string] `json:"churn_date"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SaleRepSubscription.
@@ -29,13 +29,17 @@ type SaleRepSubscription struct {
func (s SaleRepSubscription) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "site_name", "subscription_url", "customer_name", "created_at", "mrr", "usage", "recurring", "last_payment", "churn_date"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SaleRepSubscription object to a map representation for JSON marshaling.
func (s SaleRepSubscription) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -81,12 +85,12 @@ func (s *SaleRepSubscription) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "site_name", "subscription_url", "customer_name", "created_at", "mrr", "usage", "recurring", "last_payment", "churn_date")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "site_name", "subscription_url", "customer_name", "created_at", "mrr", "usage", "recurring", "last_payment", "churn_date")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.SiteName = temp.SiteName
s.SubscriptionUrl = temp.SubscriptionUrl
diff --git a/models/segment.go b/models/segment.go
index 34168423..6b640b3d 100644
--- a/models/segment.go
+++ b/models/segment.go
@@ -26,7 +26,7 @@ type Segment struct {
CreatedAt *time.Time `json:"created_at,omitempty"`
UpdatedAt *time.Time `json:"updated_at,omitempty"`
Prices []SegmentPrice `json:"prices,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Segment.
@@ -34,13 +34,17 @@ type Segment struct {
func (s Segment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "component_id", "price_point_id", "event_based_billing_metric_id", "pricing_scheme", "segment_property_1_value", "segment_property_2_value", "segment_property_3_value", "segment_property_4_value", "created_at", "updated_at", "prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the Segment object to a map representation for JSON marshaling.
func (s Segment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -88,12 +92,12 @@ func (s *Segment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "component_id", "price_point_id", "event_based_billing_metric_id", "pricing_scheme", "segment_property_1_value", "segment_property_2_value", "segment_property_3_value", "segment_property_4_value", "created_at", "updated_at", "prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "component_id", "price_point_id", "event_based_billing_metric_id", "pricing_scheme", "segment_property_1_value", "segment_property_2_value", "segment_property_3_value", "segment_property_4_value", "created_at", "updated_at", "prices")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.ComponentId = temp.ComponentId
s.PricePointId = temp.PricePointId
diff --git a/models/segment_price.go b/models/segment_price.go
index b5699cec..77f670a7 100644
--- a/models/segment_price.go
+++ b/models/segment_price.go
@@ -11,15 +11,15 @@ import (
// SegmentPrice represents a SegmentPrice struct.
type SegmentPrice struct {
- Id *int `json:"id,omitempty"`
- ComponentId *int `json:"component_id,omitempty"`
- StartingQuantity *int `json:"starting_quantity,omitempty"`
- EndingQuantity Optional[int] `json:"ending_quantity"`
- UnitPrice *string `json:"unit_price,omitempty"`
- PricePointId *int `json:"price_point_id,omitempty"`
- FormattedUnitPrice *string `json:"formatted_unit_price,omitempty"`
- SegmentId *int `json:"segment_id,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ ComponentId *int `json:"component_id,omitempty"`
+ StartingQuantity *int `json:"starting_quantity,omitempty"`
+ EndingQuantity Optional[int] `json:"ending_quantity"`
+ UnitPrice *string `json:"unit_price,omitempty"`
+ PricePointId *int `json:"price_point_id,omitempty"`
+ FormattedUnitPrice *string `json:"formatted_unit_price,omitempty"`
+ SegmentId *int `json:"segment_id,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SegmentPrice.
@@ -27,13 +27,17 @@ type SegmentPrice struct {
func (s SegmentPrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "component_id", "starting_quantity", "ending_quantity", "unit_price", "price_point_id", "formatted_unit_price", "segment_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SegmentPrice object to a map representation for JSON marshaling.
func (s SegmentPrice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -73,12 +77,12 @@ func (s *SegmentPrice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "component_id", "starting_quantity", "ending_quantity", "unit_price", "price_point_id", "formatted_unit_price", "segment_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "component_id", "starting_quantity", "ending_quantity", "unit_price", "price_point_id", "formatted_unit_price", "segment_id")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.ComponentId = temp.ComponentId
s.StartingQuantity = temp.StartingQuantity
diff --git a/models/segment_response.go b/models/segment_response.go
index 4e505bd1..0027ec2f 100644
--- a/models/segment_response.go
+++ b/models/segment_response.go
@@ -11,8 +11,8 @@ import (
// SegmentResponse represents a SegmentResponse struct.
type SegmentResponse struct {
- Segment *Segment `json:"segment,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Segment *Segment `json:"segment,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SegmentResponse.
@@ -20,13 +20,17 @@ type SegmentResponse struct {
func (s SegmentResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "segment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SegmentResponse object to a map representation for JSON marshaling.
func (s SegmentResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Segment != nil {
structMap["segment"] = s.Segment.toMap()
}
@@ -41,12 +45,12 @@ func (s *SegmentResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "segment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "segment")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Segment = temp.Segment
return nil
}
diff --git a/models/send_invoice_request.go b/models/send_invoice_request.go
index 10775320..cbd0ea9d 100644
--- a/models/send_invoice_request.go
+++ b/models/send_invoice_request.go
@@ -11,10 +11,10 @@ import (
// SendInvoiceRequest represents a SendInvoiceRequest struct.
type SendInvoiceRequest struct {
- RecipientEmails []string `json:"recipient_emails,omitempty"`
- CcRecipientEmails []string `json:"cc_recipient_emails,omitempty"`
- BccRecipientEmails []string `json:"bcc_recipient_emails,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ RecipientEmails []string `json:"recipient_emails,omitempty"`
+ CcRecipientEmails []string `json:"cc_recipient_emails,omitempty"`
+ BccRecipientEmails []string `json:"bcc_recipient_emails,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SendInvoiceRequest.
@@ -22,13 +22,17 @@ type SendInvoiceRequest struct {
func (s SendInvoiceRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "recipient_emails", "cc_recipient_emails", "bcc_recipient_emails"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SendInvoiceRequest object to a map representation for JSON marshaling.
func (s SendInvoiceRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.RecipientEmails != nil {
structMap["recipient_emails"] = s.RecipientEmails
}
@@ -49,12 +53,12 @@ func (s *SendInvoiceRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "recipient_emails", "cc_recipient_emails", "bcc_recipient_emails")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "recipient_emails", "cc_recipient_emails", "bcc_recipient_emails")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.RecipientEmails = temp.RecipientEmails
s.CcRecipientEmails = temp.CcRecipientEmails
s.BccRecipientEmails = temp.BccRecipientEmails
diff --git a/models/service_credit.go b/models/service_credit.go
index 025f7857..94a82fe1 100644
--- a/models/service_credit.go
+++ b/models/service_credit.go
@@ -11,16 +11,16 @@ import (
// ServiceCredit represents a ServiceCredit struct.
type ServiceCredit struct {
- Id *int `json:"id,omitempty"`
+ Id *int `json:"id,omitempty"`
// The amount in cents of the entry
- AmountInCents *int64 `json:"amount_in_cents,omitempty"`
+ AmountInCents *int64 `json:"amount_in_cents,omitempty"`
// The new balance for the credit account
- EndingBalanceInCents *int64 `json:"ending_balance_in_cents,omitempty"`
+ EndingBalanceInCents *int64 `json:"ending_balance_in_cents,omitempty"`
// The type of entry
- EntryType *ServiceCreditType `json:"entry_type,omitempty"`
+ EntryType *ServiceCreditType `json:"entry_type,omitempty"`
// The memo attached to the entry
- Memo *string `json:"memo,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Memo *string `json:"memo,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ServiceCredit.
@@ -28,13 +28,17 @@ type ServiceCredit struct {
func (s ServiceCredit) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "amount_in_cents", "ending_balance_in_cents", "entry_type", "memo"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the ServiceCredit object to a map representation for JSON marshaling.
func (s ServiceCredit) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -61,12 +65,12 @@ func (s *ServiceCredit) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "amount_in_cents", "ending_balance_in_cents", "entry_type", "memo")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "amount_in_cents", "ending_balance_in_cents", "entry_type", "memo")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.AmountInCents = temp.AmountInCents
s.EndingBalanceInCents = temp.EndingBalanceInCents
diff --git a/models/service_credit_response.go b/models/service_credit_response.go
index 45820706..7e741042 100644
--- a/models/service_credit_response.go
+++ b/models/service_credit_response.go
@@ -13,8 +13,8 @@ import (
// ServiceCreditResponse represents a ServiceCreditResponse struct.
type ServiceCreditResponse struct {
- ServiceCredit ServiceCredit `json:"service_credit"`
- AdditionalProperties map[string]any `json:"_"`
+ ServiceCredit ServiceCredit `json:"service_credit"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for ServiceCreditResponse.
@@ -22,13 +22,17 @@ type ServiceCreditResponse struct {
func (s ServiceCreditResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "service_credit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the ServiceCreditResponse object to a map representation for JSON marshaling.
func (s ServiceCreditResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["service_credit"] = s.ServiceCredit.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (s *ServiceCreditResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "service_credit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "service_credit")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.ServiceCredit = *temp.ServiceCredit
return nil
}
diff --git a/models/signup_proforma_preview.go b/models/signup_proforma_preview.go
index e9159ac9..491a2d29 100644
--- a/models/signup_proforma_preview.go
+++ b/models/signup_proforma_preview.go
@@ -11,9 +11,9 @@ import (
// SignupProformaPreview represents a SignupProformaPreview struct.
type SignupProformaPreview struct {
- CurrentProformaInvoice *ProformaInvoice `json:"current_proforma_invoice,omitempty"`
- NextProformaInvoice *ProformaInvoice `json:"next_proforma_invoice,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CurrentProformaInvoice *ProformaInvoice `json:"current_proforma_invoice,omitempty"`
+ NextProformaInvoice *ProformaInvoice `json:"next_proforma_invoice,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SignupProformaPreview.
@@ -21,13 +21,17 @@ type SignupProformaPreview struct {
func (s SignupProformaPreview) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "current_proforma_invoice", "next_proforma_invoice"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SignupProformaPreview object to a map representation for JSON marshaling.
func (s SignupProformaPreview) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.CurrentProformaInvoice != nil {
structMap["current_proforma_invoice"] = s.CurrentProformaInvoice.toMap()
}
@@ -45,12 +49,12 @@ func (s *SignupProformaPreview) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "current_proforma_invoice", "next_proforma_invoice")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "current_proforma_invoice", "next_proforma_invoice")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.CurrentProformaInvoice = temp.CurrentProformaInvoice
s.NextProformaInvoice = temp.NextProformaInvoice
return nil
diff --git a/models/signup_proforma_preview_response.go b/models/signup_proforma_preview_response.go
index 249fd688..0c7ac3fc 100644
--- a/models/signup_proforma_preview_response.go
+++ b/models/signup_proforma_preview_response.go
@@ -13,8 +13,8 @@ import (
// SignupProformaPreviewResponse represents a SignupProformaPreviewResponse struct.
type SignupProformaPreviewResponse struct {
- ProformaInvoicePreview SignupProformaPreview `json:"proforma_invoice_preview"`
- AdditionalProperties map[string]any `json:"_"`
+ ProformaInvoicePreview SignupProformaPreview `json:"proforma_invoice_preview"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SignupProformaPreviewResponse.
@@ -22,13 +22,17 @@ type SignupProformaPreviewResponse struct {
func (s SignupProformaPreviewResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "proforma_invoice_preview"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SignupProformaPreviewResponse object to a map representation for JSON marshaling.
func (s SignupProformaPreviewResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["proforma_invoice_preview"] = s.ProformaInvoicePreview.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (s *SignupProformaPreviewResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "proforma_invoice_preview")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "proforma_invoice_preview")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.ProformaInvoicePreview = *temp.ProformaInvoicePreview
return nil
}
diff --git a/models/site.go b/models/site.go
index 8c11f45d..6f4353a9 100644
--- a/models/site.go
+++ b/models/site.go
@@ -11,23 +11,23 @@ import (
// Site represents a Site struct.
type Site struct {
- Id *int `json:"id,omitempty"`
- Name *string `json:"name,omitempty"`
- Subdomain *string `json:"subdomain,omitempty"`
- Currency *string `json:"currency,omitempty"`
- SellerId *int `json:"seller_id,omitempty"`
- NonPrimaryCurrencies []string `json:"non_primary_currencies,omitempty"`
- RelationshipInvoicingEnabled *bool `json:"relationship_invoicing_enabled,omitempty"`
- CustomerHierarchyEnabled *bool `json:"customer_hierarchy_enabled,omitempty"`
- WhopaysEnabled *bool `json:"whopays_enabled,omitempty"`
- WhopaysDefaultPayer *string `json:"whopays_default_payer,omitempty"`
- AllocationSettings *AllocationSettings `json:"allocation_settings,omitempty"`
- DefaultPaymentCollectionMethod *string `json:"default_payment_collection_method,omitempty"`
- OrganizationAddress *OrganizationAddress `json:"organization_address,omitempty"`
- TaxConfiguration *TaxConfiguration `json:"tax_configuration,omitempty"`
- NetTerms *NetTerms `json:"net_terms,omitempty"`
- Test *bool `json:"test,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Subdomain *string `json:"subdomain,omitempty"`
+ Currency *string `json:"currency,omitempty"`
+ SellerId *int `json:"seller_id,omitempty"`
+ NonPrimaryCurrencies []string `json:"non_primary_currencies,omitempty"`
+ RelationshipInvoicingEnabled *bool `json:"relationship_invoicing_enabled,omitempty"`
+ CustomerHierarchyEnabled *bool `json:"customer_hierarchy_enabled,omitempty"`
+ WhopaysEnabled *bool `json:"whopays_enabled,omitempty"`
+ WhopaysDefaultPayer *string `json:"whopays_default_payer,omitempty"`
+ AllocationSettings *AllocationSettings `json:"allocation_settings,omitempty"`
+ DefaultPaymentCollectionMethod *string `json:"default_payment_collection_method,omitempty"`
+ OrganizationAddress *OrganizationAddress `json:"organization_address,omitempty"`
+ TaxConfiguration *TaxConfiguration `json:"tax_configuration,omitempty"`
+ NetTerms *NetTerms `json:"net_terms,omitempty"`
+ Test *bool `json:"test,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Site.
@@ -35,13 +35,17 @@ type Site struct {
func (s Site) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "name", "subdomain", "currency", "seller_id", "non_primary_currencies", "relationship_invoicing_enabled", "customer_hierarchy_enabled", "whopays_enabled", "whopays_default_payer", "allocation_settings", "default_payment_collection_method", "organization_address", "tax_configuration", "net_terms", "test"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the Site object to a map representation for JSON marshaling.
func (s Site) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -101,12 +105,12 @@ func (s *Site) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "name", "subdomain", "currency", "seller_id", "non_primary_currencies", "relationship_invoicing_enabled", "customer_hierarchy_enabled", "whopays_enabled", "whopays_default_payer", "allocation_settings", "default_payment_collection_method", "organization_address", "tax_configuration", "net_terms", "test")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "name", "subdomain", "currency", "seller_id", "non_primary_currencies", "relationship_invoicing_enabled", "customer_hierarchy_enabled", "whopays_enabled", "whopays_default_payer", "allocation_settings", "default_payment_collection_method", "organization_address", "tax_configuration", "net_terms", "test")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.Name = temp.Name
s.Subdomain = temp.Subdomain
diff --git a/models/site_response.go b/models/site_response.go
index 0f44cc97..72c1c3f9 100644
--- a/models/site_response.go
+++ b/models/site_response.go
@@ -13,8 +13,8 @@ import (
// SiteResponse represents a SiteResponse struct.
type SiteResponse struct {
- Site Site `json:"site"`
- AdditionalProperties map[string]any `json:"_"`
+ Site Site `json:"site"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SiteResponse.
@@ -22,13 +22,17 @@ type SiteResponse struct {
func (s SiteResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "site"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SiteResponse object to a map representation for JSON marshaling.
func (s SiteResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["site"] = s.Site.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (s *SiteResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "site")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "site")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Site = *temp.Site
return nil
}
diff --git a/models/site_statistics.go b/models/site_statistics.go
index ee294ff8..faf483d1 100644
--- a/models/site_statistics.go
+++ b/models/site_statistics.go
@@ -11,18 +11,18 @@ import (
// SiteStatistics represents a SiteStatistics struct.
type SiteStatistics struct {
- TotalSubscriptions *int `json:"total_subscriptions,omitempty"`
- SubscriptionsToday *int `json:"subscriptions_today,omitempty"`
- TotalRevenue *string `json:"total_revenue,omitempty"`
- RevenueToday *string `json:"revenue_today,omitempty"`
- RevenueThisMonth *string `json:"revenue_this_month,omitempty"`
- RevenueThisYear *string `json:"revenue_this_year,omitempty"`
- TotalCanceledSubscriptions *int `json:"total_canceled_subscriptions,omitempty"`
- TotalActiveSubscriptions *int `json:"total_active_subscriptions,omitempty"`
- TotalPastDueSubscriptions *int `json:"total_past_due_subscriptions,omitempty"`
- TotalUnpaidSubscriptions *int `json:"total_unpaid_subscriptions,omitempty"`
- TotalDunningSubscriptions *int `json:"total_dunning_subscriptions,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ TotalSubscriptions *int `json:"total_subscriptions,omitempty"`
+ SubscriptionsToday *int `json:"subscriptions_today,omitempty"`
+ TotalRevenue *string `json:"total_revenue,omitempty"`
+ RevenueToday *string `json:"revenue_today,omitempty"`
+ RevenueThisMonth *string `json:"revenue_this_month,omitempty"`
+ RevenueThisYear *string `json:"revenue_this_year,omitempty"`
+ TotalCanceledSubscriptions *int `json:"total_canceled_subscriptions,omitempty"`
+ TotalActiveSubscriptions *int `json:"total_active_subscriptions,omitempty"`
+ TotalPastDueSubscriptions *int `json:"total_past_due_subscriptions,omitempty"`
+ TotalUnpaidSubscriptions *int `json:"total_unpaid_subscriptions,omitempty"`
+ TotalDunningSubscriptions *int `json:"total_dunning_subscriptions,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SiteStatistics.
@@ -30,13 +30,17 @@ type SiteStatistics struct {
func (s SiteStatistics) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "total_subscriptions", "subscriptions_today", "total_revenue", "revenue_today", "revenue_this_month", "revenue_this_year", "total_canceled_subscriptions", "total_active_subscriptions", "total_past_due_subscriptions", "total_unpaid_subscriptions", "total_dunning_subscriptions"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SiteStatistics object to a map representation for JSON marshaling.
func (s SiteStatistics) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.TotalSubscriptions != nil {
structMap["total_subscriptions"] = s.TotalSubscriptions
}
@@ -81,12 +85,12 @@ func (s *SiteStatistics) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "total_subscriptions", "subscriptions_today", "total_revenue", "revenue_today", "revenue_this_month", "revenue_this_year", "total_canceled_subscriptions", "total_active_subscriptions", "total_past_due_subscriptions", "total_unpaid_subscriptions", "total_dunning_subscriptions")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "total_subscriptions", "subscriptions_today", "total_revenue", "revenue_today", "revenue_this_month", "revenue_this_year", "total_canceled_subscriptions", "total_active_subscriptions", "total_past_due_subscriptions", "total_unpaid_subscriptions", "total_dunning_subscriptions")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.TotalSubscriptions = temp.TotalSubscriptions
s.SubscriptionsToday = temp.SubscriptionsToday
s.TotalRevenue = temp.TotalRevenue
diff --git a/models/site_summary.go b/models/site_summary.go
index 90c8fc5b..1df42af4 100644
--- a/models/site_summary.go
+++ b/models/site_summary.go
@@ -11,12 +11,12 @@ import (
// SiteSummary represents a SiteSummary struct.
type SiteSummary struct {
- SellerName *string `json:"seller_name,omitempty"`
- SiteName *string `json:"site_name,omitempty"`
- SiteId *int `json:"site_id,omitempty"`
- SiteCurrency *string `json:"site_currency,omitempty"`
- Stats *SiteStatistics `json:"stats,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ SellerName *string `json:"seller_name,omitempty"`
+ SiteName *string `json:"site_name,omitempty"`
+ SiteId *int `json:"site_id,omitempty"`
+ SiteCurrency *string `json:"site_currency,omitempty"`
+ Stats *SiteStatistics `json:"stats,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SiteSummary.
@@ -24,13 +24,17 @@ type SiteSummary struct {
func (s SiteSummary) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "seller_name", "site_name", "site_id", "site_currency", "stats"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SiteSummary object to a map representation for JSON marshaling.
func (s SiteSummary) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.SellerName != nil {
structMap["seller_name"] = s.SellerName
}
@@ -57,12 +61,12 @@ func (s *SiteSummary) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "seller_name", "site_name", "site_id", "site_currency", "stats")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "seller_name", "site_name", "site_id", "site_currency", "stats")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.SellerName = temp.SellerName
s.SiteName = temp.SiteName
s.SiteId = temp.SiteId
diff --git a/models/subscription.go b/models/subscription.go
index a026b28b..c2fee72a 100644
--- a/models/subscription.go
+++ b/models/subscription.go
@@ -148,7 +148,7 @@ type Subscription struct {
PrepaidConfiguration Optional[PrepaidConfiguration] `json:"prepaid_configuration"`
// Returned only for list/read Subscription operation when `include[]=self_service_page_token` parameter is provided.
SelfServicePageToken *string `json:"self_service_page_token,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Subscription.
@@ -156,13 +156,17 @@ type Subscription struct {
func (s Subscription) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "state", "balance_in_cents", "total_revenue_in_cents", "product_price_in_cents", "product_version_number", "current_period_ends_at", "next_assessment_at", "trial_started_at", "trial_ended_at", "activated_at", "expires_at", "created_at", "updated_at", "cancellation_message", "cancellation_method", "cancel_at_end_of_period", "canceled_at", "current_period_started_at", "previous_state", "signup_payment_id", "signup_revenue", "delayed_cancel_at", "coupon_code", "snap_day", "payment_collection_method", "customer", "product", "credit_card", "group", "bank_account", "payment_type", "referral_code", "next_product_id", "next_product_handle", "coupon_use_count", "coupon_uses_allowed", "reason_code", "automatically_resume_at", "coupon_codes", "offer_id", "payer_id", "current_billing_amount_in_cents", "product_price_point_id", "product_price_point_type", "next_product_price_point_id", "net_terms", "stored_credential_transaction_id", "reference", "on_hold_at", "prepaid_dunning", "coupons", "dunning_communication_delay_enabled", "dunning_communication_delay_time_zone", "receives_invoice_emails", "locale", "currency", "scheduled_cancellation_at", "credit_balance_in_cents", "prepayment_balance_in_cents", "prepaid_configuration", "self_service_page_token"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the Subscription object to a map representation for JSON marshaling.
func (s Subscription) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -560,12 +564,12 @@ func (s *Subscription) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "state", "balance_in_cents", "total_revenue_in_cents", "product_price_in_cents", "product_version_number", "current_period_ends_at", "next_assessment_at", "trial_started_at", "trial_ended_at", "activated_at", "expires_at", "created_at", "updated_at", "cancellation_message", "cancellation_method", "cancel_at_end_of_period", "canceled_at", "current_period_started_at", "previous_state", "signup_payment_id", "signup_revenue", "delayed_cancel_at", "coupon_code", "snap_day", "payment_collection_method", "customer", "product", "credit_card", "group", "bank_account", "payment_type", "referral_code", "next_product_id", "next_product_handle", "coupon_use_count", "coupon_uses_allowed", "reason_code", "automatically_resume_at", "coupon_codes", "offer_id", "payer_id", "current_billing_amount_in_cents", "product_price_point_id", "product_price_point_type", "next_product_price_point_id", "net_terms", "stored_credential_transaction_id", "reference", "on_hold_at", "prepaid_dunning", "coupons", "dunning_communication_delay_enabled", "dunning_communication_delay_time_zone", "receives_invoice_emails", "locale", "currency", "scheduled_cancellation_at", "credit_balance_in_cents", "prepayment_balance_in_cents", "prepaid_configuration", "self_service_page_token")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "state", "balance_in_cents", "total_revenue_in_cents", "product_price_in_cents", "product_version_number", "current_period_ends_at", "next_assessment_at", "trial_started_at", "trial_ended_at", "activated_at", "expires_at", "created_at", "updated_at", "cancellation_message", "cancellation_method", "cancel_at_end_of_period", "canceled_at", "current_period_started_at", "previous_state", "signup_payment_id", "signup_revenue", "delayed_cancel_at", "coupon_code", "snap_day", "payment_collection_method", "customer", "product", "credit_card", "group", "bank_account", "payment_type", "referral_code", "next_product_id", "next_product_handle", "coupon_use_count", "coupon_uses_allowed", "reason_code", "automatically_resume_at", "coupon_codes", "offer_id", "payer_id", "current_billing_amount_in_cents", "product_price_point_id", "product_price_point_type", "next_product_price_point_id", "net_terms", "stored_credential_transaction_id", "reference", "on_hold_at", "prepaid_dunning", "coupons", "dunning_communication_delay_enabled", "dunning_communication_delay_time_zone", "receives_invoice_emails", "locale", "currency", "scheduled_cancellation_at", "credit_balance_in_cents", "prepayment_balance_in_cents", "prepaid_configuration", "self_service_page_token")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.State = temp.State
s.BalanceInCents = temp.BalanceInCents
diff --git a/models/subscription_component.go b/models/subscription_component.go
index 616dd6be..678ac5e6 100644
--- a/models/subscription_component.go
+++ b/models/subscription_component.go
@@ -55,7 +55,7 @@ type SubscriptionComponent struct {
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 Optional[IntervalUnit] `json:"interval_unit"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionComponent.
@@ -63,13 +63,17 @@ type SubscriptionComponent struct {
func (s SubscriptionComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "name", "kind", "unit_name", "enabled", "unit_balance", "currency", "allocated_quantity", "pricing_scheme", "component_id", "component_handle", "subscription_id", "recurring", "upgrade_charge", "downgrade_credit", "archived_at", "price_point_id", "price_point_handle", "price_point_type", "price_point_name", "product_family_id", "product_family_handle", "created_at", "updated_at", "use_site_exchange_rate", "description", "allow_fractional_quantities", "subscription", "historic_usages", "display_on_hosted_page", "interval", "interval_unit"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionComponent object to a map representation for JSON marshaling.
func (s SubscriptionComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -230,12 +234,12 @@ func (s *SubscriptionComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "name", "kind", "unit_name", "enabled", "unit_balance", "currency", "allocated_quantity", "pricing_scheme", "component_id", "component_handle", "subscription_id", "recurring", "upgrade_charge", "downgrade_credit", "archived_at", "price_point_id", "price_point_handle", "price_point_type", "price_point_name", "product_family_id", "product_family_handle", "created_at", "updated_at", "use_site_exchange_rate", "description", "allow_fractional_quantities", "subscription", "historic_usages", "display_on_hosted_page", "interval", "interval_unit")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "name", "kind", "unit_name", "enabled", "unit_balance", "currency", "allocated_quantity", "pricing_scheme", "component_id", "component_handle", "subscription_id", "recurring", "upgrade_charge", "downgrade_credit", "archived_at", "price_point_id", "price_point_handle", "price_point_type", "price_point_name", "product_family_id", "product_family_handle", "created_at", "updated_at", "use_site_exchange_rate", "description", "allow_fractional_quantities", "subscription", "historic_usages", "display_on_hosted_page", "interval", "interval_unit")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.Name = temp.Name
s.Kind = temp.Kind
diff --git a/models/subscription_component_allocation_error_item.go b/models/subscription_component_allocation_error_item.go
index a06aeac0..a6e6f734 100644
--- a/models/subscription_component_allocation_error_item.go
+++ b/models/subscription_component_allocation_error_item.go
@@ -11,9 +11,9 @@ import (
// SubscriptionComponentAllocationErrorItem represents a SubscriptionComponentAllocationErrorItem struct.
type SubscriptionComponentAllocationErrorItem struct {
- Kind *string `json:"kind,omitempty"`
- Message *string `json:"message,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Kind *string `json:"kind,omitempty"`
+ Message *string `json:"message,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionComponentAllocationErrorItem.
@@ -21,13 +21,17 @@ type SubscriptionComponentAllocationErrorItem struct {
func (s SubscriptionComponentAllocationErrorItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "kind", "message"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionComponentAllocationErrorItem object to a map representation for JSON marshaling.
func (s SubscriptionComponentAllocationErrorItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Kind != nil {
structMap["kind"] = s.Kind
}
@@ -45,12 +49,12 @@ func (s *SubscriptionComponentAllocationErrorItem) UnmarshalJSON(input []byte) e
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "kind", "message")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "kind", "message")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Kind = temp.Kind
s.Message = temp.Message
return nil
diff --git a/models/subscription_component_response.go b/models/subscription_component_response.go
index 5cbe8c13..6addc3dd 100644
--- a/models/subscription_component_response.go
+++ b/models/subscription_component_response.go
@@ -12,7 +12,7 @@ import (
// SubscriptionComponentResponse represents a SubscriptionComponentResponse struct.
type SubscriptionComponentResponse struct {
Component *SubscriptionComponent `json:"component,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionComponentResponse.
@@ -20,13 +20,17 @@ type SubscriptionComponentResponse struct {
func (s SubscriptionComponentResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "component"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionComponentResponse object to a map representation for JSON marshaling.
func (s SubscriptionComponentResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Component != nil {
structMap["component"] = s.Component.toMap()
}
@@ -41,12 +45,12 @@ func (s *SubscriptionComponentResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Component = temp.Component
return nil
}
diff --git a/models/subscription_component_subscription.go b/models/subscription_component_subscription.go
index e2df0bdd..2d619c57 100644
--- a/models/subscription_component_subscription.go
+++ b/models/subscription_component_subscription.go
@@ -34,9 +34,9 @@ type SubscriptionComponentSubscription struct {
// * `suspended` - Indicates that a prepaid subscription has used up all their prepayment balance. If a prepayment is applied, it will return to an active state.
// * `trial_ended` - A subscription in a trial_ended state is a subscription that completed a no-obligation trial and did not have a card on file at the expiration of the trial period. See [Product Pricing – No Obligation Trials](https://maxio.zendesk.com/hc/en-us/articles/24261076617869-Product-Editing) for more details.
// See [Subscription States](https://maxio.zendesk.com/hc/en-us/articles/24252119027853-Subscription-States) for more info about subscription states and state transitions.
- State *SubscriptionState `json:"state,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ State *SubscriptionState `json:"state,omitempty"`
+ UpdatedAt *time.Time `json:"updated_at,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionComponentSubscription.
@@ -44,13 +44,17 @@ type SubscriptionComponentSubscription struct {
func (s SubscriptionComponentSubscription) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "state", "updated_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionComponentSubscription object to a map representation for JSON marshaling.
func (s SubscriptionComponentSubscription) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.State != nil {
structMap["state"] = s.State
}
@@ -68,12 +72,12 @@ func (s *SubscriptionComponentSubscription) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "state", "updated_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "state", "updated_at")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.State = temp.State
if temp.UpdatedAt != nil {
UpdatedAtVal, err := time.Parse(time.RFC3339, *temp.UpdatedAt)
diff --git a/models/subscription_custom_price.go b/models/subscription_custom_price.go
index 11f4c98c..c642f658 100644
--- a/models/subscription_custom_price.go
+++ b/models/subscription_custom_price.go
@@ -40,7 +40,7 @@ type SubscriptionCustomPrice struct {
ExpirationIntervalUnit Optional[ExpirationIntervalUnit] `json:"expiration_interval_unit"`
// (Optional)
TaxIncluded *bool `json:"tax_included,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionCustomPrice.
@@ -48,13 +48,17 @@ type SubscriptionCustomPrice struct {
func (s SubscriptionCustomPrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "name", "handle", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "initial_charge_in_cents", "initial_charge_after_trial", "expiration_interval", "expiration_interval_unit", "tax_included"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionCustomPrice object to a map representation for JSON marshaling.
func (s SubscriptionCustomPrice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Name != nil {
structMap["name"] = s.Name
}
@@ -111,12 +115,12 @@ func (s *SubscriptionCustomPrice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "handle", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "initial_charge_in_cents", "initial_charge_after_trial", "expiration_interval", "expiration_interval_unit", "tax_included")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "handle", "price_in_cents", "interval", "interval_unit", "trial_price_in_cents", "trial_interval", "trial_interval_unit", "initial_charge_in_cents", "initial_charge_after_trial", "expiration_interval", "expiration_interval_unit", "tax_included")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Name = temp.Name
s.Handle = temp.Handle
s.PriceInCents = *temp.PriceInCents
diff --git a/models/subscription_filter.go b/models/subscription_filter.go
index a2695f3a..31529960 100644
--- a/models/subscription_filter.go
+++ b/models/subscription_filter.go
@@ -26,7 +26,7 @@ type SubscriptionFilter struct {
StartDatetime *time.Time `json:"start_datetime,omitempty"`
// The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns components that belong to the subscription with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site''s time zone will be used. If provided, this parameter will be used instead of end_date. To use this filter you also have to include the following param in the request `include=subscription`.
EndDatetime *time.Time `json:"end_datetime,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionFilter.
@@ -34,13 +34,17 @@ type SubscriptionFilter struct {
func (s SubscriptionFilter) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "states", "date_field", "start_date", "end_date", "start_datetime", "end_datetime"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionFilter object to a map representation for JSON marshaling.
func (s SubscriptionFilter) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.States != nil {
structMap["states"] = s.States
}
@@ -70,12 +74,12 @@ func (s *SubscriptionFilter) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "states", "date_field", "start_date", "end_date", "start_datetime", "end_datetime")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "states", "date_field", "start_date", "end_date", "start_datetime", "end_datetime")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.States = temp.States
s.DateField = temp.DateField
if temp.StartDate != nil {
diff --git a/models/subscription_group.go b/models/subscription_group.go
index b768e4fd..4e309c7e 100644
--- a/models/subscription_group.go
+++ b/models/subscription_group.go
@@ -19,7 +19,7 @@ type SubscriptionGroup struct {
PaymentCollectionMethod *CollectionMethod `json:"payment_collection_method,omitempty"`
SubscriptionIds []int `json:"subscription_ids,omitempty"`
CreatedAt *time.Time `json:"created_at,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroup.
@@ -27,13 +27,17 @@ type SubscriptionGroup struct {
func (s SubscriptionGroup) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "customer_id", "payment_profile", "payment_collection_method", "subscription_ids", "created_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroup object to a map representation for JSON marshaling.
func (s SubscriptionGroup) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.CustomerId != nil {
structMap["customer_id"] = s.CustomerId
}
@@ -60,12 +64,12 @@ func (s *SubscriptionGroup) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "customer_id", "payment_profile", "payment_collection_method", "subscription_ids", "created_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "customer_id", "payment_profile", "payment_collection_method", "subscription_ids", "created_at")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.CustomerId = temp.CustomerId
s.PaymentProfile = temp.PaymentProfile
s.PaymentCollectionMethod = temp.PaymentCollectionMethod
diff --git a/models/subscription_group_balances.go b/models/subscription_group_balances.go
index 7890b40e..1d2adfb6 100644
--- a/models/subscription_group_balances.go
+++ b/models/subscription_group_balances.go
@@ -11,11 +11,11 @@ import (
// SubscriptionGroupBalances represents a SubscriptionGroupBalances struct.
type SubscriptionGroupBalances struct {
- Prepayments *AccountBalance `json:"prepayments,omitempty"`
- ServiceCredits *AccountBalance `json:"service_credits,omitempty"`
- OpenInvoices *AccountBalance `json:"open_invoices,omitempty"`
- PendingDiscounts *AccountBalance `json:"pending_discounts,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Prepayments *AccountBalance `json:"prepayments,omitempty"`
+ ServiceCredits *AccountBalance `json:"service_credits,omitempty"`
+ OpenInvoices *AccountBalance `json:"open_invoices,omitempty"`
+ PendingDiscounts *AccountBalance `json:"pending_discounts,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupBalances.
@@ -23,13 +23,17 @@ type SubscriptionGroupBalances struct {
func (s SubscriptionGroupBalances) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "prepayments", "service_credits", "open_invoices", "pending_discounts"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupBalances object to a map representation for JSON marshaling.
func (s SubscriptionGroupBalances) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Prepayments != nil {
structMap["prepayments"] = s.Prepayments.toMap()
}
@@ -53,12 +57,12 @@ func (s *SubscriptionGroupBalances) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prepayments", "service_credits", "open_invoices", "pending_discounts")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prepayments", "service_credits", "open_invoices", "pending_discounts")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Prepayments = temp.Prepayments
s.ServiceCredits = temp.ServiceCredits
s.OpenInvoices = temp.OpenInvoices
diff --git a/models/subscription_group_bank_account.go b/models/subscription_group_bank_account.go
index 94308316..19cbf9e1 100644
--- a/models/subscription_group_bank_account.go
+++ b/models/subscription_group_bank_account.go
@@ -35,7 +35,7 @@ type SubscriptionGroupBankAccount struct {
// The vault that stores the payment profile with the provided vault_token. Use `bogus` for testing.
CurrentVault *BankAccountVault `json:"current_vault,omitempty"`
GatewayHandle *string `json:"gateway_handle,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupBankAccount.
@@ -43,13 +43,17 @@ type SubscriptionGroupBankAccount struct {
func (s SubscriptionGroupBankAccount) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "bank_name", "bank_account_number", "bank_routing_number", "bank_iban", "bank_branch_code", "bank_account_type", "bank_account_holder_type", "payment_type", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "chargify_token", "current_vault", "gateway_handle"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupBankAccount object to a map representation for JSON marshaling.
func (s SubscriptionGroupBankAccount) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.BankName != nil {
structMap["bank_name"] = s.BankName
}
@@ -109,12 +113,12 @@ func (s *SubscriptionGroupBankAccount) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "bank_name", "bank_account_number", "bank_routing_number", "bank_iban", "bank_branch_code", "bank_account_type", "bank_account_holder_type", "payment_type", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "chargify_token", "current_vault", "gateway_handle")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "bank_name", "bank_account_number", "bank_routing_number", "bank_iban", "bank_branch_code", "bank_account_type", "bank_account_holder_type", "payment_type", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "chargify_token", "current_vault", "gateway_handle")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.BankName = temp.BankName
s.BankAccountNumber = temp.BankAccountNumber
s.BankRoutingNumber = temp.BankRoutingNumber
diff --git a/models/subscription_group_component_custom_price.go b/models/subscription_group_component_custom_price.go
index c65dd88a..4a21fb7b 100644
--- a/models/subscription_group_component_custom_price.go
+++ b/models/subscription_group_component_custom_price.go
@@ -16,7 +16,7 @@ type SubscriptionGroupComponentCustomPrice struct {
PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
Prices []Price `json:"prices,omitempty"`
OveragePricing []ComponentCustomPrice `json:"overage_pricing,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupComponentCustomPrice.
@@ -24,13 +24,17 @@ type SubscriptionGroupComponentCustomPrice struct {
func (s SubscriptionGroupComponentCustomPrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "pricing_scheme", "prices", "overage_pricing"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupComponentCustomPrice object to a map representation for JSON marshaling.
func (s SubscriptionGroupComponentCustomPrice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.PricingScheme != nil {
structMap["pricing_scheme"] = s.PricingScheme
}
@@ -51,12 +55,12 @@ func (s *SubscriptionGroupComponentCustomPrice) UnmarshalJSON(input []byte) erro
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "pricing_scheme", "prices", "overage_pricing")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "pricing_scheme", "prices", "overage_pricing")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.PricingScheme = temp.PricingScheme
s.Prices = temp.Prices
s.OveragePricing = temp.OveragePricing
diff --git a/models/subscription_group_credit_card.go b/models/subscription_group_credit_card.go
index 5cc51533..573fa0d3 100644
--- a/models/subscription_group_credit_card.go
+++ b/models/subscription_group_credit_card.go
@@ -33,7 +33,7 @@ type SubscriptionGroupCreditCard struct {
CustomerVaultToken *string `json:"customer_vault_token,omitempty"`
Cvv *string `json:"cvv,omitempty"`
PaymentType *string `json:"payment_type,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupCreditCard.
@@ -41,13 +41,17 @@ type SubscriptionGroupCreditCard struct {
func (s SubscriptionGroupCreditCard) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "full_number", "expiration_month", "expiration_year", "chargify_token", "vault_token", "current_vault", "gateway_handle", "first_name", "last_name", "billing_address", "billing_address_2", "billing_city", "billing_state", "billing_zip", "billing_country", "last_four", "card_type", "customer_vault_token", "cvv", "payment_type"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupCreditCard object to a map representation for JSON marshaling.
func (s SubscriptionGroupCreditCard) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.FullNumber != nil {
structMap["full_number"] = s.FullNumber.toMap()
}
@@ -119,12 +123,12 @@ func (s *SubscriptionGroupCreditCard) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "full_number", "expiration_month", "expiration_year", "chargify_token", "vault_token", "current_vault", "gateway_handle", "first_name", "last_name", "billing_address", "billing_address_2", "billing_city", "billing_state", "billing_zip", "billing_country", "last_four", "card_type", "customer_vault_token", "cvv", "payment_type")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "full_number", "expiration_month", "expiration_year", "chargify_token", "vault_token", "current_vault", "gateway_handle", "first_name", "last_name", "billing_address", "billing_address_2", "billing_city", "billing_state", "billing_zip", "billing_country", "last_four", "card_type", "customer_vault_token", "cvv", "payment_type")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.FullNumber = temp.FullNumber
s.ExpirationMonth = temp.ExpirationMonth
s.ExpirationYear = temp.ExpirationYear
diff --git a/models/subscription_group_customer.go b/models/subscription_group_customer.go
index 808600bf..c1ccb7ae 100644
--- a/models/subscription_group_customer.go
+++ b/models/subscription_group_customer.go
@@ -11,12 +11,12 @@ import (
// SubscriptionGroupCustomer represents a SubscriptionGroupCustomer struct.
type SubscriptionGroupCustomer struct {
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- Organization *string `json:"organization,omitempty"`
- Email *string `json:"email,omitempty"`
- Reference *string `json:"reference,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ FirstName *string `json:"first_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
+ Organization *string `json:"organization,omitempty"`
+ Email *string `json:"email,omitempty"`
+ Reference *string `json:"reference,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupCustomer.
@@ -24,13 +24,17 @@ type SubscriptionGroupCustomer struct {
func (s SubscriptionGroupCustomer) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "first_name", "last_name", "organization", "email", "reference"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupCustomer object to a map representation for JSON marshaling.
func (s SubscriptionGroupCustomer) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.FirstName != nil {
structMap["first_name"] = s.FirstName
}
@@ -57,12 +61,12 @@ func (s *SubscriptionGroupCustomer) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "first_name", "last_name", "organization", "email", "reference")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "first_name", "last_name", "organization", "email", "reference")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.FirstName = temp.FirstName
s.LastName = temp.LastName
s.Organization = temp.Organization
diff --git a/models/subscription_group_item.go b/models/subscription_group_item.go
index 61d8a15e..8d209e8b 100644
--- a/models/subscription_group_item.go
+++ b/models/subscription_group_item.go
@@ -11,17 +11,17 @@ import (
// SubscriptionGroupItem represents a SubscriptionGroupItem struct.
type SubscriptionGroupItem struct {
- Id *int `json:"id,omitempty"`
- Reference Optional[string] `json:"reference"`
- ProductId *int `json:"product_id,omitempty"`
- ProductHandle Optional[string] `json:"product_handle"`
- ProductPricePointId *int `json:"product_price_point_id,omitempty"`
- ProductPricePointHandle *string `json:"product_price_point_handle,omitempty"`
- Currency *string `json:"currency,omitempty"`
- CouponCode Optional[string] `json:"coupon_code"`
- TotalRevenueInCents *int64 `json:"total_revenue_in_cents,omitempty"`
- BalanceInCents *int64 `json:"balance_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ Reference Optional[string] `json:"reference"`
+ ProductId *int `json:"product_id,omitempty"`
+ ProductHandle Optional[string] `json:"product_handle"`
+ ProductPricePointId *int `json:"product_price_point_id,omitempty"`
+ ProductPricePointHandle *string `json:"product_price_point_handle,omitempty"`
+ Currency *string `json:"currency,omitempty"`
+ CouponCode Optional[string] `json:"coupon_code"`
+ TotalRevenueInCents *int64 `json:"total_revenue_in_cents,omitempty"`
+ BalanceInCents *int64 `json:"balance_in_cents,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupItem.
@@ -29,13 +29,17 @@ type SubscriptionGroupItem struct {
func (s SubscriptionGroupItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "reference", "product_id", "product_handle", "product_price_point_id", "product_price_point_handle", "currency", "coupon_code", "total_revenue_in_cents", "balance_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupItem object to a map representation for JSON marshaling.
func (s SubscriptionGroupItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -89,12 +93,12 @@ func (s *SubscriptionGroupItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "reference", "product_id", "product_handle", "product_price_point_id", "product_price_point_handle", "currency", "coupon_code", "total_revenue_in_cents", "balance_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "reference", "product_id", "product_handle", "product_price_point_id", "product_price_point_handle", "currency", "coupon_code", "total_revenue_in_cents", "balance_in_cents")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.Reference = temp.Reference
s.ProductId = temp.ProductId
diff --git a/models/subscription_group_member_error.go b/models/subscription_group_member_error.go
deleted file mode 100644
index d1695201..00000000
--- a/models/subscription_group_member_error.go
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-Package advancedbilling
-
-This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
-*/
-package models
-
-import (
- "encoding/json"
-)
-
-// SubscriptionGroupMemberError represents a SubscriptionGroupMemberError struct.
-type SubscriptionGroupMemberError struct {
- Id *int `json:"id,omitempty"`
- Type *string `json:"type,omitempty"`
- Message *string `json:"message,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupMemberError.
-// It customizes the JSON marshaling process for SubscriptionGroupMemberError objects.
-func (s SubscriptionGroupMemberError) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(s.toMap())
-}
-
-// toMap converts the SubscriptionGroupMemberError object to a map representation for JSON marshaling.
-func (s SubscriptionGroupMemberError) toMap() map[string]any {
- structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
- if s.Id != nil {
- structMap["id"] = s.Id
- }
- if s.Type != nil {
- structMap["type"] = s.Type
- }
- if s.Message != nil {
- structMap["message"] = s.Message
- }
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for SubscriptionGroupMemberError.
-// It customizes the JSON unmarshaling process for SubscriptionGroupMemberError objects.
-func (s *SubscriptionGroupMemberError) UnmarshalJSON(input []byte) error {
- var temp tempSubscriptionGroupMemberError
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "type", "message")
- if err != nil {
- return err
- }
-
- s.AdditionalProperties = additionalProperties
- s.Id = temp.Id
- s.Type = temp.Type
- s.Message = temp.Message
- return nil
-}
-
-// tempSubscriptionGroupMemberError is a temporary struct used for validating the fields of SubscriptionGroupMemberError.
-type tempSubscriptionGroupMemberError struct {
- Id *int `json:"id,omitempty"`
- Type *string `json:"type,omitempty"`
- Message *string `json:"message,omitempty"`
-}
diff --git a/models/subscription_group_members_array_error.go b/models/subscription_group_members_array_error.go
index bd2276d9..6620dd6f 100644
--- a/models/subscription_group_members_array_error.go
+++ b/models/subscription_group_members_array_error.go
@@ -13,8 +13,8 @@ import (
// SubscriptionGroupMembersArrayError represents a SubscriptionGroupMembersArrayError struct.
type SubscriptionGroupMembersArrayError struct {
- Members []string `json:"members"`
- AdditionalProperties map[string]any `json:"_"`
+ Members []string `json:"members"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupMembersArrayError.
@@ -22,13 +22,17 @@ type SubscriptionGroupMembersArrayError struct {
func (s SubscriptionGroupMembersArrayError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "members"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupMembersArrayError object to a map representation for JSON marshaling.
func (s SubscriptionGroupMembersArrayError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["members"] = s.Members
return structMap
}
@@ -45,12 +49,12 @@ func (s *SubscriptionGroupMembersArrayError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "members")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "members")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Members = *temp.Members
return nil
}
diff --git a/models/subscription_group_payment_profile.go b/models/subscription_group_payment_profile.go
index 5ea0cb95..7e0d3ddb 100644
--- a/models/subscription_group_payment_profile.go
+++ b/models/subscription_group_payment_profile.go
@@ -11,11 +11,11 @@ import (
// SubscriptionGroupPaymentProfile represents a SubscriptionGroupPaymentProfile struct.
type SubscriptionGroupPaymentProfile 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"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
+ MaskedCardNumber *string `json:"masked_card_number,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupPaymentProfile.
@@ -23,13 +23,17 @@ type SubscriptionGroupPaymentProfile struct {
func (s SubscriptionGroupPaymentProfile) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "first_name", "last_name", "masked_card_number"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupPaymentProfile object to a map representation for JSON marshaling.
func (s SubscriptionGroupPaymentProfile) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -53,12 +57,12 @@ func (s *SubscriptionGroupPaymentProfile) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "first_name", "last_name", "masked_card_number")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "first_name", "last_name", "masked_card_number")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.FirstName = temp.FirstName
s.LastName = temp.LastName
diff --git a/models/subscription_group_prepayment.go b/models/subscription_group_prepayment.go
index edc5f910..bd0bbf75 100644
--- a/models/subscription_group_prepayment.go
+++ b/models/subscription_group_prepayment.go
@@ -17,7 +17,7 @@ type SubscriptionGroupPrepayment struct {
Details string `json:"details"`
Memo string `json:"memo"`
Method SubscriptionGroupPrepaymentMethod `json:"method"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupPrepayment.
@@ -25,13 +25,17 @@ type SubscriptionGroupPrepayment struct {
func (s SubscriptionGroupPrepayment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "amount", "details", "memo", "method"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupPrepayment object to a map representation for JSON marshaling.
func (s SubscriptionGroupPrepayment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["amount"] = s.Amount
structMap["details"] = s.Details
structMap["memo"] = s.Memo
@@ -51,12 +55,12 @@ func (s *SubscriptionGroupPrepayment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "amount", "details", "memo", "method")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "amount", "details", "memo", "method")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Amount = *temp.Amount
s.Details = *temp.Details
s.Memo = *temp.Memo
diff --git a/models/subscription_group_prepayment_request.go b/models/subscription_group_prepayment_request.go
index 381b4652..019c467a 100644
--- a/models/subscription_group_prepayment_request.go
+++ b/models/subscription_group_prepayment_request.go
@@ -14,7 +14,7 @@ import (
// SubscriptionGroupPrepaymentRequest represents a SubscriptionGroupPrepaymentRequest struct.
type SubscriptionGroupPrepaymentRequest struct {
Prepayment SubscriptionGroupPrepayment `json:"prepayment"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupPrepaymentRequest.
@@ -22,13 +22,17 @@ type SubscriptionGroupPrepaymentRequest struct {
func (s SubscriptionGroupPrepaymentRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "prepayment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupPrepaymentRequest object to a map representation for JSON marshaling.
func (s SubscriptionGroupPrepaymentRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["prepayment"] = s.Prepayment.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (s *SubscriptionGroupPrepaymentRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prepayment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prepayment")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Prepayment = *temp.Prepayment
return nil
}
diff --git a/models/subscription_group_prepayment_response.go b/models/subscription_group_prepayment_response.go
index 7ed11dd3..7e4870e4 100644
--- a/models/subscription_group_prepayment_response.go
+++ b/models/subscription_group_prepayment_response.go
@@ -11,16 +11,16 @@ import (
// SubscriptionGroupPrepaymentResponse represents a SubscriptionGroupPrepaymentResponse struct.
type SubscriptionGroupPrepaymentResponse struct {
- Id *int `json:"id,omitempty"`
+ Id *int `json:"id,omitempty"`
// The amount in cents of the entry.
- AmountInCents *int64 `json:"amount_in_cents,omitempty"`
+ AmountInCents *int64 `json:"amount_in_cents,omitempty"`
// The ending balance in cents of the account.
- EndingBalanceInCents *int64 `json:"ending_balance_in_cents,omitempty"`
+ EndingBalanceInCents *int64 `json:"ending_balance_in_cents,omitempty"`
// The type of entry
- EntryType *ServiceCreditType `json:"entry_type,omitempty"`
+ EntryType *ServiceCreditType `json:"entry_type,omitempty"`
// A memo attached to the entry.
- Memo Optional[string] `json:"memo"`
- AdditionalProperties map[string]any `json:"_"`
+ Memo Optional[string] `json:"memo"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupPrepaymentResponse.
@@ -28,13 +28,17 @@ type SubscriptionGroupPrepaymentResponse struct {
func (s SubscriptionGroupPrepaymentResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "amount_in_cents", "ending_balance_in_cents", "entry_type", "memo"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupPrepaymentResponse object to a map representation for JSON marshaling.
func (s SubscriptionGroupPrepaymentResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -65,12 +69,12 @@ func (s *SubscriptionGroupPrepaymentResponse) UnmarshalJSON(input []byte) error
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "amount_in_cents", "ending_balance_in_cents", "entry_type", "memo")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "amount_in_cents", "ending_balance_in_cents", "entry_type", "memo")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.AmountInCents = temp.AmountInCents
s.EndingBalanceInCents = temp.EndingBalanceInCents
diff --git a/models/subscription_group_response.go b/models/subscription_group_response.go
index c852967c..ca90ef3c 100644
--- a/models/subscription_group_response.go
+++ b/models/subscription_group_response.go
@@ -13,8 +13,8 @@ import (
// SubscriptionGroupResponse represents a SubscriptionGroupResponse struct.
type SubscriptionGroupResponse struct {
- SubscriptionGroup SubscriptionGroup `json:"subscription_group"`
- AdditionalProperties map[string]any `json:"_"`
+ SubscriptionGroup SubscriptionGroup `json:"subscription_group"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupResponse.
@@ -22,13 +22,17 @@ type SubscriptionGroupResponse struct {
func (s SubscriptionGroupResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "subscription_group"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupResponse object to a map representation for JSON marshaling.
func (s SubscriptionGroupResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["subscription_group"] = s.SubscriptionGroup.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (s *SubscriptionGroupResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_group")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_group")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.SubscriptionGroup = *temp.SubscriptionGroup
return nil
}
diff --git a/models/subscription_group_signup.go b/models/subscription_group_signup.go
index 322699c7..72060292 100644
--- a/models/subscription_group_signup.go
+++ b/models/subscription_group_signup.go
@@ -22,7 +22,7 @@ type SubscriptionGroupSignup struct {
CreditCardAttributes *SubscriptionGroupCreditCard `json:"credit_card_attributes,omitempty"`
BankAccountAttributes *SubscriptionGroupBankAccount `json:"bank_account_attributes,omitempty"`
Subscriptions []SubscriptionGroupSignupItem `json:"subscriptions"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSignup.
@@ -30,13 +30,17 @@ type SubscriptionGroupSignup struct {
func (s SubscriptionGroupSignup) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "payment_profile_id", "payer_id", "payer_reference", "payment_collection_method", "payer_attributes", "credit_card_attributes", "bank_account_attributes", "subscriptions"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupSignup object to a map representation for JSON marshaling.
func (s SubscriptionGroupSignup) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.PaymentProfileId != nil {
structMap["payment_profile_id"] = s.PaymentProfileId
}
@@ -74,12 +78,12 @@ func (s *SubscriptionGroupSignup) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payment_profile_id", "payer_id", "payer_reference", "payment_collection_method", "payer_attributes", "credit_card_attributes", "bank_account_attributes", "subscriptions")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payment_profile_id", "payer_id", "payer_reference", "payment_collection_method", "payer_attributes", "credit_card_attributes", "bank_account_attributes", "subscriptions")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.PaymentProfileId = temp.PaymentProfileId
s.PayerId = temp.PayerId
s.PayerReference = temp.PayerReference
diff --git a/models/subscription_group_signup_component.go b/models/subscription_group_signup_component.go
index b30de634..db2df8de 100644
--- a/models/subscription_group_signup_component.go
+++ b/models/subscription_group_signup_component.go
@@ -18,7 +18,7 @@ type SubscriptionGroupSignupComponent struct {
PricePointId *SubscriptionGroupSignupComponentPricePointId `json:"price_point_id,omitempty"`
// Used in place of `price_point_id` to define a custom price point unique to the subscription. You still need to provide `component_id`.
CustomPrice *SubscriptionGroupComponentCustomPrice `json:"custom_price,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSignupComponent.
@@ -26,13 +26,17 @@ type SubscriptionGroupSignupComponent struct {
func (s SubscriptionGroupSignupComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "component_id", "allocated_quantity", "unit_balance", "price_point_id", "custom_price"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupSignupComponent object to a map representation for JSON marshaling.
func (s SubscriptionGroupSignupComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.ComponentId != nil {
structMap["component_id"] = s.ComponentId.toMap()
}
@@ -59,12 +63,12 @@ func (s *SubscriptionGroupSignupComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component_id", "allocated_quantity", "unit_balance", "price_point_id", "custom_price")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component_id", "allocated_quantity", "unit_balance", "price_point_id", "custom_price")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.ComponentId = temp.ComponentId
s.AllocatedQuantity = temp.AllocatedQuantity
s.UnitBalance = temp.UnitBalance
diff --git a/models/subscription_group_signup_error.go b/models/subscription_group_signup_error.go
index d0e6b8d3..2f4e145a 100644
--- a/models/subscription_group_signup_error.go
+++ b/models/subscription_group_signup_error.go
@@ -18,7 +18,7 @@ type SubscriptionGroupSignupError struct {
SubscriptionGroup []string `json:"subscription_group,omitempty"`
PaymentProfileId *string `json:"payment_profile_id,omitempty"`
PayerId *string `json:"payer_id,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSignupError.
@@ -26,13 +26,17 @@ type SubscriptionGroupSignupError struct {
func (s SubscriptionGroupSignupError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "subscriptions", "payer_reference", "payer", "subscription_group", "payment_profile_id", "payer_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupSignupError object to a map representation for JSON marshaling.
func (s SubscriptionGroupSignupError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Subscriptions != nil {
structMap["subscriptions"] = s.Subscriptions
}
@@ -62,12 +66,12 @@ func (s *SubscriptionGroupSignupError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscriptions", "payer_reference", "payer", "subscription_group", "payment_profile_id", "payer_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscriptions", "payer_reference", "payer", "subscription_group", "payment_profile_id", "payer_id")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Subscriptions = temp.Subscriptions
s.PayerReference = temp.PayerReference
s.Payer = temp.Payer
diff --git a/models/subscription_group_signup_failure.go b/models/subscription_group_signup_event_data.go
similarity index 50%
rename from models/subscription_group_signup_failure.go
rename to models/subscription_group_signup_event_data.go
index d000752f..0f6ed707 100644
--- a/models/subscription_group_signup_failure.go
+++ b/models/subscription_group_signup_event_data.go
@@ -11,38 +11,42 @@ import (
"strings"
)
-// SubscriptionGroupSignupFailure represents a SubscriptionGroupSignupFailure struct.
-type SubscriptionGroupSignupFailure struct {
+// SubscriptionGroupSignupEventData represents a SubscriptionGroupSignupEventData struct.
+type SubscriptionGroupSignupEventData struct {
SubscriptionGroup SubscriptionGroupSignupFailureData `json:"subscription_group"`
- Customer *string `json:"customer"`
- AdditionalProperties map[string]any `json:"_"`
+ Customer *Customer `json:"customer"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
-// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSignupFailure.
-// It customizes the JSON marshaling process for SubscriptionGroupSignupFailure objects.
-func (s SubscriptionGroupSignupFailure) MarshalJSON() (
+// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSignupEventData.
+// It customizes the JSON marshaling process for SubscriptionGroupSignupEventData objects.
+func (s SubscriptionGroupSignupEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "subscription_group", "customer"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
-// toMap converts the SubscriptionGroupSignupFailure object to a map representation for JSON marshaling.
-func (s SubscriptionGroupSignupFailure) toMap() map[string]any {
+// toMap converts the SubscriptionGroupSignupEventData object to a map representation for JSON marshaling.
+func (s SubscriptionGroupSignupEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["subscription_group"] = s.SubscriptionGroup.toMap()
if s.Customer != nil {
- structMap["customer"] = s.Customer
+ structMap["customer"] = s.Customer.toMap()
} else {
structMap["customer"] = nil
}
return structMap
}
-// UnmarshalJSON implements the json.Unmarshaler interface for SubscriptionGroupSignupFailure.
-// It customizes the JSON unmarshaling process for SubscriptionGroupSignupFailure objects.
-func (s *SubscriptionGroupSignupFailure) UnmarshalJSON(input []byte) error {
- var temp tempSubscriptionGroupSignupFailure
+// UnmarshalJSON implements the json.Unmarshaler interface for SubscriptionGroupSignupEventData.
+// It customizes the JSON unmarshaling process for SubscriptionGroupSignupEventData objects.
+func (s *SubscriptionGroupSignupEventData) UnmarshalJSON(input []byte) error {
+ var temp tempSubscriptionGroupSignupEventData
err := json.Unmarshal(input, &temp)
if err != nil {
return err
@@ -51,27 +55,27 @@ func (s *SubscriptionGroupSignupFailure) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_group", "customer")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_group", "customer")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.SubscriptionGroup = *temp.SubscriptionGroup
s.Customer = temp.Customer
return nil
}
-// tempSubscriptionGroupSignupFailure is a temporary struct used for validating the fields of SubscriptionGroupSignupFailure.
-type tempSubscriptionGroupSignupFailure struct {
+// tempSubscriptionGroupSignupEventData is a temporary struct used for validating the fields of SubscriptionGroupSignupEventData.
+type tempSubscriptionGroupSignupEventData struct {
SubscriptionGroup *SubscriptionGroupSignupFailureData `json:"subscription_group"`
- Customer *string `json:"customer"`
+ Customer *Customer `json:"customer"`
}
-func (s *tempSubscriptionGroupSignupFailure) validate() error {
+func (s *tempSubscriptionGroupSignupEventData) validate() error {
var errs []string
if s.SubscriptionGroup == nil {
- errs = append(errs, "required field `subscription_group` is missing for type `Subscription Group Signup Failure`")
+ errs = append(errs, "required field `subscription_group` is missing for type `Subscription Group Signup Event Data`")
}
if len(errs) == 0 {
return nil
diff --git a/models/subscription_group_signup_failure_data.go b/models/subscription_group_signup_failure_data.go
index 905de841..16df4756 100644
--- a/models/subscription_group_signup_failure_data.go
+++ b/models/subscription_group_signup_failure_data.go
@@ -19,7 +19,7 @@ type SubscriptionGroupSignupFailureData struct {
CreditCardAttributes *SubscriptionGroupCreditCard `json:"credit_card_attributes,omitempty"`
BankAccountAttributes *SubscriptionGroupBankAccount `json:"bank_account_attributes,omitempty"`
Subscriptions []SubscriptionGroupSignupItem `json:"subscriptions,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSignupFailureData.
@@ -27,13 +27,17 @@ type SubscriptionGroupSignupFailureData struct {
func (s SubscriptionGroupSignupFailureData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "payer_id", "payer_reference", "payment_profile_id", "payment_collection_method", "payer_attributes", "credit_card_attributes", "bank_account_attributes", "subscriptions"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupSignupFailureData object to a map representation for JSON marshaling.
func (s SubscriptionGroupSignupFailureData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.PayerId != nil {
structMap["payer_id"] = s.PayerId
}
@@ -69,12 +73,12 @@ func (s *SubscriptionGroupSignupFailureData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payer_id", "payer_reference", "payment_profile_id", "payment_collection_method", "payer_attributes", "credit_card_attributes", "bank_account_attributes", "subscriptions")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payer_id", "payer_reference", "payment_profile_id", "payment_collection_method", "payer_attributes", "credit_card_attributes", "bank_account_attributes", "subscriptions")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.PayerId = temp.PayerId
s.PayerReference = temp.PayerReference
s.PaymentProfileId = temp.PaymentProfileId
diff --git a/models/subscription_group_signup_item.go b/models/subscription_group_signup_item.go
index dc2b2633..e33394f0 100644
--- a/models/subscription_group_signup_item.go
+++ b/models/subscription_group_signup_item.go
@@ -36,7 +36,7 @@ type SubscriptionGroupSignupItem struct {
CalendarBilling *CalendarBilling `json:"calendar_billing,omitempty"`
// (Optional) A set of key/value pairs representing custom fields and their values. Metafields will be created “on-the-fly” in your site for a given key, if they have not been created yet.
Metafields map[string]string `json:"metafields,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSignupItem.
@@ -44,13 +44,17 @@ type SubscriptionGroupSignupItem struct {
func (s SubscriptionGroupSignupItem) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "product_handle", "product_id", "product_price_point_id", "product_price_point_handle", "offer_id", "reference", "primary", "currency", "coupon_codes", "components", "custom_price", "calendar_billing", "metafields"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupSignupItem object to a map representation for JSON marshaling.
func (s SubscriptionGroupSignupItem) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.ProductHandle != nil {
structMap["product_handle"] = s.ProductHandle
}
@@ -101,12 +105,12 @@ func (s *SubscriptionGroupSignupItem) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product_handle", "product_id", "product_price_point_id", "product_price_point_handle", "offer_id", "reference", "primary", "currency", "coupon_codes", "components", "custom_price", "calendar_billing", "metafields")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product_handle", "product_id", "product_price_point_id", "product_price_point_handle", "offer_id", "reference", "primary", "currency", "coupon_codes", "components", "custom_price", "calendar_billing", "metafields")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.ProductHandle = temp.ProductHandle
s.ProductId = temp.ProductId
s.ProductPricePointId = temp.ProductPricePointId
diff --git a/models/subscription_group_signup_request.go b/models/subscription_group_signup_request.go
index b4fa6cb6..33c0dd2c 100644
--- a/models/subscription_group_signup_request.go
+++ b/models/subscription_group_signup_request.go
@@ -14,7 +14,7 @@ import (
// SubscriptionGroupSignupRequest represents a SubscriptionGroupSignupRequest struct.
type SubscriptionGroupSignupRequest struct {
SubscriptionGroup SubscriptionGroupSignup `json:"subscription_group"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSignupRequest.
@@ -22,13 +22,17 @@ type SubscriptionGroupSignupRequest struct {
func (s SubscriptionGroupSignupRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "subscription_group"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupSignupRequest object to a map representation for JSON marshaling.
func (s SubscriptionGroupSignupRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["subscription_group"] = s.SubscriptionGroup.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (s *SubscriptionGroupSignupRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_group")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_group")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.SubscriptionGroup = *temp.SubscriptionGroup
return nil
}
diff --git a/models/subscription_group_signup_response.go b/models/subscription_group_signup_response.go
index 82fed996..1af47b72 100644
--- a/models/subscription_group_signup_response.go
+++ b/models/subscription_group_signup_response.go
@@ -45,7 +45,7 @@ type SubscriptionGroupSignupResponse struct {
Subscriptions []SubscriptionGroupItem `json:"subscriptions,omitempty"`
// 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`.
PaymentCollectionMethod *CollectionMethod `json:"payment_collection_method,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSignupResponse.
@@ -53,13 +53,17 @@ type SubscriptionGroupSignupResponse struct {
func (s SubscriptionGroupSignupResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period", "subscriptions", "payment_collection_method"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupSignupResponse object to a map representation for JSON marshaling.
func (s SubscriptionGroupSignupResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Uid != nil {
structMap["uid"] = s.Uid
}
@@ -104,12 +108,12 @@ func (s *SubscriptionGroupSignupResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period", "subscriptions", "payment_collection_method")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period", "subscriptions", "payment_collection_method")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Uid = temp.Uid
s.Scheme = temp.Scheme
s.CustomerId = temp.CustomerId
diff --git a/models/subscription_group_signup_success.go b/models/subscription_group_signup_success.go
deleted file mode 100644
index d9988d39..00000000
--- a/models/subscription_group_signup_success.go
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
-Package advancedbilling
-
-This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
-*/
-package models
-
-import (
- "encoding/json"
- "errors"
- "strings"
-)
-
-// SubscriptionGroupSignupSuccess represents a SubscriptionGroupSignupSuccess struct.
-type SubscriptionGroupSignupSuccess struct {
- SubscriptionGroup SubscriptionGroupSignupSuccessData `json:"subscription_group"`
- Customer Customer `json:"customer"`
- AdditionalProperties map[string]any `json:"_"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSignupSuccess.
-// It customizes the JSON marshaling process for SubscriptionGroupSignupSuccess objects.
-func (s SubscriptionGroupSignupSuccess) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(s.toMap())
-}
-
-// toMap converts the SubscriptionGroupSignupSuccess object to a map representation for JSON marshaling.
-func (s SubscriptionGroupSignupSuccess) toMap() map[string]any {
- structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
- structMap["subscription_group"] = s.SubscriptionGroup.toMap()
- structMap["customer"] = s.Customer.toMap()
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for SubscriptionGroupSignupSuccess.
-// It customizes the JSON unmarshaling process for SubscriptionGroupSignupSuccess objects.
-func (s *SubscriptionGroupSignupSuccess) UnmarshalJSON(input []byte) error {
- var temp tempSubscriptionGroupSignupSuccess
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
- err = temp.validate()
- if err != nil {
- return err
- }
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_group", "customer")
- if err != nil {
- return err
- }
-
- s.AdditionalProperties = additionalProperties
- s.SubscriptionGroup = *temp.SubscriptionGroup
- s.Customer = *temp.Customer
- return nil
-}
-
-// tempSubscriptionGroupSignupSuccess is a temporary struct used for validating the fields of SubscriptionGroupSignupSuccess.
-type tempSubscriptionGroupSignupSuccess struct {
- SubscriptionGroup *SubscriptionGroupSignupSuccessData `json:"subscription_group"`
- Customer *Customer `json:"customer"`
-}
-
-func (s *tempSubscriptionGroupSignupSuccess) validate() error {
- var errs []string
- if s.SubscriptionGroup == nil {
- errs = append(errs, "required field `subscription_group` is missing for type `Subscription Group Signup Success`")
- }
- if s.Customer == nil {
- errs = append(errs, "required field `customer` is missing for type `Subscription Group Signup Success`")
- }
- if len(errs) == 0 {
- return nil
- }
- return errors.New(strings.Join (errs, "\n"))
-}
diff --git a/models/subscription_group_signup_success_data.go b/models/subscription_group_signup_success_data.go
deleted file mode 100644
index e8e908de..00000000
--- a/models/subscription_group_signup_success_data.go
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
-Package advancedbilling
-
-This file was automatically generated for Maxio by APIMATIC v3.0 ( https://www.apimatic.io ).
-*/
-package models
-
-import (
- "encoding/json"
- "errors"
- "log"
- "strings"
- "time"
-)
-
-// SubscriptionGroupSignupSuccessData represents a SubscriptionGroupSignupSuccessData struct.
-type SubscriptionGroupSignupSuccessData struct {
- Uid string `json:"uid"`
- Scheme int `json:"scheme"`
- CustomerId int `json:"customer_id"`
- PaymentProfileId int `json:"payment_profile_id"`
- SubscriptionIds []int `json:"subscription_ids"`
- PrimarySubscriptionId int `json:"primary_subscription_id"`
- NextAssessmentAt time.Time `json:"next_assessment_at"`
- State string `json:"state"`
- CancelAtEndOfPeriod bool `json:"cancel_at_end_of_period"`
- AdditionalProperties map[string]any `json:"_"`
-}
-
-// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSignupSuccessData.
-// It customizes the JSON marshaling process for SubscriptionGroupSignupSuccessData objects.
-func (s SubscriptionGroupSignupSuccessData) MarshalJSON() (
- []byte,
- error) {
- return json.Marshal(s.toMap())
-}
-
-// toMap converts the SubscriptionGroupSignupSuccessData object to a map representation for JSON marshaling.
-func (s SubscriptionGroupSignupSuccessData) toMap() map[string]any {
- structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
- structMap["uid"] = s.Uid
- structMap["scheme"] = s.Scheme
- structMap["customer_id"] = s.CustomerId
- structMap["payment_profile_id"] = s.PaymentProfileId
- structMap["subscription_ids"] = s.SubscriptionIds
- structMap["primary_subscription_id"] = s.PrimarySubscriptionId
- structMap["next_assessment_at"] = s.NextAssessmentAt.Format(time.RFC3339)
- structMap["state"] = s.State
- structMap["cancel_at_end_of_period"] = s.CancelAtEndOfPeriod
- return structMap
-}
-
-// UnmarshalJSON implements the json.Unmarshaler interface for SubscriptionGroupSignupSuccessData.
-// It customizes the JSON unmarshaling process for SubscriptionGroupSignupSuccessData objects.
-func (s *SubscriptionGroupSignupSuccessData) UnmarshalJSON(input []byte) error {
- var temp tempSubscriptionGroupSignupSuccessData
- err := json.Unmarshal(input, &temp)
- if err != nil {
- return err
- }
- err = temp.validate()
- if err != nil {
- return err
- }
- additionalProperties, err := UnmarshalAdditionalProperties(input, "uid", "scheme", "customer_id", "payment_profile_id", "subscription_ids", "primary_subscription_id", "next_assessment_at", "state", "cancel_at_end_of_period")
- if err != nil {
- return err
- }
-
- s.AdditionalProperties = additionalProperties
- s.Uid = *temp.Uid
- s.Scheme = *temp.Scheme
- s.CustomerId = *temp.CustomerId
- s.PaymentProfileId = *temp.PaymentProfileId
- s.SubscriptionIds = *temp.SubscriptionIds
- s.PrimarySubscriptionId = *temp.PrimarySubscriptionId
- NextAssessmentAtVal, err := time.Parse(time.RFC3339, *temp.NextAssessmentAt)
- if err != nil {
- log.Fatalf("Cannot Parse next_assessment_at as % s format.", time.RFC3339)
- }
- s.NextAssessmentAt = NextAssessmentAtVal
- s.State = *temp.State
- s.CancelAtEndOfPeriod = *temp.CancelAtEndOfPeriod
- return nil
-}
-
-// tempSubscriptionGroupSignupSuccessData is a temporary struct used for validating the fields of SubscriptionGroupSignupSuccessData.
-type tempSubscriptionGroupSignupSuccessData struct {
- Uid *string `json:"uid"`
- Scheme *int `json:"scheme"`
- CustomerId *int `json:"customer_id"`
- PaymentProfileId *int `json:"payment_profile_id"`
- SubscriptionIds *[]int `json:"subscription_ids"`
- PrimarySubscriptionId *int `json:"primary_subscription_id"`
- NextAssessmentAt *string `json:"next_assessment_at"`
- State *string `json:"state"`
- CancelAtEndOfPeriod *bool `json:"cancel_at_end_of_period"`
-}
-
-func (s *tempSubscriptionGroupSignupSuccessData) validate() error {
- var errs []string
- if s.Uid == nil {
- errs = append(errs, "required field `uid` is missing for type `Subscription Group Signup Success Data`")
- }
- if s.Scheme == nil {
- errs = append(errs, "required field `scheme` is missing for type `Subscription Group Signup Success Data`")
- }
- if s.CustomerId == nil {
- errs = append(errs, "required field `customer_id` is missing for type `Subscription Group Signup Success Data`")
- }
- if s.PaymentProfileId == nil {
- errs = append(errs, "required field `payment_profile_id` is missing for type `Subscription Group Signup Success Data`")
- }
- if s.SubscriptionIds == nil {
- errs = append(errs, "required field `subscription_ids` is missing for type `Subscription Group Signup Success Data`")
- }
- if s.PrimarySubscriptionId == nil {
- errs = append(errs, "required field `primary_subscription_id` is missing for type `Subscription Group Signup Success Data`")
- }
- if s.NextAssessmentAt == nil {
- errs = append(errs, "required field `next_assessment_at` is missing for type `Subscription Group Signup Success Data`")
- }
- if s.State == nil {
- errs = append(errs, "required field `state` is missing for type `Subscription Group Signup Success Data`")
- }
- if s.CancelAtEndOfPeriod == nil {
- errs = append(errs, "required field `cancel_at_end_of_period` is missing for type `Subscription Group Signup Success Data`")
- }
- if len(errs) == 0 {
- return nil
- }
- return errors.New(strings.Join (errs, "\n"))
-}
diff --git a/models/subscription_group_single_error.go b/models/subscription_group_single_error.go
index 6bcac361..051ffc5b 100644
--- a/models/subscription_group_single_error.go
+++ b/models/subscription_group_single_error.go
@@ -13,8 +13,8 @@ import (
// SubscriptionGroupSingleError represents a SubscriptionGroupSingleError struct.
type SubscriptionGroupSingleError struct {
- SubscriptionGroup string `json:"subscription_group"`
- AdditionalProperties map[string]any `json:"_"`
+ SubscriptionGroup string `json:"subscription_group"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSingleError.
@@ -22,13 +22,17 @@ type SubscriptionGroupSingleError struct {
func (s SubscriptionGroupSingleError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "subscription_group"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupSingleError object to a map representation for JSON marshaling.
func (s SubscriptionGroupSingleError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["subscription_group"] = s.SubscriptionGroup
return structMap
}
@@ -45,12 +49,12 @@ func (s *SubscriptionGroupSingleError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_group")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_group")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.SubscriptionGroup = *temp.SubscriptionGroup
return nil
}
diff --git a/models/subscription_group_subscription_error.go b/models/subscription_group_subscription_error.go
index a8540a65..73aa0937 100644
--- a/models/subscription_group_subscription_error.go
+++ b/models/subscription_group_subscription_error.go
@@ -12,15 +12,15 @@ import (
// SubscriptionGroupSubscriptionError represents a SubscriptionGroupSubscriptionError struct.
// Object which contains subscription errors.
type SubscriptionGroupSubscriptionError struct {
- Product []string `json:"product,omitempty"`
- ProductPricePointId []string `json:"product_price_point_id,omitempty"`
- PaymentProfile []string `json:"payment_profile,omitempty"`
- PaymentProfileChargifyToken []string `json:"payment_profile.chargify_token,omitempty"`
- Base []string `json:"base,omitempty"`
- PaymentProfileExpirationMonth []string `json:"payment_profile.expiration_month,omitempty"`
- PaymentProfileExpirationYear []string `json:"payment_profile.expiration_year,omitempty"`
- PaymentProfileFullNumber []string `json:"payment_profile.full_number,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Product []string `json:"product,omitempty"`
+ ProductPricePointId []string `json:"product_price_point_id,omitempty"`
+ PaymentProfile []string `json:"payment_profile,omitempty"`
+ PaymentProfileChargifyToken []string `json:"payment_profile.chargify_token,omitempty"`
+ Base []string `json:"base,omitempty"`
+ PaymentProfileExpirationMonth []string `json:"payment_profile.expiration_month,omitempty"`
+ PaymentProfileExpirationYear []string `json:"payment_profile.expiration_year,omitempty"`
+ PaymentProfileFullNumber []string `json:"payment_profile.full_number,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupSubscriptionError.
@@ -28,13 +28,17 @@ type SubscriptionGroupSubscriptionError struct {
func (s SubscriptionGroupSubscriptionError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "product", "product_price_point_id", "payment_profile", "payment_profile.chargify_token", "base", "payment_profile.expiration_month", "payment_profile.expiration_year", "payment_profile.full_number"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupSubscriptionError object to a map representation for JSON marshaling.
func (s SubscriptionGroupSubscriptionError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Product != nil {
structMap["product"] = s.Product
}
@@ -70,12 +74,12 @@ func (s *SubscriptionGroupSubscriptionError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product", "product_price_point_id", "payment_profile", "payment_profile.chargify_token", "base", "payment_profile.expiration_month", "payment_profile.expiration_year", "payment_profile.full_number")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product", "product_price_point_id", "payment_profile", "payment_profile.chargify_token", "base", "payment_profile.expiration_month", "payment_profile.expiration_year", "payment_profile.full_number")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Product = temp.Product
s.ProductPricePointId = temp.ProductPricePointId
s.PaymentProfile = temp.PaymentProfile
diff --git a/models/subscription_group_update_error.go b/models/subscription_group_update_error.go
index a58b5635..f47c3128 100644
--- a/models/subscription_group_update_error.go
+++ b/models/subscription_group_update_error.go
@@ -11,8 +11,8 @@ import (
// SubscriptionGroupUpdateError represents a SubscriptionGroupUpdateError struct.
type SubscriptionGroupUpdateError struct {
- Members []SubscriptionGroupMemberError `json:"members,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Members []string `json:"members,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionGroupUpdateError.
@@ -20,13 +20,17 @@ type SubscriptionGroupUpdateError struct {
func (s SubscriptionGroupUpdateError) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "members"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionGroupUpdateError object to a map representation for JSON marshaling.
func (s SubscriptionGroupUpdateError) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Members != nil {
structMap["members"] = s.Members
}
@@ -41,17 +45,17 @@ func (s *SubscriptionGroupUpdateError) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "members")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "members")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Members = temp.Members
return nil
}
// tempSubscriptionGroupUpdateError is a temporary struct used for validating the fields of SubscriptionGroupUpdateError.
type tempSubscriptionGroupUpdateError struct {
- Members []SubscriptionGroupMemberError `json:"members,omitempty"`
+ Members []string `json:"members,omitempty"`
}
diff --git a/models/subscription_included_coupon.go b/models/subscription_included_coupon.go
index 4bd63eab..ec40ce55 100644
--- a/models/subscription_included_coupon.go
+++ b/models/subscription_included_coupon.go
@@ -11,14 +11,14 @@ import (
// SubscriptionIncludedCoupon represents a SubscriptionIncludedCoupon struct.
type SubscriptionIncludedCoupon struct {
- Code *string `json:"code,omitempty"`
- UseCount *int `json:"use_count,omitempty"`
- UsesAllowed *int `json:"uses_allowed,omitempty"`
- ExpiresAt Optional[string] `json:"expires_at"`
- Recurring *bool `json:"recurring,omitempty"`
- AmountInCents Optional[int64] `json:"amount_in_cents"`
- Percentage Optional[string] `json:"percentage"`
- AdditionalProperties map[string]any `json:"_"`
+ Code *string `json:"code,omitempty"`
+ UseCount *int `json:"use_count,omitempty"`
+ UsesAllowed *int `json:"uses_allowed,omitempty"`
+ ExpiresAt Optional[string] `json:"expires_at"`
+ Recurring *bool `json:"recurring,omitempty"`
+ AmountInCents Optional[int64] `json:"amount_in_cents"`
+ Percentage Optional[string] `json:"percentage"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionIncludedCoupon.
@@ -26,13 +26,17 @@ type SubscriptionIncludedCoupon struct {
func (s SubscriptionIncludedCoupon) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "code", "use_count", "uses_allowed", "expires_at", "recurring", "amount_in_cents", "percentage"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionIncludedCoupon object to a map representation for JSON marshaling.
func (s SubscriptionIncludedCoupon) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Code != nil {
structMap["code"] = s.Code
}
@@ -77,12 +81,12 @@ func (s *SubscriptionIncludedCoupon) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "code", "use_count", "uses_allowed", "expires_at", "recurring", "amount_in_cents", "percentage")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "code", "use_count", "uses_allowed", "expires_at", "recurring", "amount_in_cents", "percentage")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Code = temp.Code
s.UseCount = temp.UseCount
s.UsesAllowed = temp.UsesAllowed
diff --git a/models/subscription_migration_preview.go b/models/subscription_migration_preview.go
index 107cc3b0..21916d93 100644
--- a/models/subscription_migration_preview.go
+++ b/models/subscription_migration_preview.go
@@ -12,14 +12,14 @@ import (
// SubscriptionMigrationPreview represents a SubscriptionMigrationPreview struct.
type SubscriptionMigrationPreview struct {
// The amount of the prorated adjustment that would be issued for the current subscription.
- ProratedAdjustmentInCents *int64 `json:"prorated_adjustment_in_cents,omitempty"`
+ ProratedAdjustmentInCents *int64 `json:"prorated_adjustment_in_cents,omitempty"`
// The amount of the charge that would be created for the new product.
- ChargeInCents *int64 `json:"charge_in_cents,omitempty"`
+ ChargeInCents *int64 `json:"charge_in_cents,omitempty"`
// The amount of the payment due in the case of an upgrade.
- PaymentDueInCents *int64 `json:"payment_due_in_cents,omitempty"`
+ PaymentDueInCents *int64 `json:"payment_due_in_cents,omitempty"`
// Represents a credit in cents that is applied to your subscription as part of a migration process for a specific product, which reduces the amount owed for the subscription.
- CreditAppliedInCents *int64 `json:"credit_applied_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CreditAppliedInCents *int64 `json:"credit_applied_in_cents,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionMigrationPreview.
@@ -27,13 +27,17 @@ type SubscriptionMigrationPreview struct {
func (s SubscriptionMigrationPreview) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "prorated_adjustment_in_cents", "charge_in_cents", "payment_due_in_cents", "credit_applied_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionMigrationPreview object to a map representation for JSON marshaling.
func (s SubscriptionMigrationPreview) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.ProratedAdjustmentInCents != nil {
structMap["prorated_adjustment_in_cents"] = s.ProratedAdjustmentInCents
}
@@ -57,12 +61,12 @@ func (s *SubscriptionMigrationPreview) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prorated_adjustment_in_cents", "charge_in_cents", "payment_due_in_cents", "credit_applied_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prorated_adjustment_in_cents", "charge_in_cents", "payment_due_in_cents", "credit_applied_in_cents")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.ProratedAdjustmentInCents = temp.ProratedAdjustmentInCents
s.ChargeInCents = temp.ChargeInCents
s.PaymentDueInCents = temp.PaymentDueInCents
diff --git a/models/subscription_migration_preview_options.go b/models/subscription_migration_preview_options.go
index c40e8894..1dc92530 100644
--- a/models/subscription_migration_preview_options.go
+++ b/models/subscription_migration_preview_options.go
@@ -14,25 +14,25 @@ import (
// SubscriptionMigrationPreviewOptions represents a SubscriptionMigrationPreviewOptions struct.
type SubscriptionMigrationPreviewOptions struct {
// The ID of the target Product. Either a product_id or product_handle must be present. A Subscription can be migrated to another product for both the current Product Family and another Product Family. Note: Going to another Product Family, components will not be migrated as well.
- ProductId *int `json:"product_id,omitempty"`
+ ProductId *int `json:"product_id,omitempty"`
// The ID of the specified product's price point. This can be passed to migrate to a non-default price point.
- ProductPricePointId *int `json:"product_price_point_id,omitempty"`
+ ProductPricePointId *int `json:"product_price_point_id,omitempty"`
// Whether to include the trial period configured for the product price point when starting a new billing period. Note that if preserve_period is set, then include_trial will be ignored.
- IncludeTrial *bool `json:"include_trial,omitempty"`
+ IncludeTrial *bool `json:"include_trial,omitempty"`
// If `true` is sent initial charges will be assessed.
- IncludeInitialCharge *bool `json:"include_initial_charge,omitempty"`
+ IncludeInitialCharge *bool `json:"include_initial_charge,omitempty"`
// If `true` is sent, any coupons associated with the subscription will be applied to the migration. If `false` is sent, coupons will not be applied. Note: When migrating to a new product family, the coupon cannot migrate.
- IncludeCoupons *bool `json:"include_coupons,omitempty"`
+ IncludeCoupons *bool `json:"include_coupons,omitempty"`
// If `false` is sent, the subscription's billing period will be reset to today and the full price of the new product will be charged. If `true` is sent, the billing period will not change and a prorated charge will be issued for the new product.
- PreservePeriod *bool `json:"preserve_period,omitempty"`
+ PreservePeriod *bool `json:"preserve_period,omitempty"`
// The handle of the target Product. Either a product_id or product_handle must be present. A Subscription can be migrated to another product for both the current Product Family and another Product Family. Note: Going to another Product Family, components will not be migrated as well.
- ProductHandle *string `json:"product_handle,omitempty"`
+ ProductHandle *string `json:"product_handle,omitempty"`
// The ID or handle of the specified product's price point. This can be passed to migrate to a non-default price point.
- ProductPricePointHandle *string `json:"product_price_point_handle,omitempty"`
- Proration *Proration `json:"proration,omitempty"`
+ ProductPricePointHandle *string `json:"product_price_point_handle,omitempty"`
+ Proration *Proration `json:"proration,omitempty"`
// The date that the proration is calculated from for the preview
- ProrationDate *time.Time `json:"proration_date,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ProrationDate *time.Time `json:"proration_date,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionMigrationPreviewOptions.
@@ -40,13 +40,17 @@ type SubscriptionMigrationPreviewOptions struct {
func (s SubscriptionMigrationPreviewOptions) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "product_id", "product_price_point_id", "include_trial", "include_initial_charge", "include_coupons", "preserve_period", "product_handle", "product_price_point_handle", "proration", "proration_date"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionMigrationPreviewOptions object to a map representation for JSON marshaling.
func (s SubscriptionMigrationPreviewOptions) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.ProductId != nil {
structMap["product_id"] = s.ProductId
}
@@ -88,12 +92,12 @@ func (s *SubscriptionMigrationPreviewOptions) UnmarshalJSON(input []byte) error
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product_id", "product_price_point_id", "include_trial", "include_initial_charge", "include_coupons", "preserve_period", "product_handle", "product_price_point_handle", "proration", "proration_date")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product_id", "product_price_point_id", "include_trial", "include_initial_charge", "include_coupons", "preserve_period", "product_handle", "product_price_point_handle", "proration", "proration_date")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.ProductId = temp.ProductId
s.ProductPricePointId = temp.ProductPricePointId
s.IncludeTrial = temp.IncludeTrial
diff --git a/models/subscription_migration_preview_request.go b/models/subscription_migration_preview_request.go
index 68de0e28..4c8f4d3a 100644
--- a/models/subscription_migration_preview_request.go
+++ b/models/subscription_migration_preview_request.go
@@ -14,7 +14,7 @@ import (
// SubscriptionMigrationPreviewRequest represents a SubscriptionMigrationPreviewRequest struct.
type SubscriptionMigrationPreviewRequest struct {
Migration SubscriptionMigrationPreviewOptions `json:"migration"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionMigrationPreviewRequest.
@@ -22,13 +22,17 @@ type SubscriptionMigrationPreviewRequest struct {
func (s SubscriptionMigrationPreviewRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "migration"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionMigrationPreviewRequest object to a map representation for JSON marshaling.
func (s SubscriptionMigrationPreviewRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["migration"] = s.Migration.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (s *SubscriptionMigrationPreviewRequest) UnmarshalJSON(input []byte) error
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "migration")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "migration")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Migration = *temp.Migration
return nil
}
diff --git a/models/subscription_migration_preview_response.go b/models/subscription_migration_preview_response.go
index d897ab04..9b517904 100644
--- a/models/subscription_migration_preview_response.go
+++ b/models/subscription_migration_preview_response.go
@@ -14,7 +14,7 @@ import (
// SubscriptionMigrationPreviewResponse represents a SubscriptionMigrationPreviewResponse struct.
type SubscriptionMigrationPreviewResponse struct {
Migration SubscriptionMigrationPreview `json:"migration"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionMigrationPreviewResponse.
@@ -22,13 +22,17 @@ type SubscriptionMigrationPreviewResponse struct {
func (s SubscriptionMigrationPreviewResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "migration"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionMigrationPreviewResponse object to a map representation for JSON marshaling.
func (s SubscriptionMigrationPreviewResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["migration"] = s.Migration.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (s *SubscriptionMigrationPreviewResponse) UnmarshalJSON(input []byte) error
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "migration")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "migration")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Migration = *temp.Migration
return nil
}
diff --git a/models/subscription_mrr.go b/models/subscription_mrr.go
index ba8e163e..82209276 100644
--- a/models/subscription_mrr.go
+++ b/models/subscription_mrr.go
@@ -16,7 +16,7 @@ type SubscriptionMRR struct {
SubscriptionId int `json:"subscription_id"`
MrrAmountInCents int64 `json:"mrr_amount_in_cents"`
Breakouts *SubscriptionMRRBreakout `json:"breakouts,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionMRR.
@@ -24,13 +24,17 @@ type SubscriptionMRR struct {
func (s SubscriptionMRR) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "subscription_id", "mrr_amount_in_cents", "breakouts"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionMRR object to a map representation for JSON marshaling.
func (s SubscriptionMRR) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["subscription_id"] = s.SubscriptionId
structMap["mrr_amount_in_cents"] = s.MrrAmountInCents
if s.Breakouts != nil {
@@ -51,12 +55,12 @@ func (s *SubscriptionMRR) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_id", "mrr_amount_in_cents", "breakouts")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_id", "mrr_amount_in_cents", "breakouts")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.SubscriptionId = *temp.SubscriptionId
s.MrrAmountInCents = *temp.MrrAmountInCents
s.Breakouts = temp.Breakouts
diff --git a/models/subscription_mrr_breakout.go b/models/subscription_mrr_breakout.go
index 685814dd..61741e6d 100644
--- a/models/subscription_mrr_breakout.go
+++ b/models/subscription_mrr_breakout.go
@@ -13,9 +13,9 @@ import (
// SubscriptionMRRBreakout represents a SubscriptionMRRBreakout struct.
type SubscriptionMRRBreakout struct {
- PlanAmountInCents int64 `json:"plan_amount_in_cents"`
- UsageAmountInCents int64 `json:"usage_amount_in_cents"`
- AdditionalProperties map[string]any `json:"_"`
+ PlanAmountInCents int64 `json:"plan_amount_in_cents"`
+ UsageAmountInCents int64 `json:"usage_amount_in_cents"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionMRRBreakout.
@@ -23,13 +23,17 @@ type SubscriptionMRRBreakout struct {
func (s SubscriptionMRRBreakout) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "plan_amount_in_cents", "usage_amount_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionMRRBreakout object to a map representation for JSON marshaling.
func (s SubscriptionMRRBreakout) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["plan_amount_in_cents"] = s.PlanAmountInCents
structMap["usage_amount_in_cents"] = s.UsageAmountInCents
return structMap
@@ -47,12 +51,12 @@ func (s *SubscriptionMRRBreakout) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "plan_amount_in_cents", "usage_amount_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "plan_amount_in_cents", "usage_amount_in_cents")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.PlanAmountInCents = *temp.PlanAmountInCents
s.UsageAmountInCents = *temp.UsageAmountInCents
return nil
diff --git a/models/subscription_mrr_response.go b/models/subscription_mrr_response.go
index 4bda3dc3..65e561ea 100644
--- a/models/subscription_mrr_response.go
+++ b/models/subscription_mrr_response.go
@@ -13,8 +13,8 @@ import (
// SubscriptionMRRResponse represents a SubscriptionMRRResponse struct.
type SubscriptionMRRResponse struct {
- SubscriptionsMrr []SubscriptionMRR `json:"subscriptions_mrr"`
- AdditionalProperties map[string]any `json:"_"`
+ SubscriptionsMrr []SubscriptionMRR `json:"subscriptions_mrr"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionMRRResponse.
@@ -22,13 +22,17 @@ type SubscriptionMRRResponse struct {
func (s SubscriptionMRRResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "subscriptions_mrr"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionMRRResponse object to a map representation for JSON marshaling.
func (s SubscriptionMRRResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["subscriptions_mrr"] = s.SubscriptionsMrr
return structMap
}
@@ -45,12 +49,12 @@ func (s *SubscriptionMRRResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscriptions_mrr")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscriptions_mrr")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.SubscriptionsMrr = *temp.SubscriptionsMrr
return nil
}
diff --git a/models/subscription_note.go b/models/subscription_note.go
index 55c0800b..0605487e 100644
--- a/models/subscription_note.go
+++ b/models/subscription_note.go
@@ -13,13 +13,13 @@ import (
// SubscriptionNote represents a SubscriptionNote struct.
type SubscriptionNote struct {
- Id *int `json:"id,omitempty"`
- Body *string `json:"body,omitempty"`
- SubscriptionId *int `json:"subscription_id,omitempty"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- UpdatedAt *time.Time `json:"updated_at,omitempty"`
- Sticky *bool `json:"sticky,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int `json:"id,omitempty"`
+ Body *string `json:"body,omitempty"`
+ SubscriptionId *int `json:"subscription_id,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ UpdatedAt *time.Time `json:"updated_at,omitempty"`
+ Sticky *bool `json:"sticky,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionNote.
@@ -27,13 +27,17 @@ type SubscriptionNote struct {
func (s SubscriptionNote) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "id", "body", "subscription_id", "created_at", "updated_at", "sticky"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionNote object to a map representation for JSON marshaling.
func (s SubscriptionNote) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Id != nil {
structMap["id"] = s.Id
}
@@ -63,12 +67,12 @@ func (s *SubscriptionNote) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "body", "subscription_id", "created_at", "updated_at", "sticky")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "body", "subscription_id", "created_at", "updated_at", "sticky")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Id = temp.Id
s.Body = temp.Body
s.SubscriptionId = temp.SubscriptionId
diff --git a/models/subscription_note_response.go b/models/subscription_note_response.go
index 2ae69673..dd60c05a 100644
--- a/models/subscription_note_response.go
+++ b/models/subscription_note_response.go
@@ -13,8 +13,8 @@ import (
// SubscriptionNoteResponse represents a SubscriptionNoteResponse struct.
type SubscriptionNoteResponse struct {
- Note SubscriptionNote `json:"note"`
- AdditionalProperties map[string]any `json:"_"`
+ Note SubscriptionNote `json:"note"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionNoteResponse.
@@ -22,13 +22,17 @@ type SubscriptionNoteResponse struct {
func (s SubscriptionNoteResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "note"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionNoteResponse object to a map representation for JSON marshaling.
func (s SubscriptionNoteResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["note"] = s.Note.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (s *SubscriptionNoteResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "note")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "note")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Note = *temp.Note
return nil
}
diff --git a/models/subscription_preview.go b/models/subscription_preview.go
index ab354bf4..2239dc93 100644
--- a/models/subscription_preview.go
+++ b/models/subscription_preview.go
@@ -11,9 +11,9 @@ import (
// SubscriptionPreview represents a SubscriptionPreview struct.
type SubscriptionPreview struct {
- CurrentBillingManifest *BillingManifest `json:"current_billing_manifest,omitempty"`
- NextBillingManifest *BillingManifest `json:"next_billing_manifest,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CurrentBillingManifest *BillingManifest `json:"current_billing_manifest,omitempty"`
+ NextBillingManifest *BillingManifest `json:"next_billing_manifest,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionPreview.
@@ -21,13 +21,17 @@ type SubscriptionPreview struct {
func (s SubscriptionPreview) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "current_billing_manifest", "next_billing_manifest"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionPreview object to a map representation for JSON marshaling.
func (s SubscriptionPreview) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.CurrentBillingManifest != nil {
structMap["current_billing_manifest"] = s.CurrentBillingManifest.toMap()
}
@@ -45,12 +49,12 @@ func (s *SubscriptionPreview) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "current_billing_manifest", "next_billing_manifest")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "current_billing_manifest", "next_billing_manifest")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.CurrentBillingManifest = temp.CurrentBillingManifest
s.NextBillingManifest = temp.NextBillingManifest
return nil
diff --git a/models/subscription_preview_response.go b/models/subscription_preview_response.go
index 2201027c..b0463bf5 100644
--- a/models/subscription_preview_response.go
+++ b/models/subscription_preview_response.go
@@ -13,8 +13,8 @@ import (
// SubscriptionPreviewResponse represents a SubscriptionPreviewResponse struct.
type SubscriptionPreviewResponse struct {
- SubscriptionPreview SubscriptionPreview `json:"subscription_preview"`
- AdditionalProperties map[string]any `json:"_"`
+ SubscriptionPreview SubscriptionPreview `json:"subscription_preview"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionPreviewResponse.
@@ -22,13 +22,17 @@ type SubscriptionPreviewResponse struct {
func (s SubscriptionPreviewResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "subscription_preview"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionPreviewResponse object to a map representation for JSON marshaling.
func (s SubscriptionPreviewResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["subscription_preview"] = s.SubscriptionPreview.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (s *SubscriptionPreviewResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_preview")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_preview")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.SubscriptionPreview = *temp.SubscriptionPreview
return nil
}
diff --git a/models/subscription_product_change.go b/models/subscription_product_change.go
index 2c82ddbc..05889a8b 100644
--- a/models/subscription_product_change.go
+++ b/models/subscription_product_change.go
@@ -13,9 +13,9 @@ import (
// SubscriptionProductChange represents a SubscriptionProductChange struct.
type SubscriptionProductChange struct {
- PreviousProductId int `json:"previous_product_id"`
- NewProductId int `json:"new_product_id"`
- AdditionalProperties map[string]any `json:"_"`
+ PreviousProductId int `json:"previous_product_id"`
+ NewProductId int `json:"new_product_id"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionProductChange.
@@ -23,13 +23,17 @@ type SubscriptionProductChange struct {
func (s SubscriptionProductChange) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "previous_product_id", "new_product_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionProductChange object to a map representation for JSON marshaling.
func (s SubscriptionProductChange) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["previous_product_id"] = s.PreviousProductId
structMap["new_product_id"] = s.NewProductId
return structMap
@@ -47,12 +51,12 @@ func (s *SubscriptionProductChange) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "previous_product_id", "new_product_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "previous_product_id", "new_product_id")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.PreviousProductId = *temp.PreviousProductId
s.NewProductId = *temp.NewProductId
return nil
diff --git a/models/subscription_product_migration.go b/models/subscription_product_migration.go
index 62aa6a37..929f9f07 100644
--- a/models/subscription_product_migration.go
+++ b/models/subscription_product_migration.go
@@ -12,23 +12,23 @@ import (
// SubscriptionProductMigration represents a SubscriptionProductMigration struct.
type SubscriptionProductMigration struct {
// The ID of the target Product. Either a product_id or product_handle must be present. A Subscription can be migrated to another product for both the current Product Family and another Product Family. Note: Going to another Product Family, components will not be migrated as well.
- ProductId *int `json:"product_id,omitempty"`
+ ProductId *int `json:"product_id,omitempty"`
// The ID of the specified product's price point. This can be passed to migrate to a non-default price point.
- ProductPricePointId *int `json:"product_price_point_id,omitempty"`
+ ProductPricePointId *int `json:"product_price_point_id,omitempty"`
// Whether to include the trial period configured for the product price point when starting a new billing period. Note that if preserve_period is set, then include_trial will be ignored.
- IncludeTrial *bool `json:"include_trial,omitempty"`
+ IncludeTrial *bool `json:"include_trial,omitempty"`
// If `true` is sent initial charges will be assessed.
- IncludeInitialCharge *bool `json:"include_initial_charge,omitempty"`
+ IncludeInitialCharge *bool `json:"include_initial_charge,omitempty"`
// If `true` is sent, any coupons associated with the subscription will be applied to the migration. If `false` is sent, coupons will not be applied. Note: When migrating to a new product family, the coupon cannot migrate.
- IncludeCoupons *bool `json:"include_coupons,omitempty"`
+ IncludeCoupons *bool `json:"include_coupons,omitempty"`
// If `false` is sent, the subscription's billing period will be reset to today and the full price of the new product will be charged. If `true` is sent, the billing period will not change and a prorated charge will be issued for the new product.
- PreservePeriod *bool `json:"preserve_period,omitempty"`
+ PreservePeriod *bool `json:"preserve_period,omitempty"`
// The handle of the target Product. Either a product_id or product_handle must be present. A Subscription can be migrated to another product for both the current Product Family and another Product Family. Note: Going to another Product Family, components will not be migrated as well.
- ProductHandle *string `json:"product_handle,omitempty"`
+ ProductHandle *string `json:"product_handle,omitempty"`
// The ID or handle of the specified product's price point. This can be passed to migrate to a non-default price point.
- ProductPricePointHandle *string `json:"product_price_point_handle,omitempty"`
- Proration *Proration `json:"proration,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ ProductPricePointHandle *string `json:"product_price_point_handle,omitempty"`
+ Proration *Proration `json:"proration,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionProductMigration.
@@ -36,13 +36,17 @@ type SubscriptionProductMigration struct {
func (s SubscriptionProductMigration) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "product_id", "product_price_point_id", "include_trial", "include_initial_charge", "include_coupons", "preserve_period", "product_handle", "product_price_point_handle", "proration"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionProductMigration object to a map representation for JSON marshaling.
func (s SubscriptionProductMigration) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.ProductId != nil {
structMap["product_id"] = s.ProductId
}
@@ -81,12 +85,12 @@ func (s *SubscriptionProductMigration) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "product_id", "product_price_point_id", "include_trial", "include_initial_charge", "include_coupons", "preserve_period", "product_handle", "product_price_point_handle", "proration")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "product_id", "product_price_point_id", "include_trial", "include_initial_charge", "include_coupons", "preserve_period", "product_handle", "product_price_point_handle", "proration")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.ProductId = temp.ProductId
s.ProductPricePointId = temp.ProductPricePointId
s.IncludeTrial = temp.IncludeTrial
diff --git a/models/subscription_product_migration_request.go b/models/subscription_product_migration_request.go
index 7b5bfca6..81676407 100644
--- a/models/subscription_product_migration_request.go
+++ b/models/subscription_product_migration_request.go
@@ -14,7 +14,7 @@ import (
// SubscriptionProductMigrationRequest represents a SubscriptionProductMigrationRequest struct.
type SubscriptionProductMigrationRequest struct {
Migration SubscriptionProductMigration `json:"migration"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionProductMigrationRequest.
@@ -22,13 +22,17 @@ type SubscriptionProductMigrationRequest struct {
func (s SubscriptionProductMigrationRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "migration"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionProductMigrationRequest object to a map representation for JSON marshaling.
func (s SubscriptionProductMigrationRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["migration"] = s.Migration.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (s *SubscriptionProductMigrationRequest) UnmarshalJSON(input []byte) error
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "migration")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "migration")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Migration = *temp.Migration
return nil
}
diff --git a/models/subscription_response.go b/models/subscription_response.go
index 8506bc39..6ea590ad 100644
--- a/models/subscription_response.go
+++ b/models/subscription_response.go
@@ -11,8 +11,8 @@ import (
// SubscriptionResponse represents a SubscriptionResponse struct.
type SubscriptionResponse struct {
- Subscription *Subscription `json:"subscription,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Subscription *Subscription `json:"subscription,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionResponse.
@@ -20,13 +20,17 @@ type SubscriptionResponse struct {
func (s SubscriptionResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "subscription"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionResponse object to a map representation for JSON marshaling.
func (s SubscriptionResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
if s.Subscription != nil {
structMap["subscription"] = s.Subscription.toMap()
}
@@ -41,12 +45,12 @@ func (s *SubscriptionResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.Subscription = temp.Subscription
return nil
}
diff --git a/models/subscription_state_change.go b/models/subscription_state_change.go
index 18c5d0cc..f19f2376 100644
--- a/models/subscription_state_change.go
+++ b/models/subscription_state_change.go
@@ -13,9 +13,9 @@ import (
// SubscriptionStateChange represents a SubscriptionStateChange struct.
type SubscriptionStateChange struct {
- PreviousSubscriptionState string `json:"previous_subscription_state"`
- NewSubscriptionState string `json:"new_subscription_state"`
- AdditionalProperties map[string]any `json:"_"`
+ PreviousSubscriptionState string `json:"previous_subscription_state"`
+ NewSubscriptionState string `json:"new_subscription_state"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for SubscriptionStateChange.
@@ -23,13 +23,17 @@ type SubscriptionStateChange struct {
func (s SubscriptionStateChange) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(s.AdditionalProperties,
+ "previous_subscription_state", "new_subscription_state"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(s.toMap())
}
// toMap converts the SubscriptionStateChange object to a map representation for JSON marshaling.
func (s SubscriptionStateChange) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, s.AdditionalProperties)
+ MergeAdditionalProperties(structMap, s.AdditionalProperties)
structMap["previous_subscription_state"] = s.PreviousSubscriptionState
structMap["new_subscription_state"] = s.NewSubscriptionState
return structMap
@@ -47,12 +51,12 @@ func (s *SubscriptionStateChange) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "previous_subscription_state", "new_subscription_state")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "previous_subscription_state", "new_subscription_state")
if err != nil {
return err
}
-
s.AdditionalProperties = additionalProperties
+
s.PreviousSubscriptionState = *temp.PreviousSubscriptionState
s.NewSubscriptionState = *temp.NewSubscriptionState
return nil
diff --git a/models/tax_configuration.go b/models/tax_configuration.go
index 1ff325ea..7d0df270 100644
--- a/models/tax_configuration.go
+++ b/models/tax_configuration.go
@@ -15,7 +15,7 @@ type TaxConfiguration struct {
DestinationAddress *TaxDestinationAddress `json:"destination_address,omitempty"`
// Returns `true` when Chargify has been properly configured to charge tax using the specified tax system. More details about taxes: https://maxio.zendesk.com/hc/en-us/articles/24287012608909-Taxes-Overview
FullyConfigured *bool `json:"fully_configured,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for TaxConfiguration.
@@ -23,13 +23,17 @@ type TaxConfiguration struct {
func (t TaxConfiguration) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(t.AdditionalProperties,
+ "kind", "destination_address", "fully_configured"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(t.toMap())
}
// toMap converts the TaxConfiguration object to a map representation for JSON marshaling.
func (t TaxConfiguration) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, t.AdditionalProperties)
+ MergeAdditionalProperties(structMap, t.AdditionalProperties)
if t.Kind != nil {
structMap["kind"] = t.Kind
}
@@ -50,12 +54,12 @@ func (t *TaxConfiguration) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "kind", "destination_address", "fully_configured")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "kind", "destination_address", "fully_configured")
if err != nil {
return err
}
-
t.AdditionalProperties = additionalProperties
+
t.Kind = temp.Kind
t.DestinationAddress = temp.DestinationAddress
t.FullyConfigured = temp.FullyConfigured
diff --git a/models/too_many_management_link_requests.go b/models/too_many_management_link_requests.go
index eb17c054..e76ec4cb 100644
--- a/models/too_many_management_link_requests.go
+++ b/models/too_many_management_link_requests.go
@@ -15,9 +15,9 @@ import (
// TooManyManagementLinkRequests represents a TooManyManagementLinkRequests struct.
type TooManyManagementLinkRequests struct {
- Error string `json:"error"`
- NewLinkAvailableAt time.Time `json:"new_link_available_at"`
- AdditionalProperties map[string]any `json:"_"`
+ Error string `json:"error"`
+ NewLinkAvailableAt time.Time `json:"new_link_available_at"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for TooManyManagementLinkRequests.
@@ -25,13 +25,17 @@ type TooManyManagementLinkRequests struct {
func (t TooManyManagementLinkRequests) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(t.AdditionalProperties,
+ "error", "new_link_available_at"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(t.toMap())
}
// toMap converts the TooManyManagementLinkRequests object to a map representation for JSON marshaling.
func (t TooManyManagementLinkRequests) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, t.AdditionalProperties)
+ MergeAdditionalProperties(structMap, t.AdditionalProperties)
structMap["error"] = t.Error
structMap["new_link_available_at"] = t.NewLinkAvailableAt.Format(time.RFC3339)
return structMap
@@ -49,12 +53,12 @@ func (t *TooManyManagementLinkRequests) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "error", "new_link_available_at")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "error", "new_link_available_at")
if err != nil {
return err
}
-
t.AdditionalProperties = additionalProperties
+
t.Error = *temp.Error
NewLinkAvailableAtVal, err := time.Parse(time.RFC3339, *temp.NewLinkAvailableAt)
if err != nil {
diff --git a/models/update_allocation_expiration_date.go b/models/update_allocation_expiration_date.go
index b16a5de5..9a4a32c2 100644
--- a/models/update_allocation_expiration_date.go
+++ b/models/update_allocation_expiration_date.go
@@ -12,7 +12,7 @@ import (
// UpdateAllocationExpirationDate represents a UpdateAllocationExpirationDate struct.
type UpdateAllocationExpirationDate struct {
Allocation *AllocationExpirationDate `json:"allocation,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateAllocationExpirationDate.
@@ -20,13 +20,17 @@ type UpdateAllocationExpirationDate struct {
func (u UpdateAllocationExpirationDate) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "allocation"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateAllocationExpirationDate object to a map representation for JSON marshaling.
func (u UpdateAllocationExpirationDate) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.Allocation != nil {
structMap["allocation"] = u.Allocation.toMap()
}
@@ -41,12 +45,12 @@ func (u *UpdateAllocationExpirationDate) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "allocation")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "allocation")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Allocation = temp.Allocation
return nil
}
diff --git a/models/update_component.go b/models/update_component.go
index 2913df79..5d13c592 100644
--- a/models/update_component.go
+++ b/models/update_component.go
@@ -27,7 +27,7 @@ type UpdateComponent struct {
// The type of credit to be created when upgrading/downgrading. Defaults to the component and then site setting if one is not provided.
// Available values: `full`, `prorated`, `none`.
UpgradeCharge Optional[CreditType] `json:"upgrade_charge"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateComponent.
@@ -35,13 +35,17 @@ type UpdateComponent struct {
func (u UpdateComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "handle", "name", "description", "accounting_code", "taxable", "tax_code", "item_category", "display_on_hosted_page", "upgrade_charge"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateComponent object to a map representation for JSON marshaling.
func (u UpdateComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.Handle != nil {
structMap["handle"] = u.Handle
}
@@ -100,12 +104,12 @@ func (u *UpdateComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "handle", "name", "description", "accounting_code", "taxable", "tax_code", "item_category", "display_on_hosted_page", "upgrade_charge")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "handle", "name", "description", "accounting_code", "taxable", "tax_code", "item_category", "display_on_hosted_page", "upgrade_charge")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Handle = temp.Handle
u.Name = temp.Name
u.Description = temp.Description
diff --git a/models/update_component_price_point.go b/models/update_component_price_point.go
index 57a20241..cbb9261b 100644
--- a/models/update_component_price_point.go
+++ b/models/update_component_price_point.go
@@ -24,7 +24,7 @@ type UpdateComponentPricePoint struct {
// 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 Optional[IntervalUnit] `json:"interval_unit"`
Prices []UpdatePrice `json:"prices,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateComponentPricePoint.
@@ -32,13 +32,17 @@ type UpdateComponentPricePoint struct {
func (u UpdateComponentPricePoint) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "name", "handle", "pricing_scheme", "use_site_exchange_rate", "tax_included", "interval", "interval_unit", "prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateComponentPricePoint object to a map representation for JSON marshaling.
func (u UpdateComponentPricePoint) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.Name != nil {
structMap["name"] = u.Name
}
@@ -78,12 +82,12 @@ func (u *UpdateComponentPricePoint) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "name", "handle", "pricing_scheme", "use_site_exchange_rate", "tax_included", "interval", "interval_unit", "prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "name", "handle", "pricing_scheme", "use_site_exchange_rate", "tax_included", "interval", "interval_unit", "prices")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Name = temp.Name
u.Handle = temp.Handle
u.PricingScheme = temp.PricingScheme
diff --git a/models/update_component_price_point_request.go b/models/update_component_price_point_request.go
index 29c25309..9f22a9aa 100644
--- a/models/update_component_price_point_request.go
+++ b/models/update_component_price_point_request.go
@@ -12,7 +12,7 @@ import (
// UpdateComponentPricePointRequest represents a UpdateComponentPricePointRequest struct.
type UpdateComponentPricePointRequest struct {
PricePoint *UpdateComponentPricePoint `json:"price_point,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateComponentPricePointRequest.
@@ -20,13 +20,17 @@ type UpdateComponentPricePointRequest struct {
func (u UpdateComponentPricePointRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "price_point"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateComponentPricePointRequest object to a map representation for JSON marshaling.
func (u UpdateComponentPricePointRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.PricePoint != nil {
structMap["price_point"] = u.PricePoint.toMap()
}
@@ -41,12 +45,12 @@ func (u *UpdateComponentPricePointRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_point")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_point")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.PricePoint = temp.PricePoint
return nil
}
diff --git a/models/update_component_request.go b/models/update_component_request.go
index 324f2c9e..3df4eb11 100644
--- a/models/update_component_request.go
+++ b/models/update_component_request.go
@@ -13,8 +13,8 @@ import (
// UpdateComponentRequest represents a UpdateComponentRequest struct.
type UpdateComponentRequest struct {
- Component UpdateComponent `json:"component"`
- AdditionalProperties map[string]any `json:"_"`
+ Component UpdateComponent `json:"component"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateComponentRequest.
@@ -22,13 +22,17 @@ type UpdateComponentRequest struct {
func (u UpdateComponentRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "component"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateComponentRequest object to a map representation for JSON marshaling.
func (u UpdateComponentRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["component"] = u.Component.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (u *UpdateComponentRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Component = *temp.Component
return nil
}
diff --git a/models/update_coupon_currency.go b/models/update_coupon_currency.go
index 2fba5953..175eec52 100644
--- a/models/update_coupon_currency.go
+++ b/models/update_coupon_currency.go
@@ -14,10 +14,10 @@ import (
// UpdateCouponCurrency represents a UpdateCouponCurrency struct.
type UpdateCouponCurrency struct {
// ISO code for the site defined currency.
- Currency string `json:"currency"`
+ Currency string `json:"currency"`
// Price for the given currency.
- Price int `json:"price"`
- AdditionalProperties map[string]any `json:"_"`
+ Price int `json:"price"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateCouponCurrency.
@@ -25,13 +25,17 @@ type UpdateCouponCurrency struct {
func (u UpdateCouponCurrency) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "currency", "price"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateCouponCurrency object to a map representation for JSON marshaling.
func (u UpdateCouponCurrency) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["currency"] = u.Currency
structMap["price"] = u.Price
return structMap
@@ -49,12 +53,12 @@ func (u *UpdateCouponCurrency) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currency", "price")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currency", "price")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Currency = *temp.Currency
u.Price = *temp.Price
return nil
diff --git a/models/update_currency_price.go b/models/update_currency_price.go
index 16c5b70d..b6c3a173 100644
--- a/models/update_currency_price.go
+++ b/models/update_currency_price.go
@@ -14,10 +14,10 @@ import (
// UpdateCurrencyPrice represents a UpdateCurrencyPrice struct.
type UpdateCurrencyPrice struct {
// ID of the currency price record being updated
- Id int `json:"id"`
+ Id int `json:"id"`
// New price for the given currency
- Price int `json:"price"`
- AdditionalProperties map[string]any `json:"_"`
+ Price float64 `json:"price"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateCurrencyPrice.
@@ -25,13 +25,17 @@ type UpdateCurrencyPrice struct {
func (u UpdateCurrencyPrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "id", "price"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateCurrencyPrice object to a map representation for JSON marshaling.
func (u UpdateCurrencyPrice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["id"] = u.Id
structMap["price"] = u.Price
return structMap
@@ -49,12 +53,12 @@ func (u *UpdateCurrencyPrice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "price")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "price")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Id = *temp.Id
u.Price = *temp.Price
return nil
@@ -62,8 +66,8 @@ func (u *UpdateCurrencyPrice) UnmarshalJSON(input []byte) error {
// tempUpdateCurrencyPrice is a temporary struct used for validating the fields of UpdateCurrencyPrice.
type tempUpdateCurrencyPrice struct {
- Id *int `json:"id"`
- Price *int `json:"price"`
+ Id *int `json:"id"`
+ Price *float64 `json:"price"`
}
func (u *tempUpdateCurrencyPrice) validate() error {
diff --git a/models/update_currency_prices_request.go b/models/update_currency_prices_request.go
index 4c5aef88..698d3d2c 100644
--- a/models/update_currency_prices_request.go
+++ b/models/update_currency_prices_request.go
@@ -13,8 +13,8 @@ import (
// UpdateCurrencyPricesRequest represents a UpdateCurrencyPricesRequest struct.
type UpdateCurrencyPricesRequest struct {
- CurrencyPrices []UpdateCurrencyPrice `json:"currency_prices"`
- AdditionalProperties map[string]any `json:"_"`
+ CurrencyPrices []UpdateCurrencyPrice `json:"currency_prices"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateCurrencyPricesRequest.
@@ -22,13 +22,17 @@ type UpdateCurrencyPricesRequest struct {
func (u UpdateCurrencyPricesRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "currency_prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateCurrencyPricesRequest object to a map representation for JSON marshaling.
func (u UpdateCurrencyPricesRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["currency_prices"] = u.CurrencyPrices
return structMap
}
@@ -45,12 +49,12 @@ func (u *UpdateCurrencyPricesRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "currency_prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "currency_prices")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.CurrencyPrices = *temp.CurrencyPrices
return nil
}
diff --git a/models/update_customer.go b/models/update_customer.go
index b05ef679..4be8af33 100644
--- a/models/update_customer.go
+++ b/models/update_customer.go
@@ -11,30 +11,30 @@ import (
// UpdateCustomer represents a UpdateCustomer struct.
type UpdateCustomer struct {
- FirstName *string `json:"first_name,omitempty"`
- LastName *string `json:"last_name,omitempty"`
- Email *string `json:"email,omitempty"`
- CcEmails *string `json:"cc_emails,omitempty"`
- Organization *string `json:"organization,omitempty"`
- Reference *string `json:"reference,omitempty"`
- Address *string `json:"address,omitempty"`
- Address2 *string `json:"address_2,omitempty"`
- City *string `json:"city,omitempty"`
- State *string `json:"state,omitempty"`
- Zip *string `json:"zip,omitempty"`
- Country *string `json:"country,omitempty"`
- Phone *string `json:"phone,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
+ LastName *string `json:"last_name,omitempty"`
+ Email *string `json:"email,omitempty"`
+ CcEmails *string `json:"cc_emails,omitempty"`
+ Organization *string `json:"organization,omitempty"`
+ Reference *string `json:"reference,omitempty"`
+ Address *string `json:"address,omitempty"`
+ Address2 *string `json:"address_2,omitempty"`
+ City *string `json:"city,omitempty"`
+ State *string `json:"state,omitempty"`
+ Zip *string `json:"zip,omitempty"`
+ Country *string `json:"country,omitempty"`
+ Phone *string `json:"phone,omitempty"`
// Set a specific language on a customer record.
- Locale *string `json:"locale,omitempty"`
- VatNumber *string `json:"vat_number,omitempty"`
- TaxExempt *bool `json:"tax_exempt,omitempty"`
- TaxExemptReason *string `json:"tax_exempt_reason,omitempty"`
- ParentId Optional[int] `json:"parent_id"`
+ Locale *string `json:"locale,omitempty"`
+ VatNumber *string `json:"vat_number,omitempty"`
+ TaxExempt *bool `json:"tax_exempt,omitempty"`
+ TaxExemptReason *string `json:"tax_exempt_reason,omitempty"`
+ ParentId Optional[int] `json:"parent_id"`
// Is the customer verified to use ACH as a payment method. Available only on Authorize.Net gateway
- Verified Optional[bool] `json:"verified"`
+ Verified Optional[bool] `json:"verified"`
// The Salesforce ID of the customer
- SalesforceId Optional[string] `json:"salesforce_id"`
- AdditionalProperties map[string]any `json:"_"`
+ SalesforceId Optional[string] `json:"salesforce_id"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateCustomer.
@@ -42,13 +42,17 @@ type UpdateCustomer struct {
func (u UpdateCustomer) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "locale", "vat_number", "tax_exempt", "tax_exempt_reason", "parent_id", "verified", "salesforce_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateCustomer object to a map representation for JSON marshaling.
func (u UpdateCustomer) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.FirstName != nil {
structMap["first_name"] = u.FirstName
}
@@ -132,12 +136,12 @@ func (u *UpdateCustomer) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "locale", "vat_number", "tax_exempt", "tax_exempt_reason", "parent_id", "verified", "salesforce_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "first_name", "last_name", "email", "cc_emails", "organization", "reference", "address", "address_2", "city", "state", "zip", "country", "phone", "locale", "vat_number", "tax_exempt", "tax_exempt_reason", "parent_id", "verified", "salesforce_id")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.FirstName = temp.FirstName
u.LastName = temp.LastName
u.Email = temp.Email
diff --git a/models/update_customer_request.go b/models/update_customer_request.go
index 80d99f66..94272a9c 100644
--- a/models/update_customer_request.go
+++ b/models/update_customer_request.go
@@ -13,8 +13,8 @@ import (
// UpdateCustomerRequest represents a UpdateCustomerRequest struct.
type UpdateCustomerRequest struct {
- Customer UpdateCustomer `json:"customer"`
- AdditionalProperties map[string]any `json:"_"`
+ Customer UpdateCustomer `json:"customer"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateCustomerRequest.
@@ -22,13 +22,17 @@ type UpdateCustomerRequest struct {
func (u UpdateCustomerRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "customer"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateCustomerRequest object to a map representation for JSON marshaling.
func (u UpdateCustomerRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["customer"] = u.Customer.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (u *UpdateCustomerRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "customer")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "customer")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Customer = *temp.Customer
return nil
}
diff --git a/models/update_metadata.go b/models/update_metadata.go
index 429a0d5b..ae386d03 100644
--- a/models/update_metadata.go
+++ b/models/update_metadata.go
@@ -11,10 +11,10 @@ import (
// UpdateMetadata represents a UpdateMetadata struct.
type UpdateMetadata struct {
- CurrentName *string `json:"current_name,omitempty"`
- Name *string `json:"name,omitempty"`
- Value *string `json:"value,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CurrentName *string `json:"current_name,omitempty"`
+ Name *string `json:"name,omitempty"`
+ Value *string `json:"value,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateMetadata.
@@ -22,13 +22,17 @@ type UpdateMetadata struct {
func (u UpdateMetadata) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "current_name", "name", "value"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateMetadata object to a map representation for JSON marshaling.
func (u UpdateMetadata) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.CurrentName != nil {
structMap["current_name"] = u.CurrentName
}
@@ -49,12 +53,12 @@ func (u *UpdateMetadata) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "current_name", "name", "value")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "current_name", "name", "value")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.CurrentName = temp.CurrentName
u.Name = temp.Name
u.Value = temp.Value
diff --git a/models/update_metadata_request.go b/models/update_metadata_request.go
index f5ab7136..e8601c5d 100644
--- a/models/update_metadata_request.go
+++ b/models/update_metadata_request.go
@@ -11,8 +11,8 @@ import (
// UpdateMetadataRequest represents a UpdateMetadataRequest struct.
type UpdateMetadataRequest struct {
- Metadata *UpdateMetadata `json:"metadata,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Metadata *UpdateMetadata `json:"metadata,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateMetadataRequest.
@@ -20,13 +20,17 @@ type UpdateMetadataRequest struct {
func (u UpdateMetadataRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "metadata"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateMetadataRequest object to a map representation for JSON marshaling.
func (u UpdateMetadataRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.Metadata != nil {
structMap["metadata"] = u.Metadata.toMap()
}
@@ -41,12 +45,12 @@ func (u *UpdateMetadataRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "metadata")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "metadata")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Metadata = temp.Metadata
return nil
}
diff --git a/models/update_metafield.go b/models/update_metafield.go
index 65d432cc..03c29c21 100644
--- a/models/update_metafield.go
+++ b/models/update_metafield.go
@@ -11,15 +11,15 @@ import (
// UpdateMetafield represents a UpdateMetafield struct.
type UpdateMetafield struct {
- CurrentName *string `json:"current_name,omitempty"`
- Name *string `json:"name,omitempty"`
+ CurrentName *string `json:"current_name,omitempty"`
+ Name *string `json:"name,omitempty"`
// Warning: When updating a metafield's scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings.
- Scope *MetafieldScope `json:"scope,omitempty"`
+ Scope *MetafieldScope `json:"scope,omitempty"`
// Indicates how data should be added to the metafield. For example, a text type is just a string, so a given metafield of this type can have any value attached. On the other hand, dropdown and radio have a set of allowed values that can be input, and appear differently on a Public Signup Page. Defaults to 'text'
- InputType *MetafieldInput `json:"input_type,omitempty"`
+ InputType *MetafieldInput `json:"input_type,omitempty"`
// Only applicable when input_type is radio or dropdown
- Enum []string `json:"enum,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Enum []string `json:"enum,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateMetafield.
@@ -27,13 +27,17 @@ type UpdateMetafield struct {
func (u UpdateMetafield) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "current_name", "name", "scope", "input_type", "enum"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateMetafield object to a map representation for JSON marshaling.
func (u UpdateMetafield) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.CurrentName != nil {
structMap["current_name"] = u.CurrentName
}
@@ -60,12 +64,12 @@ func (u *UpdateMetafield) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "current_name", "name", "scope", "input_type", "enum")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "current_name", "name", "scope", "input_type", "enum")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.CurrentName = temp.CurrentName
u.Name = temp.Name
u.Scope = temp.Scope
diff --git a/models/update_metafields_request.go b/models/update_metafields_request.go
index 4f6d1926..75b70505 100644
--- a/models/update_metafields_request.go
+++ b/models/update_metafields_request.go
@@ -12,7 +12,7 @@ import (
// UpdateMetafieldsRequest represents a UpdateMetafieldsRequest struct.
type UpdateMetafieldsRequest struct {
Metafields *UpdateMetafieldsRequestMetafields `json:"metafields,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateMetafieldsRequest.
@@ -20,13 +20,17 @@ type UpdateMetafieldsRequest struct {
func (u UpdateMetafieldsRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "metafields"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateMetafieldsRequest object to a map representation for JSON marshaling.
func (u UpdateMetafieldsRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.Metafields != nil {
structMap["metafields"] = u.Metafields.toMap()
}
@@ -41,12 +45,12 @@ func (u *UpdateMetafieldsRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "metafields")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "metafields")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Metafields = temp.Metafields
return nil
}
diff --git a/models/update_payment_profile.go b/models/update_payment_profile.go
index 3e78de29..23cdc9b3 100644
--- a/models/update_payment_profile.go
+++ b/models/update_payment_profile.go
@@ -12,32 +12,32 @@ import (
// UpdatePaymentProfile represents a UpdatePaymentProfile struct.
type UpdatePaymentProfile struct {
// The first name of the card holder.
- FirstName *string `json:"first_name,omitempty"`
+ FirstName *string `json:"first_name,omitempty"`
// The last name of the card holder.
- LastName *string `json:"last_name,omitempty"`
+ LastName *string `json:"last_name,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 *string `json:"expiration_month,omitempty"`
+ ExpirationMonth *string `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 *string `json:"expiration_year,omitempty"`
+ ExpirationYear *string `json:"expiration_year,omitempty"`
// The vault that stores the payment profile with the provided `vault_token`. Use `bogus` for testing.
- CurrentVault *AllVaults `json:"current_vault,omitempty"`
+ CurrentVault *AllVaults `json:"current_vault,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"`
// 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 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 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"`
// Second line of the customer’s billing address i.e. Apt. 100
- BillingAddress2 Optional[string] `json:"billing_address_2"`
- AdditionalProperties map[string]any `json:"_"`
+ BillingAddress2 Optional[string] `json:"billing_address_2"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdatePaymentProfile.
@@ -45,13 +45,17 @@ type UpdatePaymentProfile struct {
func (u UpdatePaymentProfile) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "first_name", "last_name", "full_number", "card_type", "expiration_month", "expiration_year", "current_vault", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "billing_address_2"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdatePaymentProfile object to a map representation for JSON marshaling.
func (u UpdatePaymentProfile) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.FirstName != nil {
structMap["first_name"] = u.FirstName
}
@@ -106,12 +110,12 @@ func (u *UpdatePaymentProfile) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "first_name", "last_name", "full_number", "card_type", "expiration_month", "expiration_year", "current_vault", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "billing_address_2")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "first_name", "last_name", "full_number", "card_type", "expiration_month", "expiration_year", "current_vault", "billing_address", "billing_city", "billing_state", "billing_zip", "billing_country", "billing_address_2")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.FirstName = temp.FirstName
u.LastName = temp.LastName
u.FullNumber = temp.FullNumber
diff --git a/models/update_payment_profile_request.go b/models/update_payment_profile_request.go
index 8d503034..d9a10cd0 100644
--- a/models/update_payment_profile_request.go
+++ b/models/update_payment_profile_request.go
@@ -13,8 +13,8 @@ import (
// UpdatePaymentProfileRequest represents a UpdatePaymentProfileRequest struct.
type UpdatePaymentProfileRequest struct {
- PaymentProfile UpdatePaymentProfile `json:"payment_profile"`
- AdditionalProperties map[string]any `json:"_"`
+ PaymentProfile UpdatePaymentProfile `json:"payment_profile"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdatePaymentProfileRequest.
@@ -22,13 +22,17 @@ type UpdatePaymentProfileRequest struct {
func (u UpdatePaymentProfileRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "payment_profile"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdatePaymentProfileRequest object to a map representation for JSON marshaling.
func (u UpdatePaymentProfileRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["payment_profile"] = u.PaymentProfile.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (u *UpdatePaymentProfileRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "payment_profile")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "payment_profile")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.PaymentProfile = *temp.PaymentProfile
return nil
}
diff --git a/models/update_price.go b/models/update_price.go
index 82713205..4ed7fdbc 100644
--- a/models/update_price.go
+++ b/models/update_price.go
@@ -17,7 +17,7 @@ type UpdatePrice struct {
UnitPrice *UpdatePriceUnitPrice `json:"unit_price,omitempty"`
Destroy *bool `json:"_destroy,omitempty"`
StartingQuantity *UpdatePriceStartingQuantity `json:"starting_quantity,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdatePrice.
@@ -25,13 +25,17 @@ type UpdatePrice struct {
func (u UpdatePrice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "id", "ending_quantity", "unit_price", "_destroy", "starting_quantity"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdatePrice object to a map representation for JSON marshaling.
func (u UpdatePrice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.Id != nil {
structMap["id"] = u.Id
}
@@ -58,12 +62,12 @@ func (u *UpdatePrice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "ending_quantity", "unit_price", "_destroy", "starting_quantity")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "ending_quantity", "unit_price", "_destroy", "starting_quantity")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Id = temp.Id
u.EndingQuantity = temp.EndingQuantity
u.UnitPrice = temp.UnitPrice
diff --git a/models/update_product_price_point.go b/models/update_product_price_point.go
index d1fe28f0..b89f97e1 100644
--- a/models/update_product_price_point.go
+++ b/models/update_product_price_point.go
@@ -11,9 +11,9 @@ import (
// UpdateProductPricePoint represents a UpdateProductPricePoint struct.
type UpdateProductPricePoint struct {
- Handle *string `json:"handle,omitempty"`
- PriceInCents *int64 `json:"price_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Handle *string `json:"handle,omitempty"`
+ PriceInCents *int64 `json:"price_in_cents,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateProductPricePoint.
@@ -21,13 +21,17 @@ type UpdateProductPricePoint struct {
func (u UpdateProductPricePoint) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "handle", "price_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateProductPricePoint object to a map representation for JSON marshaling.
func (u UpdateProductPricePoint) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.Handle != nil {
structMap["handle"] = u.Handle
}
@@ -45,12 +49,12 @@ func (u *UpdateProductPricePoint) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "handle", "price_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "handle", "price_in_cents")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Handle = temp.Handle
u.PriceInCents = temp.PriceInCents
return nil
diff --git a/models/update_product_price_point_request.go b/models/update_product_price_point_request.go
index b11a9788..b6b4729d 100644
--- a/models/update_product_price_point_request.go
+++ b/models/update_product_price_point_request.go
@@ -14,7 +14,7 @@ import (
// UpdateProductPricePointRequest represents a UpdateProductPricePointRequest struct.
type UpdateProductPricePointRequest struct {
PricePoint UpdateProductPricePoint `json:"price_point"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateProductPricePointRequest.
@@ -22,13 +22,17 @@ type UpdateProductPricePointRequest struct {
func (u UpdateProductPricePointRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "price_point"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateProductPricePointRequest object to a map representation for JSON marshaling.
func (u UpdateProductPricePointRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["price_point"] = u.PricePoint.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (u *UpdateProductPricePointRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "price_point")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "price_point")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.PricePoint = *temp.PricePoint
return nil
}
diff --git a/models/update_reason_code.go b/models/update_reason_code.go
index 64e53332..0c530dfd 100644
--- a/models/update_reason_code.go
+++ b/models/update_reason_code.go
@@ -12,12 +12,12 @@ import (
// UpdateReasonCode represents a UpdateReasonCode struct.
type UpdateReasonCode struct {
// The unique identifier for the ReasonCode
- Code *string `json:"code,omitempty"`
+ Code *string `json:"code,omitempty"`
// The friendly summary of what the code signifies
- Description *string `json:"description,omitempty"`
+ Description *string `json:"description,omitempty"`
// The order that code appears in lists
- Position *int `json:"position,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Position *int `json:"position,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateReasonCode.
@@ -25,13 +25,17 @@ type UpdateReasonCode struct {
func (u UpdateReasonCode) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "code", "description", "position"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateReasonCode object to a map representation for JSON marshaling.
func (u UpdateReasonCode) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.Code != nil {
structMap["code"] = u.Code
}
@@ -52,12 +56,12 @@ func (u *UpdateReasonCode) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "code", "description", "position")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "code", "description", "position")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Code = temp.Code
u.Description = temp.Description
u.Position = temp.Position
diff --git a/models/update_reason_code_request.go b/models/update_reason_code_request.go
index 6c55a375..f541e865 100644
--- a/models/update_reason_code_request.go
+++ b/models/update_reason_code_request.go
@@ -13,8 +13,8 @@ import (
// UpdateReasonCodeRequest represents a UpdateReasonCodeRequest struct.
type UpdateReasonCodeRequest struct {
- ReasonCode UpdateReasonCode `json:"reason_code"`
- AdditionalProperties map[string]any `json:"_"`
+ ReasonCode UpdateReasonCode `json:"reason_code"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateReasonCodeRequest.
@@ -22,13 +22,17 @@ type UpdateReasonCodeRequest struct {
func (u UpdateReasonCodeRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "reason_code"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateReasonCodeRequest object to a map representation for JSON marshaling.
func (u UpdateReasonCodeRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["reason_code"] = u.ReasonCode.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (u *UpdateReasonCodeRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "reason_code")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "reason_code")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.ReasonCode = *temp.ReasonCode
return nil
}
diff --git a/models/update_segment.go b/models/update_segment.go
index f85d550a..f529b2db 100644
--- a/models/update_segment.go
+++ b/models/update_segment.go
@@ -16,7 +16,7 @@ type UpdateSegment struct {
// 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"`
Prices []CreateOrUpdateSegmentPrice `json:"prices,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateSegment.
@@ -24,13 +24,17 @@ type UpdateSegment struct {
func (u UpdateSegment) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "pricing_scheme", "prices"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateSegment object to a map representation for JSON marshaling.
func (u UpdateSegment) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["pricing_scheme"] = u.PricingScheme
if u.Prices != nil {
structMap["prices"] = u.Prices
@@ -50,12 +54,12 @@ func (u *UpdateSegment) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "pricing_scheme", "prices")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "pricing_scheme", "prices")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.PricingScheme = *temp.PricingScheme
u.Prices = temp.Prices
return nil
diff --git a/models/update_segment_request.go b/models/update_segment_request.go
index b1a31aea..817c9df8 100644
--- a/models/update_segment_request.go
+++ b/models/update_segment_request.go
@@ -13,8 +13,8 @@ import (
// UpdateSegmentRequest represents a UpdateSegmentRequest struct.
type UpdateSegmentRequest struct {
- Segment UpdateSegment `json:"segment"`
- AdditionalProperties map[string]any `json:"_"`
+ Segment UpdateSegment `json:"segment"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateSegmentRequest.
@@ -22,13 +22,17 @@ type UpdateSegmentRequest struct {
func (u UpdateSegmentRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "segment"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateSegmentRequest object to a map representation for JSON marshaling.
func (u UpdateSegmentRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["segment"] = u.Segment.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (u *UpdateSegmentRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "segment")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "segment")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Segment = *temp.Segment
return nil
}
diff --git a/models/update_subscription.go b/models/update_subscription.go
index afe5695c..f3f2835b 100644
--- a/models/update_subscription.go
+++ b/models/update_subscription.go
@@ -35,14 +35,14 @@ type UpdateSubscription struct {
// (Optional) An array of component ids and custom prices to be added to the subscription.
Components []UpdateSubscriptionComponent `json:"components,omitempty"`
// Enable Communication Delay feature, making sure no communication (email or SMS) is sent to the Customer between 9PM and 8AM in time zone set by the `dunning_communication_delay_time_zone` attribute.
- DunningCommunicationDelayEnabled Optional[bool] `json:"dunning_communication_delay_enabled"`
+ DunningCommunicationDelayEnabled *bool `json:"dunning_communication_delay_enabled,omitempty"`
// Time zone for the Dunning Communication Delay feature.
DunningCommunicationDelayTimeZone Optional[string] `json:"dunning_communication_delay_time_zone"`
// Set to change the current product's price point.
ProductPricePointId *int `json:"product_price_point_id,omitempty"`
// Set to change the current product's price point.
ProductPricePointHandle *string `json:"product_price_point_handle,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateSubscription.
@@ -50,13 +50,17 @@ type UpdateSubscription struct {
func (u UpdateSubscription) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "credit_card_attributes", "product_handle", "product_id", "product_change_delayed", "next_product_id", "next_product_price_point_id", "snap_day", "next_billing_at", "payment_collection_method", "receives_invoice_emails", "net_terms", "stored_credential_transaction_id", "reference", "custom_price", "components", "dunning_communication_delay_enabled", "dunning_communication_delay_time_zone", "product_price_point_id", "product_price_point_handle"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateSubscription object to a map representation for JSON marshaling.
func (u UpdateSubscription) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.CreditCardAttributes != nil {
structMap["credit_card_attributes"] = u.CreditCardAttributes.toMap()
}
@@ -102,12 +106,8 @@ func (u UpdateSubscription) toMap() map[string]any {
if u.Components != nil {
structMap["components"] = u.Components
}
- if u.DunningCommunicationDelayEnabled.IsValueSet() {
- if u.DunningCommunicationDelayEnabled.Value() != nil {
- structMap["dunning_communication_delay_enabled"] = u.DunningCommunicationDelayEnabled.Value()
- } else {
- structMap["dunning_communication_delay_enabled"] = nil
- }
+ if u.DunningCommunicationDelayEnabled != nil {
+ structMap["dunning_communication_delay_enabled"] = u.DunningCommunicationDelayEnabled
}
if u.DunningCommunicationDelayTimeZone.IsValueSet() {
if u.DunningCommunicationDelayTimeZone.Value() != nil {
@@ -133,12 +133,12 @@ func (u *UpdateSubscription) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "credit_card_attributes", "product_handle", "product_id", "product_change_delayed", "next_product_id", "next_product_price_point_id", "snap_day", "next_billing_at", "payment_collection_method", "receives_invoice_emails", "net_terms", "stored_credential_transaction_id", "reference", "custom_price", "components", "dunning_communication_delay_enabled", "dunning_communication_delay_time_zone", "product_price_point_id", "product_price_point_handle")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "credit_card_attributes", "product_handle", "product_id", "product_change_delayed", "next_product_id", "next_product_price_point_id", "snap_day", "next_billing_at", "payment_collection_method", "receives_invoice_emails", "net_terms", "stored_credential_transaction_id", "reference", "custom_price", "components", "dunning_communication_delay_enabled", "dunning_communication_delay_time_zone", "product_price_point_id", "product_price_point_handle")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.CreditCardAttributes = temp.CreditCardAttributes
u.ProductHandle = temp.ProductHandle
u.ProductId = temp.ProductId
@@ -184,7 +184,7 @@ type tempUpdateSubscription struct {
Reference *string `json:"reference,omitempty"`
CustomPrice *SubscriptionCustomPrice `json:"custom_price,omitempty"`
Components []UpdateSubscriptionComponent `json:"components,omitempty"`
- DunningCommunicationDelayEnabled Optional[bool] `json:"dunning_communication_delay_enabled"`
+ DunningCommunicationDelayEnabled *bool `json:"dunning_communication_delay_enabled,omitempty"`
DunningCommunicationDelayTimeZone Optional[string] `json:"dunning_communication_delay_time_zone"`
ProductPricePointId *int `json:"product_price_point_id,omitempty"`
ProductPricePointHandle *string `json:"product_price_point_handle,omitempty"`
diff --git a/models/update_subscription_component.go b/models/update_subscription_component.go
index 77f1e190..0055d694 100644
--- a/models/update_subscription_component.go
+++ b/models/update_subscription_component.go
@@ -11,10 +11,10 @@ import (
// UpdateSubscriptionComponent represents a UpdateSubscriptionComponent struct.
type UpdateSubscriptionComponent struct {
- ComponentId *int `json:"component_id,omitempty"`
+ ComponentId *int `json:"component_id,omitempty"`
// Create or update custom pricing unique to the subscription. Used in place of `price_point_id`.
- CustomPrice *ComponentCustomPrice `json:"custom_price,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ CustomPrice *ComponentCustomPrice `json:"custom_price,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateSubscriptionComponent.
@@ -22,13 +22,17 @@ type UpdateSubscriptionComponent struct {
func (u UpdateSubscriptionComponent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "component_id", "custom_price"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateSubscriptionComponent object to a map representation for JSON marshaling.
func (u UpdateSubscriptionComponent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.ComponentId != nil {
structMap["component_id"] = u.ComponentId
}
@@ -46,12 +50,12 @@ func (u *UpdateSubscriptionComponent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "component_id", "custom_price")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "component_id", "custom_price")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.ComponentId = temp.ComponentId
u.CustomPrice = temp.CustomPrice
return nil
diff --git a/models/update_subscription_group.go b/models/update_subscription_group.go
index 14eceab8..467e44ad 100644
--- a/models/update_subscription_group.go
+++ b/models/update_subscription_group.go
@@ -11,8 +11,8 @@ import (
// UpdateSubscriptionGroup represents a UpdateSubscriptionGroup struct.
type UpdateSubscriptionGroup struct {
- MemberIds []int `json:"member_ids,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ MemberIds []int `json:"member_ids,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateSubscriptionGroup.
@@ -20,13 +20,17 @@ type UpdateSubscriptionGroup struct {
func (u UpdateSubscriptionGroup) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "member_ids"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateSubscriptionGroup object to a map representation for JSON marshaling.
func (u UpdateSubscriptionGroup) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.MemberIds != nil {
structMap["member_ids"] = u.MemberIds
}
@@ -41,12 +45,12 @@ func (u *UpdateSubscriptionGroup) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "member_ids")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "member_ids")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.MemberIds = temp.MemberIds
return nil
}
diff --git a/models/update_subscription_group_request.go b/models/update_subscription_group_request.go
index 82949160..67c1c320 100644
--- a/models/update_subscription_group_request.go
+++ b/models/update_subscription_group_request.go
@@ -14,7 +14,7 @@ import (
// UpdateSubscriptionGroupRequest represents a UpdateSubscriptionGroupRequest struct.
type UpdateSubscriptionGroupRequest struct {
SubscriptionGroup UpdateSubscriptionGroup `json:"subscription_group"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateSubscriptionGroupRequest.
@@ -22,13 +22,17 @@ type UpdateSubscriptionGroupRequest struct {
func (u UpdateSubscriptionGroupRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "subscription_group"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateSubscriptionGroupRequest object to a map representation for JSON marshaling.
func (u UpdateSubscriptionGroupRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["subscription_group"] = u.SubscriptionGroup.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (u *UpdateSubscriptionGroupRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription_group")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription_group")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.SubscriptionGroup = *temp.SubscriptionGroup
return nil
}
diff --git a/models/update_subscription_note.go b/models/update_subscription_note.go
index 46e86b6c..8bf82723 100644
--- a/models/update_subscription_note.go
+++ b/models/update_subscription_note.go
@@ -14,9 +14,9 @@ import (
// UpdateSubscriptionNote represents a UpdateSubscriptionNote struct.
// Updatable fields for Subscription Note
type UpdateSubscriptionNote struct {
- Body string `json:"body"`
- Sticky bool `json:"sticky"`
- AdditionalProperties map[string]any `json:"_"`
+ Body string `json:"body"`
+ Sticky bool `json:"sticky"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateSubscriptionNote.
@@ -24,13 +24,17 @@ type UpdateSubscriptionNote struct {
func (u UpdateSubscriptionNote) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "body", "sticky"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateSubscriptionNote object to a map representation for JSON marshaling.
func (u UpdateSubscriptionNote) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["body"] = u.Body
structMap["sticky"] = u.Sticky
return structMap
@@ -48,12 +52,12 @@ func (u *UpdateSubscriptionNote) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "body", "sticky")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "body", "sticky")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Body = *temp.Body
u.Sticky = *temp.Sticky
return nil
diff --git a/models/update_subscription_note_request.go b/models/update_subscription_note_request.go
index 460ec3ac..ac3ad86f 100644
--- a/models/update_subscription_note_request.go
+++ b/models/update_subscription_note_request.go
@@ -16,7 +16,7 @@ import (
type UpdateSubscriptionNoteRequest struct {
// Updatable fields for Subscription Note
Note UpdateSubscriptionNote `json:"note"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateSubscriptionNoteRequest.
@@ -24,13 +24,17 @@ type UpdateSubscriptionNoteRequest struct {
func (u UpdateSubscriptionNoteRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "note"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateSubscriptionNoteRequest object to a map representation for JSON marshaling.
func (u UpdateSubscriptionNoteRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["note"] = u.Note.toMap()
return structMap
}
@@ -47,12 +51,12 @@ func (u *UpdateSubscriptionNoteRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "note")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "note")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Note = *temp.Note
return nil
}
diff --git a/models/update_subscription_request.go b/models/update_subscription_request.go
index 397938c4..28ffd33d 100644
--- a/models/update_subscription_request.go
+++ b/models/update_subscription_request.go
@@ -13,8 +13,8 @@ import (
// UpdateSubscriptionRequest represents a UpdateSubscriptionRequest struct.
type UpdateSubscriptionRequest struct {
- Subscription UpdateSubscription `json:"subscription"`
- AdditionalProperties map[string]any `json:"_"`
+ Subscription UpdateSubscription `json:"subscription"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpdateSubscriptionRequest.
@@ -22,13 +22,17 @@ type UpdateSubscriptionRequest struct {
func (u UpdateSubscriptionRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "subscription"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpdateSubscriptionRequest object to a map representation for JSON marshaling.
func (u UpdateSubscriptionRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["subscription"] = u.Subscription.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (u *UpdateSubscriptionRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "subscription")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "subscription")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Subscription = *temp.Subscription
return nil
}
diff --git a/models/upsert_prepaid_configuration.go b/models/upsert_prepaid_configuration.go
index 59871606..3f3557c0 100644
--- a/models/upsert_prepaid_configuration.go
+++ b/models/upsert_prepaid_configuration.go
@@ -11,11 +11,11 @@ import (
// UpsertPrepaidConfiguration represents a UpsertPrepaidConfiguration struct.
type UpsertPrepaidConfiguration struct {
- InitialFundingAmountInCents *int64 `json:"initial_funding_amount_in_cents,omitempty"`
- ReplenishToAmountInCents *int64 `json:"replenish_to_amount_in_cents,omitempty"`
- AutoReplenish *bool `json:"auto_replenish,omitempty"`
- ReplenishThresholdAmountInCents *int64 `json:"replenish_threshold_amount_in_cents,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ InitialFundingAmountInCents *int64 `json:"initial_funding_amount_in_cents,omitempty"`
+ ReplenishToAmountInCents *int64 `json:"replenish_to_amount_in_cents,omitempty"`
+ AutoReplenish *bool `json:"auto_replenish,omitempty"`
+ ReplenishThresholdAmountInCents *int64 `json:"replenish_threshold_amount_in_cents,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpsertPrepaidConfiguration.
@@ -23,13 +23,17 @@ type UpsertPrepaidConfiguration struct {
func (u UpsertPrepaidConfiguration) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "initial_funding_amount_in_cents", "replenish_to_amount_in_cents", "auto_replenish", "replenish_threshold_amount_in_cents"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpsertPrepaidConfiguration object to a map representation for JSON marshaling.
func (u UpsertPrepaidConfiguration) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.InitialFundingAmountInCents != nil {
structMap["initial_funding_amount_in_cents"] = u.InitialFundingAmountInCents
}
@@ -53,12 +57,12 @@ func (u *UpsertPrepaidConfiguration) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "initial_funding_amount_in_cents", "replenish_to_amount_in_cents", "auto_replenish", "replenish_threshold_amount_in_cents")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "initial_funding_amount_in_cents", "replenish_to_amount_in_cents", "auto_replenish", "replenish_threshold_amount_in_cents")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.InitialFundingAmountInCents = temp.InitialFundingAmountInCents
u.ReplenishToAmountInCents = temp.ReplenishToAmountInCents
u.AutoReplenish = temp.AutoReplenish
diff --git a/models/upsert_prepaid_configuration_request.go b/models/upsert_prepaid_configuration_request.go
index 544bc9f7..90098b61 100644
--- a/models/upsert_prepaid_configuration_request.go
+++ b/models/upsert_prepaid_configuration_request.go
@@ -14,7 +14,7 @@ import (
// UpsertPrepaidConfigurationRequest represents a UpsertPrepaidConfigurationRequest struct.
type UpsertPrepaidConfigurationRequest struct {
PrepaidConfiguration UpsertPrepaidConfiguration `json:"prepaid_configuration"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UpsertPrepaidConfigurationRequest.
@@ -22,13 +22,17 @@ type UpsertPrepaidConfigurationRequest struct {
func (u UpsertPrepaidConfigurationRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "prepaid_configuration"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UpsertPrepaidConfigurationRequest object to a map representation for JSON marshaling.
func (u UpsertPrepaidConfigurationRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["prepaid_configuration"] = u.PrepaidConfiguration.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (u *UpsertPrepaidConfigurationRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "prepaid_configuration")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "prepaid_configuration")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.PrepaidConfiguration = *temp.PrepaidConfiguration
return nil
}
diff --git a/models/usage.go b/models/usage.go
index b3188f1d..5a469b53 100644
--- a/models/usage.go
+++ b/models/usage.go
@@ -13,16 +13,16 @@ import (
// Usage represents a Usage struct.
type Usage struct {
- Id *int64 `json:"id,omitempty"`
- Memo Optional[string] `json:"memo"`
- CreatedAt *time.Time `json:"created_at,omitempty"`
- PricePointId *int `json:"price_point_id,omitempty"`
- Quantity *UsageQuantity `json:"quantity,omitempty"`
- OverageQuantity *int `json:"overage_quantity,omitempty"`
- ComponentId *int `json:"component_id,omitempty"`
- ComponentHandle *string `json:"component_handle,omitempty"`
- SubscriptionId *int `json:"subscription_id,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Id *int64 `json:"id,omitempty"`
+ Memo Optional[string] `json:"memo"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
+ PricePointId *int `json:"price_point_id,omitempty"`
+ Quantity *UsageQuantity `json:"quantity,omitempty"`
+ OverageQuantity *int `json:"overage_quantity,omitempty"`
+ ComponentId *int `json:"component_id,omitempty"`
+ ComponentHandle *string `json:"component_handle,omitempty"`
+ SubscriptionId *int `json:"subscription_id,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Usage.
@@ -30,13 +30,17 @@ type Usage struct {
func (u Usage) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "id", "memo", "created_at", "price_point_id", "quantity", "overage_quantity", "component_id", "component_handle", "subscription_id"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the Usage object to a map representation for JSON marshaling.
func (u Usage) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
if u.Id != nil {
structMap["id"] = u.Id
}
@@ -79,12 +83,12 @@ func (u *Usage) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "memo", "created_at", "price_point_id", "quantity", "overage_quantity", "component_id", "component_handle", "subscription_id")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "memo", "created_at", "price_point_id", "quantity", "overage_quantity", "component_id", "component_handle", "subscription_id")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Id = temp.Id
u.Memo = temp.Memo
if temp.CreatedAt != nil {
diff --git a/models/usage_response.go b/models/usage_response.go
index 8cbf56dd..9b15bfbb 100644
--- a/models/usage_response.go
+++ b/models/usage_response.go
@@ -13,8 +13,8 @@ import (
// UsageResponse represents a UsageResponse struct.
type UsageResponse struct {
- Usage Usage `json:"usage"`
- AdditionalProperties map[string]any `json:"_"`
+ Usage Usage `json:"usage"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for UsageResponse.
@@ -22,13 +22,17 @@ type UsageResponse struct {
func (u UsageResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(u.AdditionalProperties,
+ "usage"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(u.toMap())
}
// toMap converts the UsageResponse object to a map representation for JSON marshaling.
func (u UsageResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, u.AdditionalProperties)
+ MergeAdditionalProperties(structMap, u.AdditionalProperties)
structMap["usage"] = u.Usage.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (u *UsageResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "usage")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "usage")
if err != nil {
return err
}
-
u.AdditionalProperties = additionalProperties
+
u.Usage = *temp.Usage
return nil
}
diff --git a/models/utilities.go b/models/utilities.go
index f2ecfca0..1c8cffaf 100644
--- a/models/utilities.go
+++ b/models/utilities.go
@@ -101,12 +101,6 @@ var ToTimeSlice = utilities.ToTimeSlice
// ToTimeMap is a utility.
var ToTimeMap = utilities.ToTimeMap
-// MapAdditionalProperties is a utility.
-var MapAdditionalProperties = utilities.MapAdditionalProperties
-
-// UnmarshalAdditionalProperties is a utility.
-var UnmarshalAdditionalProperties = utilities.UnmarshalAdditionalProperties
-
// NewTypeHolder is a utility.
var NewTypeHolder = utilities.NewTypeHolder
@@ -124,3 +118,32 @@ var UnmarshallAnyOf = utilities.UnmarshallAnyOf
// UnmarshallAnyOfWithDiscriminator is a utility.
var UnmarshallAnyOfWithDiscriminator = utilities.UnmarshallAnyOfWithDiscriminator
+
+// MergeAdditionalProperties is a utility function.
+func MergeAdditionalProperties[T any](
+ destinationMap map[string]any,
+ sourceMap map[string]T) {
+ utilities.MergeAdditionalProperties[T](destinationMap, sourceMap)
+}
+
+// ExtractAdditionalProperties is a utility function.
+func ExtractAdditionalProperties[T any](
+ input []byte,
+ keysToRemove ...string) (
+ map[string]T,
+ error) {
+ return utilities.ExtractAdditionalProperties[T](input, keysToRemove...)
+}
+
+// DetectConflictingProperties is a utility function.
+func DetectConflictingProperties[T any](
+ dstMap map[string]T,
+ structProperties ...string) error {
+ return utilities.DetectConflictingProperties[T](dstMap, structProperties...)
+}
+
+// ExtractTimeTypeAdditionalProperties is a utility.
+var ExtractTimeTypeAdditionalProperties = utilities.ExtractTimeTypeAdditionalProperties
+
+// MergeTimeTypeAdditionalProperties is a utility.
+var MergeTimeTypeAdditionalProperties = utilities.MergeTimeTypeAdditionalProperties
diff --git a/models/void_invoice.go b/models/void_invoice.go
index a076300d..14e5a3a6 100644
--- a/models/void_invoice.go
+++ b/models/void_invoice.go
@@ -13,8 +13,8 @@ import (
// VoidInvoice represents a VoidInvoice struct.
type VoidInvoice struct {
- Reason string `json:"reason"`
- AdditionalProperties map[string]any `json:"_"`
+ Reason string `json:"reason"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for VoidInvoice.
@@ -22,13 +22,17 @@ type VoidInvoice struct {
func (v VoidInvoice) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(v.AdditionalProperties,
+ "reason"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(v.toMap())
}
// toMap converts the VoidInvoice object to a map representation for JSON marshaling.
func (v VoidInvoice) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, v.AdditionalProperties)
+ MergeAdditionalProperties(structMap, v.AdditionalProperties)
structMap["reason"] = v.Reason
return structMap
}
@@ -45,12 +49,12 @@ func (v *VoidInvoice) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "reason")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "reason")
if err != nil {
return err
}
-
v.AdditionalProperties = additionalProperties
+
v.Reason = *temp.Reason
return nil
}
diff --git a/models/void_invoice_event.go b/models/void_invoice_event.go
index a72a8ad8..e1261e16 100644
--- a/models/void_invoice_event.go
+++ b/models/void_invoice_event.go
@@ -15,13 +15,13 @@ import (
// VoidInvoiceEvent represents a VoidInvoiceEvent struct.
type VoidInvoiceEvent struct {
- Id int64 `json:"id"`
- Timestamp time.Time `json:"timestamp"`
- Invoice Invoice `json:"invoice"`
- EventType InvoiceEventType `json:"event_type"`
+ Id int64 `json:"id"`
+ Timestamp time.Time `json:"timestamp"`
+ Invoice Invoice `json:"invoice"`
+ EventType InvoiceEventType `json:"event_type"`
// Example schema for an `void_invoice` event
- EventData VoidInvoiceEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ EventData VoidInvoiceEventData `json:"event_data"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for VoidInvoiceEvent.
@@ -29,13 +29,17 @@ type VoidInvoiceEvent struct {
func (v VoidInvoiceEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(v.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(v.toMap())
}
// toMap converts the VoidInvoiceEvent object to a map representation for JSON marshaling.
func (v VoidInvoiceEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, v.AdditionalProperties)
+ MergeAdditionalProperties(structMap, v.AdditionalProperties)
structMap["id"] = v.Id
structMap["timestamp"] = v.Timestamp.Format(time.RFC3339)
structMap["invoice"] = v.Invoice.toMap()
@@ -56,12 +60,12 @@ func (v *VoidInvoiceEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
v.AdditionalProperties = additionalProperties
+
v.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/void_invoice_event_data.go b/models/void_invoice_event_data.go
index 1e0dca47..69f825cc 100644
--- a/models/void_invoice_event_data.go
+++ b/models/void_invoice_event_data.go
@@ -16,18 +16,18 @@ import (
// VoidInvoiceEventData represents a VoidInvoiceEventData struct.
// Example schema for an `void_invoice` event
type VoidInvoiceEventData struct {
- CreditNoteAttributes *CreditNote `json:"credit_note_attributes"`
+ CreditNoteAttributes *CreditNote `json:"credit_note_attributes"`
// The memo provided during invoice voiding.
- Memo *string `json:"memo"`
+ Memo *string `json:"memo"`
// The amount of the void.
- AppliedAmount *string `json:"applied_amount"`
+ AppliedAmount *string `json:"applied_amount"`
// The time the refund was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z"
- TransactionTime *time.Time `json:"transaction_time"`
+ TransactionTime *time.Time `json:"transaction_time"`
// If true, the invoice is an advance invoice.
- IsAdvanceInvoice bool `json:"is_advance_invoice"`
+ IsAdvanceInvoice bool `json:"is_advance_invoice"`
// The reason for the void.
- Reason string `json:"reason"`
- AdditionalProperties map[string]any `json:"_"`
+ Reason string `json:"reason"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for VoidInvoiceEventData.
@@ -35,13 +35,17 @@ type VoidInvoiceEventData struct {
func (v VoidInvoiceEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(v.AdditionalProperties,
+ "credit_note_attributes", "memo", "applied_amount", "transaction_time", "is_advance_invoice", "reason"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(v.toMap())
}
// toMap converts the VoidInvoiceEventData object to a map representation for JSON marshaling.
func (v VoidInvoiceEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, v.AdditionalProperties)
+ MergeAdditionalProperties(structMap, v.AdditionalProperties)
if v.CreditNoteAttributes != nil {
structMap["credit_note_attributes"] = v.CreditNoteAttributes.toMap()
} else {
@@ -79,12 +83,12 @@ func (v *VoidInvoiceEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "credit_note_attributes", "memo", "applied_amount", "transaction_time", "is_advance_invoice", "reason")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "credit_note_attributes", "memo", "applied_amount", "transaction_time", "is_advance_invoice", "reason")
if err != nil {
return err
}
-
v.AdditionalProperties = additionalProperties
+
v.CreditNoteAttributes = temp.CreditNoteAttributes
v.Memo = temp.Memo
v.AppliedAmount = temp.AppliedAmount
diff --git a/models/void_invoice_request.go b/models/void_invoice_request.go
index 673147f5..3ac333f1 100644
--- a/models/void_invoice_request.go
+++ b/models/void_invoice_request.go
@@ -13,8 +13,8 @@ import (
// VoidInvoiceRequest represents a VoidInvoiceRequest struct.
type VoidInvoiceRequest struct {
- Void VoidInvoice `json:"void"`
- AdditionalProperties map[string]any `json:"_"`
+ Void VoidInvoice `json:"void"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for VoidInvoiceRequest.
@@ -22,13 +22,17 @@ type VoidInvoiceRequest struct {
func (v VoidInvoiceRequest) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(v.AdditionalProperties,
+ "void"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(v.toMap())
}
// toMap converts the VoidInvoiceRequest object to a map representation for JSON marshaling.
func (v VoidInvoiceRequest) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, v.AdditionalProperties)
+ MergeAdditionalProperties(structMap, v.AdditionalProperties)
structMap["void"] = v.Void.toMap()
return structMap
}
@@ -45,12 +49,12 @@ func (v *VoidInvoiceRequest) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "void")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "void")
if err != nil {
return err
}
-
v.AdditionalProperties = additionalProperties
+
v.Void = *temp.Void
return nil
}
diff --git a/models/void_remainder_event.go b/models/void_remainder_event.go
index 97f550a4..086c7cee 100644
--- a/models/void_remainder_event.go
+++ b/models/void_remainder_event.go
@@ -21,7 +21,7 @@ type VoidRemainderEvent struct {
EventType InvoiceEventType `json:"event_type"`
// Example schema for an `void_remainder` event
EventData VoidRemainderEventData `json:"event_data"`
- AdditionalProperties map[string]any `json:"_"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for VoidRemainderEvent.
@@ -29,13 +29,17 @@ type VoidRemainderEvent struct {
func (v VoidRemainderEvent) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(v.AdditionalProperties,
+ "id", "timestamp", "invoice", "event_type", "event_data"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(v.toMap())
}
// toMap converts the VoidRemainderEvent object to a map representation for JSON marshaling.
func (v VoidRemainderEvent) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, v.AdditionalProperties)
+ MergeAdditionalProperties(structMap, v.AdditionalProperties)
structMap["id"] = v.Id
structMap["timestamp"] = v.Timestamp.Format(time.RFC3339)
structMap["invoice"] = v.Invoice.toMap()
@@ -56,12 +60,12 @@ func (v *VoidRemainderEvent) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "id", "timestamp", "invoice", "event_type", "event_data")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "id", "timestamp", "invoice", "event_type", "event_data")
if err != nil {
return err
}
-
v.AdditionalProperties = additionalProperties
+
v.Id = *temp.Id
TimestampVal, err := time.Parse(time.RFC3339, *temp.Timestamp)
if err != nil {
diff --git a/models/void_remainder_event_data.go b/models/void_remainder_event_data.go
index 316c21e8..c3f9ef18 100644
--- a/models/void_remainder_event_data.go
+++ b/models/void_remainder_event_data.go
@@ -16,14 +16,14 @@ import (
// VoidRemainderEventData represents a VoidRemainderEventData struct.
// Example schema for an `void_remainder` event
type VoidRemainderEventData struct {
- CreditNoteAttributes CreditNote `json:"credit_note_attributes"`
+ CreditNoteAttributes CreditNote `json:"credit_note_attributes"`
// The memo provided during invoice remainder voiding.
- Memo string `json:"memo"`
+ Memo string `json:"memo"`
// The amount of the void.
- AppliedAmount string `json:"applied_amount"`
+ AppliedAmount string `json:"applied_amount"`
// The time the refund was applied, in ISO 8601 format, i.e. "2019-06-07T17:20:06Z"
- TransactionTime time.Time `json:"transaction_time"`
- AdditionalProperties map[string]any `json:"_"`
+ TransactionTime time.Time `json:"transaction_time"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for VoidRemainderEventData.
@@ -31,13 +31,17 @@ type VoidRemainderEventData struct {
func (v VoidRemainderEventData) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(v.AdditionalProperties,
+ "credit_note_attributes", "memo", "applied_amount", "transaction_time"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(v.toMap())
}
// toMap converts the VoidRemainderEventData object to a map representation for JSON marshaling.
func (v VoidRemainderEventData) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, v.AdditionalProperties)
+ MergeAdditionalProperties(structMap, v.AdditionalProperties)
structMap["credit_note_attributes"] = v.CreditNoteAttributes.toMap()
structMap["memo"] = v.Memo
structMap["applied_amount"] = v.AppliedAmount
@@ -57,12 +61,12 @@ func (v *VoidRemainderEventData) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "credit_note_attributes", "memo", "applied_amount", "transaction_time")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "credit_note_attributes", "memo", "applied_amount", "transaction_time")
if err != nil {
return err
}
-
v.AdditionalProperties = additionalProperties
+
v.CreditNoteAttributes = *temp.CreditNoteAttributes
v.Memo = *temp.Memo
v.AppliedAmount = *temp.AppliedAmount
diff --git a/models/webhook.go b/models/webhook.go
index 537d8095..9d5f0424 100644
--- a/models/webhook.go
+++ b/models/webhook.go
@@ -14,30 +14,30 @@ import (
// Webhook represents a Webhook struct.
type Webhook struct {
// A string describing which event type produced the given webhook
- Event *string `json:"event,omitempty"`
+ Event *string `json:"event,omitempty"`
// The unique identifier for the webhooks (unique across all of Chargify). This is not changed on a retry/replay of the same webhook, so it may be used to avoid duplicate action for the same event.
- Id *int64 `json:"id,omitempty"`
+ Id *int64 `json:"id,omitempty"`
// Timestamp indicating when the webhook was created
- CreatedAt *time.Time `json:"created_at,omitempty"`
+ CreatedAt *time.Time `json:"created_at,omitempty"`
// Text describing the status code and/or error from the last failed attempt to send the Webhook. When a webhook is retried and accepted, this field will be cleared.
- LastError *string `json:"last_error,omitempty"`
+ LastError *string `json:"last_error,omitempty"`
// Timestamp indicating when the last non-acceptance occurred. If a webhook is later resent and accepted, this field will be cleared.
- LastErrorAt *time.Time `json:"last_error_at,omitempty"`
+ LastErrorAt *time.Time `json:"last_error_at,omitempty"`
// Timestamp indicating when the webhook was accepted by the merchant endpoint. When a webhook is explicitly replayed by the merchant, this value will be cleared until it is accepted again.
- AcceptedAt Optional[time.Time] `json:"accepted_at"`
+ AcceptedAt Optional[time.Time] `json:"accepted_at"`
// Timestamp indicating when the most recent attempt was made to send the webhook
- LastSentAt *time.Time `json:"last_sent_at,omitempty"`
+ LastSentAt *time.Time `json:"last_sent_at,omitempty"`
// The url that the endpoint was last sent to.
- LastSentUrl *string `json:"last_sent_url,omitempty"`
+ LastSentUrl *string `json:"last_sent_url,omitempty"`
// A boolean flag describing whether the webhook was accepted by the webhook endpoint for the most recent attempt. (Acceptance is defined by receiving a “200 OK” HTTP response within a reasonable timeframe, i.e. 15 seconds)
- Successful *bool `json:"successful,omitempty"`
+ Successful *bool `json:"successful,omitempty"`
// The data sent within the webhook post
- Body *string `json:"body,omitempty"`
+ Body *string `json:"body,omitempty"`
// The calculated webhook signature
- Signature *string `json:"signature,omitempty"`
+ Signature *string `json:"signature,omitempty"`
// The calculated HMAC-SHA-256 webhook signature
- SignatureHmacSha256 *string `json:"signature_hmac_sha_256,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ SignatureHmacSha256 *string `json:"signature_hmac_sha_256,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for Webhook.
@@ -45,13 +45,17 @@ type Webhook struct {
func (w Webhook) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(w.AdditionalProperties,
+ "event", "id", "created_at", "last_error", "last_error_at", "accepted_at", "last_sent_at", "last_sent_url", "successful", "body", "signature", "signature_hmac_sha_256"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(w.toMap())
}
// toMap converts the Webhook object to a map representation for JSON marshaling.
func (w Webhook) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, w.AdditionalProperties)
+ MergeAdditionalProperties(structMap, w.AdditionalProperties)
if w.Event != nil {
structMap["event"] = w.Event
}
@@ -108,12 +112,12 @@ func (w *Webhook) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "event", "id", "created_at", "last_error", "last_error_at", "accepted_at", "last_sent_at", "last_sent_url", "successful", "body", "signature", "signature_hmac_sha_256")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "event", "id", "created_at", "last_error", "last_error_at", "accepted_at", "last_sent_at", "last_sent_url", "successful", "body", "signature", "signature_hmac_sha_256")
if err != nil {
return err
}
-
w.AdditionalProperties = additionalProperties
+
w.Event = temp.Event
w.Id = temp.Id
if temp.CreatedAt != nil {
diff --git a/models/webhook_response.go b/models/webhook_response.go
index 3cdaadea..ba8da9ac 100644
--- a/models/webhook_response.go
+++ b/models/webhook_response.go
@@ -11,8 +11,8 @@ import (
// WebhookResponse represents a WebhookResponse struct.
type WebhookResponse struct {
- Webhook *Webhook `json:"webhook,omitempty"`
- AdditionalProperties map[string]any `json:"_"`
+ Webhook *Webhook `json:"webhook,omitempty"`
+ AdditionalProperties map[string]interface{} `json:"_"`
}
// MarshalJSON implements the json.Marshaler interface for WebhookResponse.
@@ -20,13 +20,17 @@ type WebhookResponse struct {
func (w WebhookResponse) MarshalJSON() (
[]byte,
error) {
+ if err := DetectConflictingProperties(w.AdditionalProperties,
+ "webhook"); err != nil {
+ return []byte{}, err
+ }
return json.Marshal(w.toMap())
}
// toMap converts the WebhookResponse object to a map representation for JSON marshaling.
func (w WebhookResponse) toMap() map[string]any {
structMap := make(map[string]any)
- MapAdditionalProperties(structMap, w.AdditionalProperties)
+ MergeAdditionalProperties(structMap, w.AdditionalProperties)
if w.Webhook != nil {
structMap["webhook"] = w.Webhook.toMap()
}
@@ -41,12 +45,12 @@ func (w *WebhookResponse) UnmarshalJSON(input []byte) error {
if err != nil {
return err
}
- additionalProperties, err := UnmarshalAdditionalProperties(input, "webhook")
+ additionalProperties, err := ExtractAdditionalProperties[interface{}](input, "webhook")
if err != nil {
return err
}
-
w.AdditionalProperties = additionalProperties
+
w.Webhook = temp.Webhook
return nil
}
diff --git a/offers_controller.go b/offers_controller.go
index b9f95b4d..5049d43f 100644
--- a/offers_controller.go
+++ b/offers_controller.go
@@ -84,6 +84,9 @@ func (o *OffersController) ListOffers(
error) {
req := o.prepareRequest(ctx, "GET", "/offers.json")
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
+ })
if input.Page != nil {
req.QueryParam("page", *input.Page)
}
diff --git a/product_families_controller.go b/product_families_controller.go
index 36397833..e8111c95 100644
--- a/product_families_controller.go
+++ b/product_families_controller.go
@@ -12,6 +12,7 @@ import (
"github.com/apimatic/go-core-runtime/utilities"
"github.com/maxio-com/ab-golang-sdk/errors"
"github.com/maxio-com/ab-golang-sdk/models"
+ "time"
)
// ProductFamiliesController represents a controller struct.
@@ -42,13 +43,13 @@ type ListProductsForProductFamilyInput struct {
// Filter to use for List Products operations
Filter *models.ListProductsFilter
// The start date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified.
- StartDate *string
+ StartDate *time.Time
// The end date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified.
- EndDate *string
+ EndDate *time.Time
// The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date.
- StartDatetime *string
+ StartDatetime *time.Time
// The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date.
- EndDatetime *string
+ EndDatetime *time.Time
// Include archived products
IncludeArchived *bool
// Allows including additional data in the response. Use in query `include=prepaid_product_price_point`.
@@ -86,16 +87,16 @@ func (p *ProductFamiliesController) ListProductsForProductFamily(
req.QueryParam("filter", *input.Filter)
}
if input.StartDate != nil {
- req.QueryParam("start_date", *input.StartDate)
+ req.QueryParam("start_date", input.StartDate.Format(models.DEFAULT_DATE))
}
if input.EndDate != nil {
- req.QueryParam("end_date", *input.EndDate)
+ req.QueryParam("end_date", input.EndDate.Format(models.DEFAULT_DATE))
}
if input.StartDatetime != nil {
- req.QueryParam("start_datetime", *input.StartDatetime)
+ req.QueryParam("start_datetime", input.StartDatetime.Format(time.RFC3339))
}
if input.EndDatetime != nil {
- req.QueryParam("end_datetime", *input.EndDatetime)
+ req.QueryParam("end_datetime", input.EndDatetime.Format(time.RFC3339))
}
if input.IncludeArchived != nil {
req.QueryParam("include_archived", *input.IncludeArchived)
@@ -149,13 +150,13 @@ type ListProductFamiliesInput struct {
// Use in query: `date_field=created_at`.
DateField *models.BasicDateField
// The start date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified.
- StartDate *string
+ StartDate *time.Time
// The end date (format YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified.
- EndDate *string
+ EndDate *time.Time
// The start date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of start_date.
- StartDatetime *string
+ StartDatetime *time.Time
// The end date and time (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site's time zone will be used. If provided, this parameter will be used instead of end_date.
- EndDatetime *string
+ EndDatetime *time.Time
}
// ListProductFamilies takes context, dateField, startDate, endDate, startDatetime, endDatetime as parameters and
@@ -173,16 +174,16 @@ func (p *ProductFamiliesController) ListProductFamilies(
req.QueryParam("date_field", *input.DateField)
}
if input.StartDate != nil {
- req.QueryParam("start_date", *input.StartDate)
+ req.QueryParam("start_date", input.StartDate.Format(models.DEFAULT_DATE))
}
if input.EndDate != nil {
- req.QueryParam("end_date", *input.EndDate)
+ req.QueryParam("end_date", input.EndDate.Format(models.DEFAULT_DATE))
}
if input.StartDatetime != nil {
- req.QueryParam("start_datetime", *input.StartDatetime)
+ req.QueryParam("start_datetime", input.StartDatetime.Format(time.RFC3339))
}
if input.EndDatetime != nil {
- req.QueryParam("end_datetime", *input.EndDatetime)
+ req.QueryParam("end_datetime", input.EndDatetime.Format(time.RFC3339))
}
var result []models.ProductFamilyResponse
decoder, resp, err := req.CallAsJson()
diff --git a/product_price_points_controller.go b/product_price_points_controller.go
index 9bf61488..f15b8cc4 100644
--- a/product_price_points_controller.go
+++ b/product_price_points_controller.go
@@ -73,9 +73,11 @@ type ListProductPricePointsInput struct {
CurrencyPrices *bool
// Use in query: `filter[type]=catalog,default`.
FilterType []models.PricePointType
+ // Set to include archived price points in the response.
+ Archived *bool
}
-// ListProductPricePoints takes context, productId, page, perPage, currencyPrices, filterType as parameters and
+// ListProductPricePoints takes context, productId, page, perPage, currencyPrices, filterType, archived as parameters and
// returns an models.ApiResponse with models.ListProductPricePointsResponse data and
// an error if there was an issue with the request or response.
// Use this endpoint to retrieve a list of product price points.
@@ -102,6 +104,9 @@ func (p *ProductPricePointsController) ListProductPricePoints(
if input.FilterType != nil {
req.QueryParam("filter[type]", input.FilterType)
}
+ if input.Archived != nil {
+ req.QueryParam("archived", *input.Archived)
+ }
var result models.ListProductPricePointsResponse
decoder, resp, err := req.CallAsJson()
diff --git a/reason_codes_controller.go b/reason_codes_controller.go
index 6cbbc4cd..98e9bffc 100644
--- a/reason_codes_controller.go
+++ b/reason_codes_controller.go
@@ -82,6 +82,9 @@ func (r *ReasonCodesController) ListReasonCodes(
error) {
req := r.prepareRequest(ctx, "GET", "/reason_codes.json")
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
+ })
if input.Page != nil {
req.QueryParam("page", *input.Page)
}
@@ -145,6 +148,7 @@ func (r *ReasonCodesController) UpdateReasonCode(
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
})
req.Header("Content-Type", "application/json")
if body != nil {
@@ -162,13 +166,13 @@ func (r *ReasonCodesController) UpdateReasonCode(
}
// DeleteReasonCode takes context, reasonCodeId as parameters and
-// returns an models.ApiResponse with models.ReasonCodesJsonResponse data and
+// returns an models.ApiResponse with models.OkResponse data and
// an error if there was an issue with the request or response.
// This method gives a merchant the option to delete one reason code from the Churn Reason Codes. This code will be immediately removed. This action is not reversable.
func (r *ReasonCodesController) DeleteReasonCode(
ctx context.Context,
reasonCodeId int) (
- models.ApiResponse[models.ReasonCodesJsonResponse],
+ models.ApiResponse[models.OkResponse],
error) {
req := r.prepareRequest(
ctx,
@@ -180,12 +184,12 @@ func (r *ReasonCodesController) DeleteReasonCode(
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
})
- var result models.ReasonCodesJsonResponse
+ var result models.OkResponse
decoder, resp, err := req.CallAsJson()
if err != nil {
return models.NewApiResponse(result, resp), err
}
- result, err = utilities.DecodeResults[models.ReasonCodesJsonResponse](decoder)
+ result, err = utilities.DecodeResults[models.OkResponse](decoder)
return models.NewApiResponse(result, resp), err
}
diff --git a/subscription_components_controller.go b/subscription_components_controller.go
index 915cb886..5cbbb56e 100644
--- a/subscription_components_controller.go
+++ b/subscription_components_controller.go
@@ -686,7 +686,7 @@ func (s *SubscriptionComponentsController) DeactivateEventBasedComponent(
return httpCtx.Response, err
}
-// RecordEvent takes context, subdomain, apiHandle, storeUid, body as parameters and
+// RecordEvent takes context, apiHandle, storeUid, body as parameters and
// returns an *Response and
// an error if there was an issue with the request or response.
// ## Documentation
@@ -702,17 +702,13 @@ func (s *SubscriptionComponentsController) DeactivateEventBasedComponent(
// ```
func (s *SubscriptionComponentsController) RecordEvent(
ctx context.Context,
- subdomain string,
apiHandle string,
storeUid *string,
body *models.EBBEvent) (
*http.Response,
error) {
- req := s.prepareRequest(
- ctx,
- "POST",
- fmt.Sprintf("/%v/events/%v.json", subdomain, apiHandle),
- )
+ req := s.prepareRequest(ctx, "POST", fmt.Sprintf("/events/%v.json", apiHandle))
+ req.BaseUrl("ebb")
req.Authenticate(NewAuth("BasicAuth"))
req.Header("Content-Type", "application/json")
if storeUid != nil {
@@ -729,7 +725,7 @@ func (s *SubscriptionComponentsController) RecordEvent(
return httpCtx.Response, err
}
-// BulkRecordEvents takes context, subdomain, apiHandle, storeUid, body as parameters and
+// BulkRecordEvents takes context, apiHandle, storeUid, body as parameters and
// returns an *Response and
// an error if there was an issue with the request or response.
// Use this endpoint to record a collection of events.
@@ -737,7 +733,6 @@ func (s *SubscriptionComponentsController) RecordEvent(
// A maximum of 1000 events can be published in a single request. A 422 will be returned if this limit is exceeded.
func (s *SubscriptionComponentsController) BulkRecordEvents(
ctx context.Context,
- subdomain string,
apiHandle string,
storeUid *string,
body []models.EBBEvent) (
@@ -746,8 +741,9 @@ func (s *SubscriptionComponentsController) BulkRecordEvents(
req := s.prepareRequest(
ctx,
"POST",
- fmt.Sprintf("/%v/events/%v/bulk.json", subdomain, apiHandle),
+ fmt.Sprintf("/events/%v/bulk.json", apiHandle),
)
+ req.BaseUrl("ebb")
req.Authenticate(NewAuth("BasicAuth"))
req.Header("Content-Type", "application/json")
if storeUid != nil {
diff --git a/subscription_notes_controller.go b/subscription_notes_controller.go
index 39bf9344..0cb27e1f 100644
--- a/subscription_notes_controller.go
+++ b/subscription_notes_controller.go
@@ -8,7 +8,9 @@ package advancedbilling
import (
"context"
"fmt"
+ "github.com/apimatic/go-core-runtime/https"
"github.com/apimatic/go-core-runtime/utilities"
+ "github.com/maxio-com/ab-golang-sdk/errors"
"github.com/maxio-com/ab-golang-sdk/models"
"net/http"
)
@@ -45,6 +47,9 @@ func (s *SubscriptionNotesController) CreateSubscriptionNote(
fmt.Sprintf("/subscriptions/%v/notes.json", subscriptionId),
)
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
+ })
req.Header("Content-Type", "application/json")
if body != nil {
req.Json(body)
@@ -87,6 +92,9 @@ func (s *SubscriptionNotesController) ListSubscriptionNotes(
fmt.Sprintf("/subscriptions/%v/notes.json", input.SubscriptionId),
)
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
+ })
if input.Page != nil {
req.QueryParam("page", *input.Page)
}
@@ -148,6 +156,9 @@ func (s *SubscriptionNotesController) UpdateSubscriptionNote(
fmt.Sprintf("/subscriptions/%v/notes/%v.json", subscriptionId, noteId),
)
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
+ })
req.Header("Content-Type", "application/json")
if body != nil {
req.Json(body)
diff --git a/subscription_status_controller.go b/subscription_status_controller.go
index 049f1160..95ddd0d1 100644
--- a/subscription_status_controller.go
+++ b/subscription_status_controller.go
@@ -351,6 +351,7 @@ func (s *SubscriptionStatusController) InitiateDelayedCancellation(
req.Authenticate(NewAuth("BasicAuth"))
req.AppendErrors(map[string]https.ErrorBuilder[error]{
"404": {TemplatedMessage: "Not Found:'{$response.body}'"},
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
})
req.Header("Content-Type", "application/json")
if body != nil {
@@ -412,6 +413,9 @@ func (s *SubscriptionStatusController) CancelDunning(
fmt.Sprintf("/subscriptions/%v/cancel_dunning.json", subscriptionId),
)
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewErrorListResponse},
+ })
var result models.SubscriptionResponse
decoder, resp, err := req.CallAsJson()
diff --git a/subscriptions_controller.go b/subscriptions_controller.go
index d2492e64..c40f4818 100644
--- a/subscriptions_controller.go
+++ b/subscriptions_controller.go
@@ -42,6 +42,10 @@ func NewSubscriptionsController(baseController baseController) *SubscriptionsCon
// An existing customer may be specified by a `customer_id` (ID within Advanced Billing) or a `customer_reference` (unique value within your app that you have shared with Advanced Billing via the reference attribute on a customer). You may also pass in an existing payment profile for that customer with `payment_profile_id`. A new customer may be created by providing `customer_attributes`.
// Credit card details may be required, depending on the options for the product being subscribed. The product can be specified by `product_id` or by `product_handle` (API Handle).
// If you are creating a subscription with a payment profile, the attribute to send will be `credit_card_attributes` or `bank_account_attributes` for ACH and Direct Debit. That said, when you read the subscription after creation, we return the profile details under `credit_card` or `bank_account`.
+// ## Bulk creation of subscriptions
+// Bulk creation of subscriptions is currently not supported. For scenarios where multiple subscriptions must be added, particularly when assigning to the same subscription group, it is essential to switch to a single-threaded approach.
+// To avoid data conflicts or inaccuracies, incorporate a sleep interval between requests.
+// While this single-threaded approach may impact performance, it ensures data consistency and accuracy in cases where concurrent creation attempts could otherwise lead to issues with subscription alignment and integrity.
// ## Taxable Subscriptions
// If your intent is to charge your subscribers tax via [Avalara Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287043035661-Avalara-VAT-Tax) or [Custom Taxes](https://maxio.zendesk.com/hc/en-us/articles/24287044212749-Custom-Taxes), there are a few considerations to be made regarding collecting subscription data.
// For subscribers to be eligible to be taxed, the following information for the `customer` object or `payment_profile` object must by supplied:
@@ -788,6 +792,9 @@ func (s *SubscriptionsController) FindSubscription(
error) {
req := s.prepareRequest(ctx, "GET", "/subscriptions/lookup.json")
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "404": {TemplatedMessage: "Not Found:'{$response.body}'"},
+ })
if reference != nil {
req.QueryParam("reference", *reference)
}
@@ -802,7 +809,7 @@ func (s *SubscriptionsController) FindSubscription(
}
// PurgeSubscription takes context, subscriptionId, ack, cascade as parameters and
-// returns an *Response and
+// returns an models.ApiResponse with models.SubscriptionResponse data and
// an error if there was an issue with the request or response.
// For sites in test mode, you may purge individual subscriptions.
// Provide the subscription ID in the url. To confirm, supply the customer ID in the query string `ack` parameter. You may also delete the customer record and/or payment profiles by passing `cascade` parameters. For example, to delete just the customer record, the query params would be: `?ack={customer_id}&cascade[]=customer`
@@ -814,7 +821,7 @@ func (s *SubscriptionsController) PurgeSubscription(
subscriptionId int,
ack int,
cascade []models.SubscriptionPurgeType) (
- *http.Response,
+ models.ApiResponse[models.SubscriptionResponse],
error) {
req := s.prepareRequest(
ctx,
@@ -822,16 +829,22 @@ func (s *SubscriptionsController) PurgeSubscription(
fmt.Sprintf("/subscriptions/%v/purge.json", subscriptionId),
)
req.Authenticate(NewAuth("BasicAuth"))
- req.QueryParam("ack", ack)
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "400": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'.", Unmarshaller: errors.NewSubscriptionResponseError},
+ })
+ req.QueryParamWithArraySerializationOption("ack", ack, https.UnIndexed)
if cascade != nil {
- req.QueryParam("cascade", cascade)
+ req.QueryParamWithArraySerializationOption("cascade", cascade, https.UnIndexed)
}
- httpCtx, err := req.Call()
+ var result models.SubscriptionResponse
+ decoder, resp, err := req.CallAsJson()
if err != nil {
- return httpCtx.Response, err
+ return models.NewApiResponse(result, resp), err
}
- return httpCtx.Response, err
+
+ result, err = utilities.DecodeResults[models.SubscriptionResponse](decoder)
+ return models.NewApiResponse(result, resp), err
}
// UpdatePrepaidSubscriptionConfiguration takes context, subscriptionId, body as parameters and
@@ -850,6 +863,9 @@ func (s *SubscriptionsController) UpdatePrepaidSubscriptionConfiguration(
fmt.Sprintf("/subscriptions/%v/prepaid_configurations.json", subscriptionId),
)
req.Authenticate(NewAuth("BasicAuth"))
+ req.AppendErrors(map[string]https.ErrorBuilder[error]{
+ "422": {TemplatedMessage: "HTTP Response Not OK. Status code: {$statusCode}. Response: '{$response.body}'."},
+ })
req.Header("Content-Type", "application/json")
if body != nil {
req.Json(body)
diff --git a/test/component_allocations_test.go b/test/component_allocations_test.go
index 91023e43..10f5f016 100644
--- a/test/component_allocations_test.go
+++ b/test/component_allocations_test.go
@@ -44,13 +44,7 @@ func (s *ComponentAlocationSuite) TestComponentAllocations() {
},
},
},
- UnitPrice: models.ToPointer(models.OnOffComponentUnitPriceContainer.FromString("100")),
- Prices: []models.Price{
- {
- StartingQuantity: models.PriceStartingQuantityContainer.FromNumber(1),
- UnitPrice: models.PriceUnitPriceContainer.FromPrecision(1),
- },
- },
+ UnitPrice: models.OnOffComponentUnitPriceContainer.FromString("100"),
},
},
)
diff --git a/test/go.mod b/test/go.mod
index 059603b1..d186ff69 100644
--- a/test/go.mod
+++ b/test/go.mod
@@ -12,7 +12,7 @@ require (
)
require (
- github.com/apimatic/go-core-runtime v0.0.25
+ github.com/apimatic/go-core-runtime v0.0.27
github.com/caarlos0/env/v10 v10.0.0
github.com/jaswdr/faker v1.19.1
github.com/maxio-com/ab-golang-sdk v0.0.1
diff --git a/test/go.sum b/test/go.sum
index d499e928..da1eb20a 100644
--- a/test/go.sum
+++ b/test/go.sum
@@ -1,5 +1,5 @@
-github.com/apimatic/go-core-runtime v0.0.25 h1:bEndGNqpBMZc9QSlUTcjw+RTrLEATi702N2raqPC44g=
-github.com/apimatic/go-core-runtime v0.0.25/go.mod h1:eYSG9icLyMjbPWq212ELOQ4PZdlT2RihZGXEaAZdx6Q=
+github.com/apimatic/go-core-runtime v0.0.27 h1:xRLbPQD94GhGfC3k1ro8HyMcooBFKPYT4yVzQCbKi34=
+github.com/apimatic/go-core-runtime v0.0.27/go.mod h1:eYSG9icLyMjbPWq212ELOQ4PZdlT2RihZGXEaAZdx6Q=
github.com/caarlos0/env/v10 v10.0.0 h1:yIHUBZGsyqCnpTkbjk8asUlx6RFhhEs+h7TOBdgdzXA=
github.com/caarlos0/env/v10 v10.0.0/go.mod h1:ZfulV76NvVPw3tm591U4SwL3Xx9ldzBP9aGxzeN7G18=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
diff --git a/test/site_test.go b/test/site_test.go
index 80517352..df002d07 100644
--- a/test/site_test.go
+++ b/test/site_test.go
@@ -81,7 +81,7 @@ func (s *SiteSuite) TestReadSite() {
name: "unauthorized",
client: s.unauthorizedClient,
assert: func(t *testing.T, resp models.ApiResponse[models.SiteResponse], err error) {
- s.Equal(err.Error(), "ApiError occured: HTTP Response Not OK. Status code: 401. Response: 'HTTP Basic: Access denied.\n'.")
+ s.Equal(err.Error(), "ApiError occurred: HTTP Response Not OK. Status code: 401. Response: 'HTTP Basic: Access denied.\n'.")
actualErr, ok := err.(https.ApiError)
s.Equal(http.StatusUnauthorized, actualErr.StatusCode)
s.True(ok)
diff --git a/test/subscription_test.go b/test/subscription_test.go
index bdf97764..7223cd55 100644
--- a/test/subscription_test.go
+++ b/test/subscription_test.go
@@ -99,38 +99,38 @@ func (s *SubscriptionSuite) TestSubscriptionCreate() {
ctx,
advancedbilling.ListSubscriptionComponentsForSiteInput{
SubscriptionIds: []int{*createdSubscription.Id},
- Include: models.ToPointer(models.ListSubscriptionComponentsInclude_SUBSCRIPTION),
+ Include: models.ToPointer(models.ListSubscriptionComponentsInclude_SUBSCRIPTION),
Filter: models.ToPointer(models.ListSubscriptionComponentsForSiteFilter{
- Subscription: models.ToPointer(models.SubscriptionFilter{
- DateField: models.ToPointer(models.SubscriptionListDateField_UPDATEDAT),
- StartDate: timePtr(time.Now().AddDate(-1, 0, 0)),
- }),
+ Subscription: models.ToPointer(models.SubscriptionFilter{
+ DateField: models.ToPointer(models.SubscriptionListDateField_UPDATEDAT),
+ StartDate: timePtr(time.Now().AddDate(-1, 0, 0)),
+ }),
}),
},
)
s.NoError(err)
- s.Equal(http.StatusOK, listComponentsFilteredResp1.Response.StatusCode)
- s.Len(listComponentsFilteredResp1.Data.SubscriptionsComponents, 1)
- s.Equal(component.Id, listComponentsFilteredResp1.Data.SubscriptionsComponents[0].ComponentId)
+ s.Equal(http.StatusOK, listComponentsFilteredResp1.Response.StatusCode)
+ s.Len(listComponentsFilteredResp1.Data.SubscriptionsComponents, 1)
+ s.Equal(component.Id, listComponentsFilteredResp1.Data.SubscriptionsComponents[0].ComponentId)
- listComponentsFilteredResp2, err := s.client.SubscriptionComponentsController().ListSubscriptionComponentsForSite(
+ listComponentsFilteredResp2, err := s.client.SubscriptionComponentsController().ListSubscriptionComponentsForSite(
ctx,
advancedbilling.ListSubscriptionComponentsForSiteInput{
SubscriptionIds: []int{*createdSubscription.Id},
- Include: models.ToPointer(models.ListSubscriptionComponentsInclude_SUBSCRIPTION),
+ Include: models.ToPointer(models.ListSubscriptionComponentsInclude_SUBSCRIPTION),
Filter: models.ToPointer(models.ListSubscriptionComponentsForSiteFilter{
- Subscription: models.ToPointer(models.SubscriptionFilter{
- DateField: models.ToPointer(models.SubscriptionListDateField_UPDATEDAT),
- EndDate: timePtr(time.Now().AddDate(-1, 0, 0)),
- }),
+ Subscription: models.ToPointer(models.SubscriptionFilter{
+ DateField: models.ToPointer(models.SubscriptionListDateField_UPDATEDAT),
+ EndDate: timePtr(time.Now().AddDate(-1, 0, 0)),
+ }),
}),
},
)
s.NoError(err)
- s.Equal(http.StatusOK, listComponentsFilteredResp2.Response.StatusCode)
- s.Len(listComponentsFilteredResp2.Data.SubscriptionsComponents, 0)
+ s.Equal(http.StatusOK, listComponentsFilteredResp2.Response.StatusCode)
+ s.Len(listComponentsFilteredResp2.Data.SubscriptionsComponents, 0)
},
},
{
@@ -168,7 +168,7 @@ func (s *SubscriptionSuite) TestSubscriptionCreate() {
},
),
assert: func(t *testing.T, ar models.ApiResponse[models.SubscriptionResponse], cs models.CreateSubscription, err error) {
- s.Equal("ApiError occured: HTTP Response Not OK. Status code: 401. Response: 'HTTP Basic: Access denied.\n'.",
+ s.Equal("ApiError occurred: HTTP Response Not OK. Status code: 401. Response: 'HTTP Basic: Access denied.\n'.",
err.Error())
actualErr, ok := err.(https.ApiError)
diff --git a/test/suite.go b/test/suite.go
index e42825b1..3550501c 100644
--- a/test/suite.go
+++ b/test/suite.go
@@ -17,7 +17,6 @@ import (
type Config struct {
APIKey string `env:"TEST_API_KEY,required"`
Password string `env:"TEST_API_PASSWORD,required"`
- Domain string `env:"TEST_DOMAIN,required"`
Subdomain string `env:"TEST_SUBDOMAIN,required"`
}
@@ -63,8 +62,7 @@ func (s *APISuite) SetupTest() {
cfg.Password,
),
),
- advancedbilling.WithDomain(cfg.Domain),
- advancedbilling.WithSubdomain(cfg.Subdomain),
+ advancedbilling.WithSite(cfg.Subdomain),
)
configUnauthorized := advancedbilling.CreateConfiguration(
@@ -74,8 +72,7 @@ func (s *APISuite) SetupTest() {
"abc",
),
),
- advancedbilling.WithDomain(cfg.Domain),
- advancedbilling.WithSubdomain(cfg.Subdomain),
+ advancedbilling.WithSite(cfg.Subdomain),
)
s.client = advancedbilling.NewClient(config)
@@ -153,11 +150,11 @@ func (s *APISuite) generateProduct(ctx context.Context, productFamilyID int) mod
}
func (s *APISuite) generateCoupon(ctx context.Context, productFamilyID int) models.Coupon {
- coupon := &models.CreateOrUpdatePercentageCoupon{
- Name: s.fkr.RandomStringWithLength(20),
- Code: "100OFF" + s.fkr.RandomStringWithLength(30),
+ coupon := &models.CouponPayload{
+ Name: models.ToPointer(s.fkr.RandomStringWithLength(20)),
+ Code: models.ToPointer("100OFF" + s.fkr.RandomStringWithLength(30)),
Description: strPtr(s.fkr.RandomStringWithLength(20)),
- Percentage: models.CreateOrUpdatePercentageCouponPercentageContainer.FromString("50"),
+ Percentage: models.ToPointer(models.CouponPayloadPercentageContainer.FromString("50")),
AllowNegativeBalance: boolPtr(false),
Recurring: boolPtr(false),
EndDate: timePtr(time.Now().AddDate(1, 0, 0)),
@@ -167,8 +164,8 @@ func (s *APISuite) generateCoupon(ctx context.Context, productFamilyID int) mode
ApplyOnCancelAtEndOfPeriod: boolPtr(true),
}
- resp, err := s.client.CouponsController().CreateCoupon(ctx, productFamilyID, &models.CreateOrUpdateCoupon{
- Coupon: models.ToPointer(models.CreateOrUpdateCouponCouponContainer.FromCreateOrUpdatePercentageCoupon(*coupon)),
+ resp, err := s.client.CouponsController().CreateCoupon(ctx, productFamilyID, &models.CouponRequest{
+ Coupon: models.ToPointer(*coupon),
})
s.NoError(err)