@paddle/paddle-node-sdk 2.8.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/entities/address/address.js +14 -0
- package/dist/cjs/entities/adjustment/adjustment-credit-note-pdf.js +1 -0
- package/dist/cjs/entities/adjustment/adjustment-item-totals.js +3 -0
- package/dist/cjs/entities/adjustment/adjustment-item.js +6 -0
- package/dist/cjs/entities/adjustment/adjustment-proration.js +2 -0
- package/dist/cjs/entities/adjustment/adjustment-time-period.js +2 -0
- package/dist/cjs/entities/adjustment/adjustment.js +15 -0
- package/dist/cjs/entities/business/business.js +11 -0
- package/dist/cjs/entities/business/contacts.js +2 -0
- package/dist/cjs/entities/customer/auth-token.js +2 -0
- package/dist/cjs/entities/customer/credit-balance.js +3 -0
- package/dist/cjs/entities/customer/customer-balance.js +3 -0
- package/dist/cjs/entities/customer/customer.js +10 -0
- package/dist/cjs/entities/customer-portal-session/customer-portal-session.js +4 -0
- package/dist/cjs/entities/customer-portal-session/customer-portal-subscription-url.js +3 -0
- package/dist/cjs/entities/customer-portal-session/general.js +1 -0
- package/dist/cjs/entities/customer-portal-session/urls.js +3 -2
- package/dist/cjs/entities/discount/discount.js +20 -2
- package/dist/cjs/entities/discount-group/discount-group.js +6 -0
- package/dist/cjs/entities/event-types/event-type.js +4 -0
- package/dist/cjs/entities/events/event.js +6 -2
- package/dist/cjs/entities/notification-settings/notification-settings.js +10 -0
- package/dist/cjs/entities/notifications/notification-log.js +6 -2
- package/dist/cjs/entities/notifications/notification.js +16 -5
- package/dist/cjs/entities/notifications/replay-notification.js +1 -0
- package/dist/cjs/entities/payment-method/payment-method.js +10 -0
- package/dist/cjs/entities/payout/payout.js +4 -0
- package/dist/cjs/entities/price/price-quantity.js +2 -0
- package/dist/cjs/entities/price/price.js +18 -2
- package/dist/cjs/entities/pricing-preview/pricing-preview-details.js +1 -0
- package/dist/cjs/entities/pricing-preview/pricing-preview-discounts.js +3 -0
- package/dist/cjs/entities/pricing-preview/pricing-preview-line-item.js +9 -0
- package/dist/cjs/entities/pricing-preview/pricing-preview.js +15 -7
- package/dist/cjs/entities/product/product.js +13 -2
- package/dist/cjs/entities/report/report-csv.js +1 -0
- package/dist/cjs/entities/report/report-filters.js +4 -2
- package/dist/cjs/entities/report/report.js +10 -4
- package/dist/cjs/entities/shared/adjustment-original-amount.js +2 -0
- package/dist/cjs/entities/shared/billing-details.js +5 -2
- package/dist/cjs/entities/shared/chargeback-fee.js +2 -0
- package/dist/cjs/entities/shared/import-meta.js +2 -0
- package/dist/cjs/entities/shared/korean-market-underlying-details.js +1 -0
- package/dist/cjs/entities/shared/money.js +2 -0
- package/dist/cjs/entities/shared/payment-card.js +5 -0
- package/dist/cjs/entities/shared/payment-method-details.js +3 -0
- package/dist/cjs/entities/shared/payment-method-underlying-details.js +1 -0
- package/dist/cjs/entities/shared/payout-totals-adjustment.js +7 -0
- package/dist/cjs/entities/shared/paypal.js +2 -0
- package/dist/cjs/entities/shared/simulation-event-request.js +1 -0
- package/dist/cjs/entities/shared/simulation-event-response.js +2 -0
- package/dist/cjs/entities/shared/tax-rates-used.js +2 -0
- package/dist/cjs/entities/shared/time-period.js +2 -0
- package/dist/cjs/entities/shared/total-adjustments.js +6 -0
- package/dist/cjs/entities/shared/totals.js +4 -0
- package/dist/cjs/entities/shared/transaction-checkout.js +1 -0
- package/dist/cjs/entities/shared/transaction-payment-attempt.js +10 -2
- package/dist/cjs/entities/shared/transaction-payout-totals-adjusted.js +7 -0
- package/dist/cjs/entities/shared/transaction-payout-totals.js +11 -0
- package/dist/cjs/entities/shared/transaction-totals-adjusted.js +7 -0
- package/dist/cjs/entities/shared/transaction-totals.js +11 -0
- package/dist/cjs/entities/shared/unit-price-override.js +2 -0
- package/dist/cjs/entities/shared/unit-totals.js +4 -0
- package/dist/cjs/entities/simulation/simulation-scenario-config/simulation-scenario-config.js +5 -0
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-cancellation-details.js +2 -0
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-cancellation-entities.js +2 -2
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-cancellation-options.js +4 -3
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-creation-details.js +2 -0
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-creation-entities.js +14 -8
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-creation-item.js +2 -0
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-creation-options.js +6 -4
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-pause-details.js +2 -0
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-pause-entities.js +2 -2
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-pause-options.js +4 -3
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-renewal-details.js +2 -0
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-renewal-entities.js +2 -2
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-renewal-options.js +4 -3
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-resume-details.js +2 -0
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-resume-entities.js +2 -2
- package/dist/cjs/entities/simulation/simulation-scenario-config/subscription-resume-options.js +4 -3
- package/dist/cjs/entities/simulation/simulation.js +12 -3
- package/dist/cjs/entities/simulation-run/simulation-run.js +7 -2
- package/dist/cjs/entities/simulation-run-event/simulation-run-event.js +8 -0
- package/dist/cjs/entities/simulation-types/simulation-type.js +6 -0
- package/dist/cjs/entities/subscription/next-transaction-adjustment-item.js +5 -0
- package/dist/cjs/entities/subscription/next-transaction-adjustment-preview.js +3 -0
- package/dist/cjs/entities/subscription/next-transaction.js +3 -0
- package/dist/cjs/entities/subscription/subscription-discount.js +5 -3
- package/dist/cjs/entities/subscription/subscription-item.js +10 -0
- package/dist/cjs/entities/subscription/subscription-management.js +2 -0
- package/dist/cjs/entities/subscription/subscription-preview-summary-result.js +3 -0
- package/dist/cjs/entities/subscription/subscription-preview-update-summary.js +3 -0
- package/dist/cjs/entities/subscription/subscription-preview.js +26 -0
- package/dist/cjs/entities/subscription/subscription-scheduled-change.js +3 -0
- package/dist/cjs/entities/subscription/subscription-time-period.js +2 -0
- package/dist/cjs/entities/subscription/subscription.js +25 -0
- package/dist/cjs/entities/subscription/transaction-details-preview.js +3 -0
- package/dist/cjs/entities/subscription/transaction-line-item-preview.js +7 -0
- package/dist/cjs/entities/transaction/address-preview.js +2 -0
- package/dist/cjs/entities/transaction/adjustment-totals-breakdown.js +3 -0
- package/dist/cjs/entities/transaction/adjustment-totals.js +7 -0
- package/dist/cjs/entities/transaction/proration.js +2 -0
- package/dist/cjs/entities/transaction/transaction-adjustment-item.js +6 -0
- package/dist/cjs/entities/transaction/transaction-adjustment.js +14 -0
- package/dist/cjs/entities/transaction/transaction-details.js +6 -0
- package/dist/cjs/entities/transaction/transaction-invoice-pdf.js +1 -0
- package/dist/cjs/entities/transaction/transaction-item-preview.js +5 -2
- package/dist/cjs/entities/transaction/transaction-item.js +3 -0
- package/dist/cjs/entities/transaction/transaction-line-item.js +8 -0
- package/dist/cjs/entities/transaction/transaction-preview.js +12 -2
- package/dist/cjs/entities/transaction/transaction-proration.js +2 -0
- package/dist/cjs/entities/transaction/transaction.js +31 -2
- package/dist/cjs/entities/transaction/transactions-time-period.js +2 -0
- package/dist/cjs/internal/api/case-helpers.js +2 -13
- package/dist/cjs/internal/api/client.js +54 -64
- package/dist/cjs/internal/base/base-resource.js +1 -0
- package/dist/cjs/internal/base/collection.js +20 -45
- package/dist/cjs/internal/base/logger.js +1 -0
- package/dist/cjs/internal/base/path-parameters.js +2 -0
- package/dist/cjs/internal/base/query-parameters.js +1 -0
- package/dist/cjs/internal/errors/generic.js +5 -0
- package/dist/cjs/internal/providers/crypto/crypto-provider.js +2 -13
- package/dist/cjs/internal/providers/crypto/edge-crypto.js +14 -25
- package/dist/cjs/internal/providers/crypto/node-crypto.js +5 -16
- package/dist/cjs/internal/providers/runtime-provider.js +1 -0
- package/dist/cjs/notifications/entities/address/address-notification.js +15 -2
- package/dist/cjs/notifications/entities/adjustment/adjustment-item-notification.js +6 -0
- package/dist/cjs/notifications/entities/adjustment/adjustment-item-totals-notification.js +3 -0
- package/dist/cjs/notifications/entities/adjustment/adjustment-notification.js +15 -0
- package/dist/cjs/notifications/entities/adjustment/adjustment-proration-notification.js +2 -0
- package/dist/cjs/notifications/entities/adjustment/adjustment-time-period-notification.js +2 -0
- package/dist/cjs/notifications/entities/api-key/api-key-notification.js +13 -4
- package/dist/cjs/notifications/entities/business/business-notification.js +12 -2
- package/dist/cjs/notifications/entities/business/contacts-notification.js +2 -0
- package/dist/cjs/notifications/entities/customer/customer-notification.js +10 -0
- package/dist/cjs/notifications/entities/discount/discount-notification.js +20 -2
- package/dist/cjs/notifications/entities/discount-group/discount-group-notification.js +6 -0
- package/dist/cjs/notifications/entities/payment-method/payment-method-deleted-notification.js +8 -0
- package/dist/cjs/notifications/entities/payment-method/payment-method-notification.js +7 -0
- package/dist/cjs/notifications/entities/payout/payout-notification.js +4 -0
- package/dist/cjs/notifications/entities/price/price-notification.js +19 -4
- package/dist/cjs/notifications/entities/price/price-quantity-notification.js +2 -0
- package/dist/cjs/notifications/entities/product/product-notification.js +13 -3
- package/dist/cjs/notifications/entities/report/report-filters-notification.js +4 -2
- package/dist/cjs/notifications/entities/report/report-notification.js +10 -4
- package/dist/cjs/notifications/entities/shared/adjustment-original-amount-notification.js +2 -0
- package/dist/cjs/notifications/entities/shared/billing-details-notification.js +5 -2
- package/dist/cjs/notifications/entities/shared/chargeback-fee-notification.js +2 -0
- package/dist/cjs/notifications/entities/shared/import-meta-notification.js +2 -0
- package/dist/cjs/notifications/entities/shared/korean-market-underlying-details-notification.js +1 -0
- package/dist/cjs/notifications/entities/shared/money-notification.js +2 -0
- package/dist/cjs/notifications/entities/shared/payment-card-notification.js +5 -0
- package/dist/cjs/notifications/entities/shared/payment-method-details-notification.js +3 -0
- package/dist/cjs/notifications/entities/shared/payment-method-underlying-details-notification.js +1 -0
- package/dist/cjs/notifications/entities/shared/payout-totals-adjustment-notification.js +7 -0
- package/dist/cjs/notifications/entities/shared/tax-rates-used-notification.js +2 -0
- package/dist/cjs/notifications/entities/shared/time-period-notification.js +2 -0
- package/dist/cjs/notifications/entities/shared/total-adjustments-notification.js +6 -0
- package/dist/cjs/notifications/entities/shared/totals-notification.js +4 -0
- package/dist/cjs/notifications/entities/shared/transaction-checkout-notification.js +1 -0
- package/dist/cjs/notifications/entities/shared/transaction-payment-attempt-notification.js +10 -2
- package/dist/cjs/notifications/entities/shared/transaction-payout-totals-adjusted-notification.js +7 -0
- package/dist/cjs/notifications/entities/shared/transaction-payout-totals-notification.js +13 -0
- package/dist/cjs/notifications/entities/shared/transaction-totals-adjusted-notification.js +7 -0
- package/dist/cjs/notifications/entities/shared/transaction-totals-notification.js +11 -0
- package/dist/cjs/notifications/entities/shared/unit-price-override-notification.js +2 -0
- package/dist/cjs/notifications/entities/shared/unit-totals-notification.js +4 -0
- package/dist/cjs/notifications/entities/subscription/subscription-created-notification.js +23 -0
- package/dist/cjs/notifications/entities/subscription/subscription-discount-notification.js +4 -2
- package/dist/cjs/notifications/entities/subscription/subscription-item-notification.js +10 -0
- package/dist/cjs/notifications/entities/subscription/subscription-notification.js +22 -0
- package/dist/cjs/notifications/entities/subscription/subscription-price-notification.js +16 -3
- package/dist/cjs/notifications/entities/subscription/subscription-scheduled-change-notification.js +3 -0
- package/dist/cjs/notifications/entities/subscription/subscription-time-period-notification.js +2 -0
- package/dist/cjs/notifications/entities/transaction/transaction-details-notification.js +6 -0
- package/dist/cjs/notifications/entities/transaction/transaction-item-notification.js +3 -0
- package/dist/cjs/notifications/entities/transaction/transaction-line-item-notification.js +8 -0
- package/dist/cjs/notifications/entities/transaction/transaction-notification.js +23 -0
- package/dist/cjs/notifications/entities/transaction/transaction-proration-notification.js +2 -0
- package/dist/cjs/notifications/entities/transaction/transactions-time-period-notification.js +2 -0
- package/dist/cjs/notifications/events/address/address-created-event.js +2 -1
- package/dist/cjs/notifications/events/address/address-imported-event.js +2 -1
- package/dist/cjs/notifications/events/address/address-updated-event.js +2 -1
- package/dist/cjs/notifications/events/adjustment/adjustment-created-event.js +2 -1
- package/dist/cjs/notifications/events/adjustment/adjustment-updated-event.js +2 -1
- package/dist/cjs/notifications/events/api-key/api-key-created-event.js +2 -1
- package/dist/cjs/notifications/events/api-key/api-key-expired-event.js +2 -1
- package/dist/cjs/notifications/events/api-key/api-key-expiring-event.js +2 -1
- package/dist/cjs/notifications/events/api-key/api-key-revoked-event.js +2 -1
- package/dist/cjs/notifications/events/api-key/api-key-updated-event.js +2 -1
- package/dist/cjs/notifications/events/business/business-created-event.js +2 -1
- package/dist/cjs/notifications/events/business/business-imported-event.js +2 -1
- package/dist/cjs/notifications/events/business/business-updated-event.js +2 -1
- package/dist/cjs/notifications/events/customer/customer-created-event.js +2 -1
- package/dist/cjs/notifications/events/customer/customer-imported-event.js +2 -1
- package/dist/cjs/notifications/events/customer/customer-updated-event.js +2 -1
- package/dist/cjs/notifications/events/discount/discount-created-event.js +2 -1
- package/dist/cjs/notifications/events/discount/discount-imported-event.js +2 -1
- package/dist/cjs/notifications/events/discount/discount-updated-event.js +2 -1
- package/dist/cjs/notifications/events/discount-group/discount-group-created-event.js +2 -1
- package/dist/cjs/notifications/events/generic/generic-event.js +1 -0
- package/dist/cjs/notifications/events/payment-method/payment-method-deleted-event.js +2 -1
- package/dist/cjs/notifications/events/payment-method/payment-method-saved-event.js +2 -1
- package/dist/cjs/notifications/events/payout/payout-created-event.js +2 -1
- package/dist/cjs/notifications/events/payout/payout-paid-event.js +2 -1
- package/dist/cjs/notifications/events/price/price-created-event.js +2 -1
- package/dist/cjs/notifications/events/price/price-imported-event.js +2 -1
- package/dist/cjs/notifications/events/price/price-updated-event.js +2 -1
- package/dist/cjs/notifications/events/product/product-created-event.js +2 -1
- package/dist/cjs/notifications/events/product/product-imported-event.js +2 -1
- package/dist/cjs/notifications/events/product/product-updated-event.js +2 -1
- package/dist/cjs/notifications/events/report/report-created-event.js +2 -1
- package/dist/cjs/notifications/events/report/report-updated-event.js +2 -1
- package/dist/cjs/notifications/events/subscription/subscription-activated-event.js +2 -1
- package/dist/cjs/notifications/events/subscription/subscription-canceled-event.js +2 -1
- package/dist/cjs/notifications/events/subscription/subscription-created-event.js +2 -1
- package/dist/cjs/notifications/events/subscription/subscription-imported-event.js +2 -1
- package/dist/cjs/notifications/events/subscription/subscription-past-due-event.js +2 -1
- package/dist/cjs/notifications/events/subscription/subscription-paused-event.js +2 -1
- package/dist/cjs/notifications/events/subscription/subscription-resumed-event.js +2 -1
- package/dist/cjs/notifications/events/subscription/subscription-trialing-event.js +2 -1
- package/dist/cjs/notifications/events/subscription/subscription-updated-event.js +2 -1
- package/dist/cjs/notifications/events/transaction/transaction-billed-event.js +2 -1
- package/dist/cjs/notifications/events/transaction/transaction-canceled-event.js +2 -1
- package/dist/cjs/notifications/events/transaction/transaction-completed-event.js +2 -1
- package/dist/cjs/notifications/events/transaction/transaction-created-event.js +2 -1
- package/dist/cjs/notifications/events/transaction/transaction-paid-event.js +2 -1
- package/dist/cjs/notifications/events/transaction/transaction-past-due-event.js +2 -1
- package/dist/cjs/notifications/events/transaction/transaction-payment-failed-event.js +2 -1
- package/dist/cjs/notifications/events/transaction/transaction-ready-event.js +2 -1
- package/dist/cjs/notifications/events/transaction/transaction-revised-event.js +2 -1
- package/dist/cjs/notifications/events/transaction/transaction-updated-event.js +2 -1
- package/dist/cjs/notifications/helpers/webhooks-validator.js +14 -26
- package/dist/cjs/notifications/helpers/webhooks.js +11 -24
- package/dist/cjs/paddle.js +29 -5
- package/dist/cjs/resources/addresses/index.js +25 -42
- package/dist/cjs/resources/adjustments/index.js +12 -25
- package/dist/cjs/resources/businesses/index.js +25 -42
- package/dist/cjs/resources/customer-portal-sessions/index.js +8 -19
- package/dist/cjs/resources/customers/index.js +35 -56
- package/dist/cjs/resources/discount-groups/index.js +4 -15
- package/dist/cjs/resources/discounts/index.js +20 -37
- package/dist/cjs/resources/event-types/index.js +4 -15
- package/dist/cjs/resources/notification-settings/index.js +31 -50
- package/dist/cjs/resources/notifications/index.js +14 -27
- package/dist/cjs/resources/payment-methods/index.js +17 -30
- package/dist/cjs/resources/prices/index.js +21 -38
- package/dist/cjs/resources/pricing-preview/index.js +4 -15
- package/dist/cjs/resources/products/index.js +21 -38
- package/dist/cjs/resources/reports/index.js +18 -33
- package/dist/cjs/resources/simulation-run-events/index.js +18 -31
- package/dist/cjs/resources/simulation-runs/index.js +16 -29
- package/dist/cjs/resources/simulation-types/index.js +4 -15
- package/dist/cjs/resources/simulations/index.js +18 -33
- package/dist/cjs/resources/subscriptions/index.js +71 -100
- package/dist/cjs/resources/transactions/index.js +40 -61
- package/dist/cjs/version.js +1 -1
- package/dist/esm/entities/address/address.js +14 -0
- package/dist/esm/entities/adjustment/adjustment-credit-note-pdf.js +1 -0
- package/dist/esm/entities/adjustment/adjustment-item-totals.js +3 -0
- package/dist/esm/entities/adjustment/adjustment-item.js +6 -0
- package/dist/esm/entities/adjustment/adjustment-proration.js +2 -0
- package/dist/esm/entities/adjustment/adjustment-time-period.js +2 -0
- package/dist/esm/entities/adjustment/adjustment.js +15 -0
- package/dist/esm/entities/business/business.js +11 -0
- package/dist/esm/entities/business/contacts.js +2 -0
- package/dist/esm/entities/customer/auth-token.js +2 -0
- package/dist/esm/entities/customer/credit-balance.js +3 -0
- package/dist/esm/entities/customer/customer-balance.js +3 -0
- package/dist/esm/entities/customer/customer.js +10 -0
- package/dist/esm/entities/customer-portal-session/customer-portal-session.js +4 -0
- package/dist/esm/entities/customer-portal-session/customer-portal-subscription-url.js +3 -0
- package/dist/esm/entities/customer-portal-session/general.js +1 -0
- package/dist/esm/entities/customer-portal-session/urls.js +3 -2
- package/dist/esm/entities/discount/discount.js +20 -2
- package/dist/esm/entities/discount-group/discount-group.js +6 -0
- package/dist/esm/entities/event-types/event-type.js +4 -0
- package/dist/esm/entities/events/event.js +6 -2
- package/dist/esm/entities/notification-settings/notification-settings.js +10 -0
- package/dist/esm/entities/notifications/notification-log.js +6 -2
- package/dist/esm/entities/notifications/notification.js +16 -5
- package/dist/esm/entities/notifications/replay-notification.js +1 -0
- package/dist/esm/entities/payment-method/payment-method.js +10 -0
- package/dist/esm/entities/payout/payout.js +4 -0
- package/dist/esm/entities/price/price-quantity.js +2 -0
- package/dist/esm/entities/price/price.js +18 -2
- package/dist/esm/entities/pricing-preview/pricing-preview-details.js +1 -0
- package/dist/esm/entities/pricing-preview/pricing-preview-discounts.js +3 -0
- package/dist/esm/entities/pricing-preview/pricing-preview-line-item.js +9 -0
- package/dist/esm/entities/pricing-preview/pricing-preview.js +15 -7
- package/dist/esm/entities/product/product.js +13 -2
- package/dist/esm/entities/report/report-csv.js +1 -0
- package/dist/esm/entities/report/report-filters.js +4 -2
- package/dist/esm/entities/report/report.js +10 -4
- package/dist/esm/entities/shared/adjustment-original-amount.js +2 -0
- package/dist/esm/entities/shared/billing-details.js +5 -2
- package/dist/esm/entities/shared/chargeback-fee.js +2 -0
- package/dist/esm/entities/shared/import-meta.js +2 -0
- package/dist/esm/entities/shared/korean-market-underlying-details.js +1 -0
- package/dist/esm/entities/shared/money.js +2 -0
- package/dist/esm/entities/shared/payment-card.js +5 -0
- package/dist/esm/entities/shared/payment-method-details.js +3 -0
- package/dist/esm/entities/shared/payment-method-underlying-details.js +1 -0
- package/dist/esm/entities/shared/payout-totals-adjustment.js +7 -0
- package/dist/esm/entities/shared/paypal.js +2 -0
- package/dist/esm/entities/shared/simulation-event-request.js +1 -0
- package/dist/esm/entities/shared/simulation-event-response.js +2 -0
- package/dist/esm/entities/shared/tax-rates-used.js +2 -0
- package/dist/esm/entities/shared/time-period.js +2 -0
- package/dist/esm/entities/shared/total-adjustments.js +6 -0
- package/dist/esm/entities/shared/totals.js +4 -0
- package/dist/esm/entities/shared/transaction-checkout.js +1 -0
- package/dist/esm/entities/shared/transaction-payment-attempt.js +10 -2
- package/dist/esm/entities/shared/transaction-payout-totals-adjusted.js +7 -0
- package/dist/esm/entities/shared/transaction-payout-totals.js +11 -0
- package/dist/esm/entities/shared/transaction-totals-adjusted.js +7 -0
- package/dist/esm/entities/shared/transaction-totals.js +11 -0
- package/dist/esm/entities/shared/unit-price-override.js +2 -0
- package/dist/esm/entities/shared/unit-totals.js +4 -0
- package/dist/esm/entities/simulation/simulation-scenario-config/simulation-scenario-config.js +5 -0
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-cancellation-details.js +2 -0
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-cancellation-entities.js +2 -2
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-cancellation-options.js +4 -3
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-creation-details.js +2 -0
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-creation-entities.js +14 -8
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-creation-item.js +2 -0
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-creation-options.js +6 -4
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-pause-details.js +2 -0
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-pause-entities.js +2 -2
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-pause-options.js +4 -3
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-renewal-details.js +2 -0
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-renewal-entities.js +2 -2
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-renewal-options.js +4 -3
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-resume-details.js +2 -0
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-resume-entities.js +2 -2
- package/dist/esm/entities/simulation/simulation-scenario-config/subscription-resume-options.js +4 -3
- package/dist/esm/entities/simulation/simulation.js +12 -3
- package/dist/esm/entities/simulation-run/simulation-run.js +7 -2
- package/dist/esm/entities/simulation-run-event/simulation-run-event.js +8 -0
- package/dist/esm/entities/simulation-types/simulation-type.js +6 -0
- package/dist/esm/entities/subscription/next-transaction-adjustment-item.js +5 -0
- package/dist/esm/entities/subscription/next-transaction-adjustment-preview.js +3 -0
- package/dist/esm/entities/subscription/next-transaction.js +3 -0
- package/dist/esm/entities/subscription/subscription-discount.js +5 -3
- package/dist/esm/entities/subscription/subscription-item.js +10 -0
- package/dist/esm/entities/subscription/subscription-management.js +2 -0
- package/dist/esm/entities/subscription/subscription-preview-summary-result.js +3 -0
- package/dist/esm/entities/subscription/subscription-preview-update-summary.js +3 -0
- package/dist/esm/entities/subscription/subscription-preview.js +26 -0
- package/dist/esm/entities/subscription/subscription-scheduled-change.js +3 -0
- package/dist/esm/entities/subscription/subscription-time-period.js +2 -0
- package/dist/esm/entities/subscription/subscription.js +25 -0
- package/dist/esm/entities/subscription/transaction-details-preview.js +3 -0
- package/dist/esm/entities/subscription/transaction-line-item-preview.js +7 -0
- package/dist/esm/entities/transaction/address-preview.js +2 -0
- package/dist/esm/entities/transaction/adjustment-totals-breakdown.js +3 -0
- package/dist/esm/entities/transaction/adjustment-totals.js +7 -0
- package/dist/esm/entities/transaction/proration.js +2 -0
- package/dist/esm/entities/transaction/transaction-adjustment-item.js +6 -0
- package/dist/esm/entities/transaction/transaction-adjustment.js +14 -0
- package/dist/esm/entities/transaction/transaction-details.js +6 -0
- package/dist/esm/entities/transaction/transaction-invoice-pdf.js +1 -0
- package/dist/esm/entities/transaction/transaction-item-preview.js +5 -2
- package/dist/esm/entities/transaction/transaction-item.js +3 -0
- package/dist/esm/entities/transaction/transaction-line-item.js +8 -0
- package/dist/esm/entities/transaction/transaction-preview.js +12 -2
- package/dist/esm/entities/transaction/transaction-proration.js +2 -0
- package/dist/esm/entities/transaction/transaction.js +31 -2
- package/dist/esm/entities/transaction/transactions-time-period.js +2 -0
- package/dist/esm/internal/api/case-helpers.js +2 -13
- package/dist/esm/internal/api/client.js +54 -64
- package/dist/esm/internal/base/base-resource.js +1 -0
- package/dist/esm/internal/base/collection.js +20 -45
- package/dist/esm/internal/base/logger.js +1 -0
- package/dist/esm/internal/base/path-parameters.js +2 -0
- package/dist/esm/internal/base/query-parameters.js +1 -0
- package/dist/esm/internal/errors/generic.js +5 -0
- package/dist/esm/internal/providers/crypto/crypto-provider.js +2 -13
- package/dist/esm/internal/providers/crypto/edge-crypto.js +14 -25
- package/dist/esm/internal/providers/crypto/node-crypto.js +5 -16
- package/dist/esm/internal/providers/runtime-provider.js +1 -0
- package/dist/esm/notifications/entities/address/address-notification.js +15 -2
- package/dist/esm/notifications/entities/adjustment/adjustment-item-notification.js +6 -0
- package/dist/esm/notifications/entities/adjustment/adjustment-item-totals-notification.js +3 -0
- package/dist/esm/notifications/entities/adjustment/adjustment-notification.js +15 -0
- package/dist/esm/notifications/entities/adjustment/adjustment-proration-notification.js +2 -0
- package/dist/esm/notifications/entities/adjustment/adjustment-time-period-notification.js +2 -0
- package/dist/esm/notifications/entities/api-key/api-key-notification.js +13 -4
- package/dist/esm/notifications/entities/business/business-notification.js +12 -2
- package/dist/esm/notifications/entities/business/contacts-notification.js +2 -0
- package/dist/esm/notifications/entities/customer/customer-notification.js +10 -0
- package/dist/esm/notifications/entities/discount/discount-notification.js +20 -2
- package/dist/esm/notifications/entities/discount-group/discount-group-notification.js +6 -0
- package/dist/esm/notifications/entities/payment-method/payment-method-deleted-notification.js +8 -0
- package/dist/esm/notifications/entities/payment-method/payment-method-notification.js +7 -0
- package/dist/esm/notifications/entities/payout/payout-notification.js +4 -0
- package/dist/esm/notifications/entities/price/price-notification.js +19 -4
- package/dist/esm/notifications/entities/price/price-quantity-notification.js +2 -0
- package/dist/esm/notifications/entities/product/product-notification.js +13 -3
- package/dist/esm/notifications/entities/report/report-filters-notification.js +4 -2
- package/dist/esm/notifications/entities/report/report-notification.js +10 -4
- package/dist/esm/notifications/entities/shared/adjustment-original-amount-notification.js +2 -0
- package/dist/esm/notifications/entities/shared/billing-details-notification.js +5 -2
- package/dist/esm/notifications/entities/shared/chargeback-fee-notification.js +2 -0
- package/dist/esm/notifications/entities/shared/import-meta-notification.js +2 -0
- package/dist/esm/notifications/entities/shared/korean-market-underlying-details-notification.js +1 -0
- package/dist/esm/notifications/entities/shared/money-notification.js +2 -0
- package/dist/esm/notifications/entities/shared/payment-card-notification.js +5 -0
- package/dist/esm/notifications/entities/shared/payment-method-details-notification.js +3 -0
- package/dist/esm/notifications/entities/shared/payment-method-underlying-details-notification.js +1 -0
- package/dist/esm/notifications/entities/shared/payout-totals-adjustment-notification.js +7 -0
- package/dist/esm/notifications/entities/shared/tax-rates-used-notification.js +2 -0
- package/dist/esm/notifications/entities/shared/time-period-notification.js +2 -0
- package/dist/esm/notifications/entities/shared/total-adjustments-notification.js +6 -0
- package/dist/esm/notifications/entities/shared/totals-notification.js +4 -0
- package/dist/esm/notifications/entities/shared/transaction-checkout-notification.js +1 -0
- package/dist/esm/notifications/entities/shared/transaction-payment-attempt-notification.js +10 -2
- package/dist/esm/notifications/entities/shared/transaction-payout-totals-adjusted-notification.js +7 -0
- package/dist/esm/notifications/entities/shared/transaction-payout-totals-notification.js +13 -0
- package/dist/esm/notifications/entities/shared/transaction-totals-adjusted-notification.js +7 -0
- package/dist/esm/notifications/entities/shared/transaction-totals-notification.js +11 -0
- package/dist/esm/notifications/entities/shared/unit-price-override-notification.js +2 -0
- package/dist/esm/notifications/entities/shared/unit-totals-notification.js +4 -0
- package/dist/esm/notifications/entities/subscription/subscription-created-notification.js +23 -0
- package/dist/esm/notifications/entities/subscription/subscription-discount-notification.js +4 -2
- package/dist/esm/notifications/entities/subscription/subscription-item-notification.js +10 -0
- package/dist/esm/notifications/entities/subscription/subscription-notification.js +22 -0
- package/dist/esm/notifications/entities/subscription/subscription-price-notification.js +16 -3
- package/dist/esm/notifications/entities/subscription/subscription-scheduled-change-notification.js +3 -0
- package/dist/esm/notifications/entities/subscription/subscription-time-period-notification.js +2 -0
- package/dist/esm/notifications/entities/transaction/transaction-details-notification.js +6 -0
- package/dist/esm/notifications/entities/transaction/transaction-item-notification.js +3 -0
- package/dist/esm/notifications/entities/transaction/transaction-line-item-notification.js +8 -0
- package/dist/esm/notifications/entities/transaction/transaction-notification.js +23 -0
- package/dist/esm/notifications/entities/transaction/transaction-proration-notification.js +2 -0
- package/dist/esm/notifications/entities/transaction/transactions-time-period-notification.js +2 -0
- package/dist/esm/notifications/events/address/address-created-event.js +2 -1
- package/dist/esm/notifications/events/address/address-imported-event.js +2 -1
- package/dist/esm/notifications/events/address/address-updated-event.js +2 -1
- package/dist/esm/notifications/events/adjustment/adjustment-created-event.js +2 -1
- package/dist/esm/notifications/events/adjustment/adjustment-updated-event.js +2 -1
- package/dist/esm/notifications/events/api-key/api-key-created-event.js +2 -1
- package/dist/esm/notifications/events/api-key/api-key-expired-event.js +2 -1
- package/dist/esm/notifications/events/api-key/api-key-expiring-event.js +2 -1
- package/dist/esm/notifications/events/api-key/api-key-revoked-event.js +2 -1
- package/dist/esm/notifications/events/api-key/api-key-updated-event.js +2 -1
- package/dist/esm/notifications/events/business/business-created-event.js +2 -1
- package/dist/esm/notifications/events/business/business-imported-event.js +2 -1
- package/dist/esm/notifications/events/business/business-updated-event.js +2 -1
- package/dist/esm/notifications/events/customer/customer-created-event.js +2 -1
- package/dist/esm/notifications/events/customer/customer-imported-event.js +2 -1
- package/dist/esm/notifications/events/customer/customer-updated-event.js +2 -1
- package/dist/esm/notifications/events/discount/discount-created-event.js +2 -1
- package/dist/esm/notifications/events/discount/discount-imported-event.js +2 -1
- package/dist/esm/notifications/events/discount/discount-updated-event.js +2 -1
- package/dist/esm/notifications/events/discount-group/discount-group-created-event.js +2 -1
- package/dist/esm/notifications/events/generic/generic-event.js +1 -0
- package/dist/esm/notifications/events/payment-method/payment-method-deleted-event.js +2 -1
- package/dist/esm/notifications/events/payment-method/payment-method-saved-event.js +2 -1
- package/dist/esm/notifications/events/payout/payout-created-event.js +2 -1
- package/dist/esm/notifications/events/payout/payout-paid-event.js +2 -1
- package/dist/esm/notifications/events/price/price-created-event.js +2 -1
- package/dist/esm/notifications/events/price/price-imported-event.js +2 -1
- package/dist/esm/notifications/events/price/price-updated-event.js +2 -1
- package/dist/esm/notifications/events/product/product-created-event.js +2 -1
- package/dist/esm/notifications/events/product/product-imported-event.js +2 -1
- package/dist/esm/notifications/events/product/product-updated-event.js +2 -1
- package/dist/esm/notifications/events/report/report-created-event.js +2 -1
- package/dist/esm/notifications/events/report/report-updated-event.js +2 -1
- package/dist/esm/notifications/events/subscription/subscription-activated-event.js +2 -1
- package/dist/esm/notifications/events/subscription/subscription-canceled-event.js +2 -1
- package/dist/esm/notifications/events/subscription/subscription-created-event.js +2 -1
- package/dist/esm/notifications/events/subscription/subscription-imported-event.js +2 -1
- package/dist/esm/notifications/events/subscription/subscription-past-due-event.js +2 -1
- package/dist/esm/notifications/events/subscription/subscription-paused-event.js +2 -1
- package/dist/esm/notifications/events/subscription/subscription-resumed-event.js +2 -1
- package/dist/esm/notifications/events/subscription/subscription-trialing-event.js +2 -1
- package/dist/esm/notifications/events/subscription/subscription-updated-event.js +2 -1
- package/dist/esm/notifications/events/transaction/transaction-billed-event.js +2 -1
- package/dist/esm/notifications/events/transaction/transaction-canceled-event.js +2 -1
- package/dist/esm/notifications/events/transaction/transaction-completed-event.js +2 -1
- package/dist/esm/notifications/events/transaction/transaction-created-event.js +2 -1
- package/dist/esm/notifications/events/transaction/transaction-paid-event.js +2 -1
- package/dist/esm/notifications/events/transaction/transaction-past-due-event.js +2 -1
- package/dist/esm/notifications/events/transaction/transaction-payment-failed-event.js +2 -1
- package/dist/esm/notifications/events/transaction/transaction-ready-event.js +2 -1
- package/dist/esm/notifications/events/transaction/transaction-revised-event.js +2 -1
- package/dist/esm/notifications/events/transaction/transaction-updated-event.js +2 -1
- package/dist/esm/notifications/helpers/webhooks-validator.js +14 -26
- package/dist/esm/notifications/helpers/webhooks.js +11 -24
- package/dist/esm/paddle.js +29 -5
- package/dist/esm/resources/addresses/index.js +25 -42
- package/dist/esm/resources/adjustments/index.js +12 -25
- package/dist/esm/resources/businesses/index.js +25 -42
- package/dist/esm/resources/customer-portal-sessions/index.js +8 -19
- package/dist/esm/resources/customers/index.js +35 -56
- package/dist/esm/resources/discount-groups/index.js +4 -15
- package/dist/esm/resources/discounts/index.js +20 -37
- package/dist/esm/resources/event-types/index.js +4 -15
- package/dist/esm/resources/notification-settings/index.js +31 -50
- package/dist/esm/resources/notifications/index.js +14 -27
- package/dist/esm/resources/payment-methods/index.js +17 -30
- package/dist/esm/resources/prices/index.js +21 -38
- package/dist/esm/resources/pricing-preview/index.js +4 -15
- package/dist/esm/resources/products/index.js +21 -38
- package/dist/esm/resources/reports/index.js +18 -33
- package/dist/esm/resources/simulation-run-events/index.js +18 -31
- package/dist/esm/resources/simulation-runs/index.js +16 -29
- package/dist/esm/resources/simulation-types/index.js +4 -15
- package/dist/esm/resources/simulations/index.js +18 -33
- package/dist/esm/resources/subscriptions/index.js +71 -100
- package/dist/esm/resources/transactions/index.js +40 -61
- package/dist/esm/version.js +1 -1
- package/dist/types/version.d.ts +1 -1
- package/package.json +4 -4
|
@@ -2,9 +2,10 @@ import { Event } from '../../../entities/events/event.js';
|
|
|
2
2
|
import { EventName } from '../../helpers/index.js';
|
|
3
3
|
import { TransactionNotification } from '../../entities/index.js';
|
|
4
4
|
export class TransactionBilledEvent extends Event {
|
|
5
|
+
eventType = EventName.TransactionBilled;
|
|
6
|
+
data;
|
|
5
7
|
constructor(response) {
|
|
6
8
|
super(response);
|
|
7
|
-
this.eventType = EventName.TransactionBilled;
|
|
8
9
|
this.data = new TransactionNotification(response.data);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -2,9 +2,10 @@ import { Event } from '../../../entities/events/event.js';
|
|
|
2
2
|
import { EventName } from '../../helpers/index.js';
|
|
3
3
|
import { TransactionNotification } from '../../entities/index.js';
|
|
4
4
|
export class TransactionCanceledEvent extends Event {
|
|
5
|
+
eventType = EventName.TransactionCanceled;
|
|
6
|
+
data;
|
|
5
7
|
constructor(response) {
|
|
6
8
|
super(response);
|
|
7
|
-
this.eventType = EventName.TransactionCanceled;
|
|
8
9
|
this.data = new TransactionNotification(response.data);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -2,9 +2,10 @@ import { Event } from '../../../entities/events/event.js';
|
|
|
2
2
|
import { EventName } from '../../helpers/index.js';
|
|
3
3
|
import { TransactionNotification } from '../../entities/index.js';
|
|
4
4
|
export class TransactionCompletedEvent extends Event {
|
|
5
|
+
eventType = EventName.TransactionCompleted;
|
|
6
|
+
data;
|
|
5
7
|
constructor(response) {
|
|
6
8
|
super(response);
|
|
7
|
-
this.eventType = EventName.TransactionCompleted;
|
|
8
9
|
this.data = new TransactionNotification(response.data);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -2,9 +2,10 @@ import { Event } from '../../../entities/events/event.js';
|
|
|
2
2
|
import { EventName } from '../../helpers/index.js';
|
|
3
3
|
import { TransactionNotification } from '../../entities/index.js';
|
|
4
4
|
export class TransactionCreatedEvent extends Event {
|
|
5
|
+
eventType = EventName.TransactionCreated;
|
|
6
|
+
data;
|
|
5
7
|
constructor(response) {
|
|
6
8
|
super(response);
|
|
7
|
-
this.eventType = EventName.TransactionCreated;
|
|
8
9
|
this.data = new TransactionNotification(response.data);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -2,9 +2,10 @@ import { Event } from '../../../entities/events/event.js';
|
|
|
2
2
|
import { EventName } from '../../helpers/index.js';
|
|
3
3
|
import { TransactionNotification } from '../../entities/index.js';
|
|
4
4
|
export class TransactionPaidEvent extends Event {
|
|
5
|
+
eventType = EventName.TransactionPaid;
|
|
6
|
+
data;
|
|
5
7
|
constructor(response) {
|
|
6
8
|
super(response);
|
|
7
|
-
this.eventType = EventName.TransactionPaid;
|
|
8
9
|
this.data = new TransactionNotification(response.data);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -2,9 +2,10 @@ import { Event } from '../../../entities/events/event.js';
|
|
|
2
2
|
import { EventName } from '../../helpers/index.js';
|
|
3
3
|
import { TransactionNotification } from '../../entities/index.js';
|
|
4
4
|
export class TransactionPastDueEvent extends Event {
|
|
5
|
+
eventType = EventName.TransactionPastDue;
|
|
6
|
+
data;
|
|
5
7
|
constructor(response) {
|
|
6
8
|
super(response);
|
|
7
|
-
this.eventType = EventName.TransactionPastDue;
|
|
8
9
|
this.data = new TransactionNotification(response.data);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -2,9 +2,10 @@ import { Event } from '../../../entities/events/event.js';
|
|
|
2
2
|
import { EventName } from '../../helpers/index.js';
|
|
3
3
|
import { TransactionNotification } from '../../entities/index.js';
|
|
4
4
|
export class TransactionPaymentFailedEvent extends Event {
|
|
5
|
+
eventType = EventName.TransactionPaymentFailed;
|
|
6
|
+
data;
|
|
5
7
|
constructor(response) {
|
|
6
8
|
super(response);
|
|
7
|
-
this.eventType = EventName.TransactionPaymentFailed;
|
|
8
9
|
this.data = new TransactionNotification(response.data);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -2,9 +2,10 @@ import { Event } from '../../../entities/events/event.js';
|
|
|
2
2
|
import { EventName } from '../../helpers/index.js';
|
|
3
3
|
import { TransactionNotification } from '../../entities/index.js';
|
|
4
4
|
export class TransactionReadyEvent extends Event {
|
|
5
|
+
eventType = EventName.TransactionReady;
|
|
6
|
+
data;
|
|
5
7
|
constructor(response) {
|
|
6
8
|
super(response);
|
|
7
|
-
this.eventType = EventName.TransactionReady;
|
|
8
9
|
this.data = new TransactionNotification(response.data);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -2,9 +2,10 @@ import { Event } from '../../../entities/events/event.js';
|
|
|
2
2
|
import { EventName } from '../../helpers/index.js';
|
|
3
3
|
import { TransactionNotification } from '../../entities/index.js';
|
|
4
4
|
export class TransactionRevisedEvent extends Event {
|
|
5
|
+
eventType = EventName.TransactionRevised;
|
|
6
|
+
data;
|
|
5
7
|
constructor(response) {
|
|
6
8
|
super(response);
|
|
7
|
-
this.eventType = EventName.TransactionRevised;
|
|
8
9
|
this.data = new TransactionNotification(response.data);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -2,9 +2,10 @@ import { Event } from '../../../entities/events/event.js';
|
|
|
2
2
|
import { EventName } from '../../helpers/index.js';
|
|
3
3
|
import { TransactionNotification } from '../../entities/index.js';
|
|
4
4
|
export class TransactionUpdatedEvent extends Event {
|
|
5
|
+
eventType = EventName.TransactionUpdated;
|
|
6
|
+
data;
|
|
5
7
|
constructor(response) {
|
|
6
8
|
super(response);
|
|
7
|
-
this.eventType = EventName.TransactionUpdated;
|
|
8
9
|
this.data = new TransactionNotification(response.data);
|
|
9
10
|
}
|
|
10
11
|
}
|
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { RuntimeProvider } from '../../internal/providers/runtime-provider.js';
|
|
11
2
|
import { Logger } from '../../internal/base/logger.js';
|
|
12
3
|
export class WebhooksValidator {
|
|
4
|
+
static MAX_VALID_TIME_DIFFERENCE = 5;
|
|
13
5
|
extractHeader(header) {
|
|
14
6
|
const parts = header.split(';');
|
|
15
7
|
let ts = '';
|
|
@@ -32,22 +24,18 @@ export class WebhooksValidator {
|
|
|
32
24
|
throw new Error('[Paddle] Invalid webhook signature');
|
|
33
25
|
}
|
|
34
26
|
}
|
|
35
|
-
isValidSignature(requestBody, secretKey, signature) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const computedHash = yield cryptoProvider.computeHmac(payloadWithTime, secretKey);
|
|
49
|
-
return computedHash === headers.h1;
|
|
50
|
-
});
|
|
27
|
+
async isValidSignature(requestBody, secretKey, signature) {
|
|
28
|
+
const cryptoProvider = RuntimeProvider.getProvider()?.crypto;
|
|
29
|
+
if (!cryptoProvider) {
|
|
30
|
+
Logger.error('Unknown runtime. Cannot validate webhook signature');
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
const headers = this.extractHeader(signature);
|
|
34
|
+
const payloadWithTime = `${headers.ts}:${requestBody}`;
|
|
35
|
+
if (new Date().getTime() > new Date((headers.ts + WebhooksValidator.MAX_VALID_TIME_DIFFERENCE) * 1000).getTime()) {
|
|
36
|
+
return false;
|
|
37
|
+
}
|
|
38
|
+
const computedHash = await cryptoProvider.computeHmac(payloadWithTime, secretKey);
|
|
39
|
+
return computedHash === headers.h1;
|
|
51
40
|
}
|
|
52
41
|
}
|
|
53
|
-
WebhooksValidator.MAX_VALID_TIME_DIFFERENCE = 5;
|
|
@@ -1,33 +1,20 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { WebhooksValidator } from './webhooks-validator.js';
|
|
11
2
|
import { EventName } from './types.js';
|
|
12
3
|
import { AddressCreatedEvent, AddressImportedEvent, AddressUpdatedEvent, AdjustmentCreatedEvent, AdjustmentUpdatedEvent, ApiKeyCreatedEvent, ApiKeyExpiredEvent, ApiKeyExpiringEvent, ApiKeyRevokedEvent, ApiKeyUpdatedEvent, BusinessCreatedEvent, BusinessImportedEvent, BusinessUpdatedEvent, CustomerCreatedEvent, CustomerImportedEvent, CustomerUpdatedEvent, DiscountCreatedEvent, DiscountGroupCreatedEvent, DiscountImportedEvent, DiscountUpdatedEvent, GenericEvent, PaymentMethodDeletedEvent, PaymentMethodSavedEvent, PayoutCreatedEvent, PayoutPaidEvent, PriceCreatedEvent, PriceImportedEvent, PriceUpdatedEvent, ProductCreatedEvent, ProductImportedEvent, ProductUpdatedEvent, ReportCreatedEvent, ReportUpdatedEvent, SubscriptionActivatedEvent, SubscriptionCanceledEvent, SubscriptionCreatedEvent, SubscriptionImportedEvent, SubscriptionPastDueEvent, SubscriptionPausedEvent, SubscriptionResumedEvent, SubscriptionTrialingEvent, SubscriptionUpdatedEvent, TransactionBilledEvent, TransactionCanceledEvent, TransactionCompletedEvent, TransactionCreatedEvent, TransactionPaidEvent, TransactionPastDueEvent, TransactionPaymentFailedEvent, TransactionReadyEvent, TransactionRevisedEvent, TransactionUpdatedEvent, } from '../events/index.js';
|
|
13
4
|
import { Logger } from '../../internal/base/logger.js';
|
|
14
5
|
export class Webhooks {
|
|
15
|
-
unmarshal(requestBody, secretKey, signature) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
});
|
|
6
|
+
async unmarshal(requestBody, secretKey, signature) {
|
|
7
|
+
const isSignatureValid = await new WebhooksValidator().isValidSignature(requestBody, secretKey, signature);
|
|
8
|
+
if (isSignatureValid) {
|
|
9
|
+
const parsedRequest = JSON.parse(requestBody);
|
|
10
|
+
return Webhooks.fromJson(parsedRequest);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
throw new Error('[Paddle] Webhook signature verification failed');
|
|
14
|
+
}
|
|
26
15
|
}
|
|
27
|
-
isSignatureValid(requestBody, secretKey, signature) {
|
|
28
|
-
return
|
|
29
|
-
return yield new WebhooksValidator().isValidSignature(requestBody, secretKey, signature);
|
|
30
|
-
});
|
|
16
|
+
async isSignatureValid(requestBody, secretKey, signature) {
|
|
17
|
+
return await new WebhooksValidator().isValidSignature(requestBody, secretKey, signature);
|
|
31
18
|
}
|
|
32
19
|
static fromJson(data) {
|
|
33
20
|
switch (data.event_type) {
|
package/dist/esm/paddle.js
CHANGED
|
@@ -4,12 +4,36 @@ import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomerPor
|
|
|
4
4
|
import { EventsResource } from './resources/events/index.js';
|
|
5
5
|
import { Webhooks } from './notifications/index.js';
|
|
6
6
|
export class Paddle {
|
|
7
|
+
client;
|
|
8
|
+
defaultPaddleOptions = {
|
|
9
|
+
environment: Environment.production,
|
|
10
|
+
logLevel: LogLevel.error,
|
|
11
|
+
};
|
|
12
|
+
products;
|
|
13
|
+
prices;
|
|
14
|
+
transactions;
|
|
15
|
+
adjustments;
|
|
16
|
+
customers;
|
|
17
|
+
customerPortalSessions;
|
|
18
|
+
addresses;
|
|
19
|
+
businesses;
|
|
20
|
+
discounts;
|
|
21
|
+
discountGroups;
|
|
22
|
+
subscriptions;
|
|
23
|
+
paymentMethods;
|
|
24
|
+
pricingPreview;
|
|
25
|
+
events;
|
|
26
|
+
webhooks;
|
|
27
|
+
eventTypes;
|
|
28
|
+
notificationSettings;
|
|
29
|
+
notifications;
|
|
30
|
+
reports;
|
|
31
|
+
simulationTypes;
|
|
32
|
+
simulations;
|
|
33
|
+
simulationRuns;
|
|
34
|
+
simulationRunEvents;
|
|
7
35
|
constructor(apiKey, options) {
|
|
8
|
-
this.
|
|
9
|
-
environment: Environment.production,
|
|
10
|
-
logLevel: LogLevel.verbose,
|
|
11
|
-
};
|
|
12
|
-
this.client = new Client(apiKey, options ? Object.assign(Object.assign({}, this.defaultPaddleOptions), options) : Object.assign({}, this.defaultPaddleOptions));
|
|
36
|
+
this.client = new Client(apiKey, options ? { ...this.defaultPaddleOptions, ...options } : { ...this.defaultPaddleOptions });
|
|
13
37
|
this.products = new ProductsResource(this.client);
|
|
14
38
|
this.prices = new PricesResource(this.client);
|
|
15
39
|
this.transactions = new TransactionsResource(this.client);
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { BaseResource, PathParameters, QueryParameters } from '../../internal/base/index.js';
|
|
11
2
|
import { Address, AddressCollection } from '../../entities/index.js';
|
|
12
3
|
const AddressPaths = {
|
|
@@ -24,41 +15,33 @@ export class AddressesResource extends BaseResource {
|
|
|
24
15
|
}).deriveUrl();
|
|
25
16
|
return new AddressCollection(this.client, urlWithPathParams + queryParameters.toQueryString());
|
|
26
17
|
}
|
|
27
|
-
create(customerId, createAddressParameters) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return new Address(data);
|
|
35
|
-
});
|
|
18
|
+
async create(customerId, createAddressParameters) {
|
|
19
|
+
const urlWithPathParams = new PathParameters(AddressPaths.create, {
|
|
20
|
+
customer_id: customerId,
|
|
21
|
+
}).deriveUrl();
|
|
22
|
+
const response = await this.client.post(urlWithPathParams, createAddressParameters);
|
|
23
|
+
const data = this.handleResponse(response);
|
|
24
|
+
return new Address(data);
|
|
36
25
|
}
|
|
37
|
-
get(customerId, addressId) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return new Address(data);
|
|
46
|
-
});
|
|
26
|
+
async get(customerId, addressId) {
|
|
27
|
+
const urlWithPathParams = new PathParameters(AddressPaths.get, {
|
|
28
|
+
customer_id: customerId,
|
|
29
|
+
address_id: addressId,
|
|
30
|
+
}).deriveUrl();
|
|
31
|
+
const response = await this.client.get(urlWithPathParams);
|
|
32
|
+
const data = this.handleResponse(response);
|
|
33
|
+
return new Address(data);
|
|
47
34
|
}
|
|
48
|
-
update(customerId, addressId, updateAddress) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return new Address(data);
|
|
57
|
-
});
|
|
35
|
+
async update(customerId, addressId, updateAddress) {
|
|
36
|
+
const urlWithPathParams = new PathParameters(AddressPaths.update, {
|
|
37
|
+
customer_id: customerId,
|
|
38
|
+
address_id: addressId,
|
|
39
|
+
}).deriveUrl();
|
|
40
|
+
const response = await this.client.patch(urlWithPathParams, updateAddress);
|
|
41
|
+
const data = this.handleResponse(response);
|
|
42
|
+
return new Address(data);
|
|
58
43
|
}
|
|
59
|
-
archive(customerId, addressId) {
|
|
60
|
-
return
|
|
61
|
-
return yield this.update(customerId, addressId, { status: 'archived' });
|
|
62
|
-
});
|
|
44
|
+
async archive(customerId, addressId) {
|
|
45
|
+
return await this.update(customerId, addressId, { status: 'archived' });
|
|
63
46
|
}
|
|
64
47
|
}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { BaseResource, PathParameters, QueryParameters } from '../../internal/base/index.js';
|
|
11
2
|
import { Adjustment, AdjustmentCollection, AdjustmentCreditNotePDF } from '../../entities/index.js';
|
|
12
3
|
const AdjustmentPaths = {
|
|
@@ -20,22 +11,18 @@ export class AdjustmentsResource extends BaseResource {
|
|
|
20
11
|
const queryParameters = new QueryParameters(queryParams);
|
|
21
12
|
return new AdjustmentCollection(this.client, AdjustmentPaths.list + queryParameters.toQueryString());
|
|
22
13
|
}
|
|
23
|
-
create(createAdjustmentParameters) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return new Adjustment(data);
|
|
28
|
-
});
|
|
14
|
+
async create(createAdjustmentParameters) {
|
|
15
|
+
const response = await this.client.post(AdjustmentPaths.create, createAdjustmentParameters);
|
|
16
|
+
const data = this.handleResponse(response);
|
|
17
|
+
return new Adjustment(data);
|
|
29
18
|
}
|
|
30
|
-
getCreditNotePDF(adjustmentId, queryParams) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
return new AdjustmentCreditNotePDF(data);
|
|
39
|
-
});
|
|
19
|
+
async getCreditNotePDF(adjustmentId, queryParams) {
|
|
20
|
+
const urlWithPathParams = new PathParameters(AdjustmentPaths.getCreditNotePDF, {
|
|
21
|
+
adjustment_id: adjustmentId,
|
|
22
|
+
}).deriveUrl();
|
|
23
|
+
const queryParameters = new QueryParameters(queryParams);
|
|
24
|
+
const response = await this.client.get(urlWithPathParams + queryParameters.toQueryString());
|
|
25
|
+
const data = this.handleResponse(response);
|
|
26
|
+
return new AdjustmentCreditNotePDF(data);
|
|
40
27
|
}
|
|
41
28
|
}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { BaseResource, PathParameters, QueryParameters } from '../../internal/base/index.js';
|
|
11
2
|
import { Business, BusinessCollection } from '../../entities/index.js';
|
|
12
3
|
const BusinessPaths = {
|
|
@@ -24,41 +15,33 @@ export class BusinessesResource extends BaseResource {
|
|
|
24
15
|
}).deriveUrl();
|
|
25
16
|
return new BusinessCollection(this.client, urlWithPathParams + queryParameters.toQueryString());
|
|
26
17
|
}
|
|
27
|
-
create(customerId, createBusinessParameters) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return new Business(data);
|
|
35
|
-
});
|
|
18
|
+
async create(customerId, createBusinessParameters) {
|
|
19
|
+
const urlWithPathParams = new PathParameters(BusinessPaths.create, {
|
|
20
|
+
customer_id: customerId,
|
|
21
|
+
}).deriveUrl();
|
|
22
|
+
const response = await this.client.post(urlWithPathParams, createBusinessParameters);
|
|
23
|
+
const data = this.handleResponse(response);
|
|
24
|
+
return new Business(data);
|
|
36
25
|
}
|
|
37
|
-
get(customerId, businessId) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return new Business(data);
|
|
46
|
-
});
|
|
26
|
+
async get(customerId, businessId) {
|
|
27
|
+
const urlWithPathParams = new PathParameters(BusinessPaths.get, {
|
|
28
|
+
customer_id: customerId,
|
|
29
|
+
business_id: businessId,
|
|
30
|
+
}).deriveUrl();
|
|
31
|
+
const response = await this.client.get(urlWithPathParams);
|
|
32
|
+
const data = this.handleResponse(response);
|
|
33
|
+
return new Business(data);
|
|
47
34
|
}
|
|
48
|
-
update(customerId, businessId, updateBusiness) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return new Business(data);
|
|
57
|
-
});
|
|
35
|
+
async update(customerId, businessId, updateBusiness) {
|
|
36
|
+
const urlWithPathParams = new PathParameters(BusinessPaths.update, {
|
|
37
|
+
customer_id: customerId,
|
|
38
|
+
business_id: businessId,
|
|
39
|
+
}).deriveUrl();
|
|
40
|
+
const response = await this.client.patch(urlWithPathParams, updateBusiness);
|
|
41
|
+
const data = this.handleResponse(response);
|
|
42
|
+
return new Business(data);
|
|
58
43
|
}
|
|
59
|
-
archive(customerId, businessId) {
|
|
60
|
-
return
|
|
61
|
-
return yield this.update(customerId, businessId, { status: 'archived' });
|
|
62
|
-
});
|
|
44
|
+
async archive(customerId, businessId) {
|
|
45
|
+
return await this.update(customerId, businessId, { status: 'archived' });
|
|
63
46
|
}
|
|
64
47
|
}
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { CustomerPortalSession } from '../../entities/index.js';
|
|
11
2
|
import { BaseResource, PathParameters } from '../../internal/base/index.js';
|
|
12
3
|
const CustomerPortalSessionPaths = {
|
|
13
4
|
create: '/customers/{customer_id}/portal-sessions',
|
|
14
5
|
};
|
|
15
6
|
export class CustomerPortalSessionsResource extends BaseResource {
|
|
16
|
-
create(customerId, subscriptionIds) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
subscriptionIds,
|
|
23
|
-
});
|
|
24
|
-
const data = this.handleResponse(response);
|
|
25
|
-
return new CustomerPortalSession(data);
|
|
7
|
+
async create(customerId, subscriptionIds) {
|
|
8
|
+
const urlWithPathParams = new PathParameters(CustomerPortalSessionPaths.create, {
|
|
9
|
+
customer_id: customerId,
|
|
10
|
+
}).deriveUrl();
|
|
11
|
+
const response = await this.client.post(urlWithPathParams, {
|
|
12
|
+
subscriptionIds,
|
|
26
13
|
});
|
|
14
|
+
const data = this.handleResponse(response);
|
|
15
|
+
return new CustomerPortalSession(data);
|
|
27
16
|
}
|
|
28
17
|
}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
import { BaseResource, PathParameters, QueryParameters } from '../../internal/base/index.js';
|
|
11
2
|
import { CreditBalance, Customer, CustomerCollection, AuthToken } from '../../entities/index.js';
|
|
12
3
|
const CustomerPaths = {
|
|
@@ -23,57 +14,45 @@ export class CustomersResource extends BaseResource {
|
|
|
23
14
|
const queryParameters = new QueryParameters(queryParams);
|
|
24
15
|
return new CustomerCollection(this.client, CustomerPaths.list + queryParameters.toQueryString());
|
|
25
16
|
}
|
|
26
|
-
create(createCustomerParameters) {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return new Customer(data);
|
|
31
|
-
});
|
|
17
|
+
async create(createCustomerParameters) {
|
|
18
|
+
const response = await this.client.post(CustomerPaths.create, createCustomerParameters);
|
|
19
|
+
const data = this.handleResponse(response);
|
|
20
|
+
return new Customer(data);
|
|
32
21
|
}
|
|
33
|
-
get(customerId) {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return new Customer(data);
|
|
41
|
-
});
|
|
22
|
+
async get(customerId) {
|
|
23
|
+
const urlWithPathParams = new PathParameters(CustomerPaths.get, {
|
|
24
|
+
customer_id: customerId,
|
|
25
|
+
}).deriveUrl();
|
|
26
|
+
const response = await this.client.get(urlWithPathParams);
|
|
27
|
+
const data = this.handleResponse(response);
|
|
28
|
+
return new Customer(data);
|
|
42
29
|
}
|
|
43
|
-
update(customerId, updateCustomer) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return new Customer(data);
|
|
51
|
-
});
|
|
30
|
+
async update(customerId, updateCustomer) {
|
|
31
|
+
const urlWithPathParams = new PathParameters(CustomerPaths.update, {
|
|
32
|
+
customer_id: customerId,
|
|
33
|
+
}).deriveUrl();
|
|
34
|
+
const response = await this.client.patch(urlWithPathParams, updateCustomer);
|
|
35
|
+
const data = this.handleResponse(response);
|
|
36
|
+
return new Customer(data);
|
|
52
37
|
}
|
|
53
|
-
getCreditBalance(customerId, queryParams) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
return data.map((balance) => new CreditBalance(balance));
|
|
62
|
-
});
|
|
38
|
+
async getCreditBalance(customerId, queryParams) {
|
|
39
|
+
const urlWithPathParams = new PathParameters(CustomerPaths.getCustomerBalance, {
|
|
40
|
+
customer_id: customerId,
|
|
41
|
+
}).deriveUrl();
|
|
42
|
+
const queryParameters = new QueryParameters(queryParams);
|
|
43
|
+
const response = await this.client.get(urlWithPathParams, queryParameters);
|
|
44
|
+
const data = this.handleResponse(response);
|
|
45
|
+
return data.map((balance) => new CreditBalance(balance));
|
|
63
46
|
}
|
|
64
|
-
archive(customerId) {
|
|
65
|
-
return
|
|
66
|
-
return yield this.update(customerId, { status: 'archived' });
|
|
67
|
-
});
|
|
47
|
+
async archive(customerId) {
|
|
48
|
+
return await this.update(customerId, { status: 'archived' });
|
|
68
49
|
}
|
|
69
|
-
generateAuthToken(customerId) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
return new AuthToken(data);
|
|
77
|
-
});
|
|
50
|
+
async generateAuthToken(customerId) {
|
|
51
|
+
const urlWithPathParams = new PathParameters(CustomerPaths.generate, {
|
|
52
|
+
customer_id: customerId,
|
|
53
|
+
}).deriveUrl();
|
|
54
|
+
const response = await this.client.post(urlWithPathParams, undefined);
|
|
55
|
+
const data = this.handleResponse(response);
|
|
56
|
+
return new AuthToken(data);
|
|
78
57
|
}
|
|
79
58
|
}
|