@paddle/paddle-node-sdk 0.1.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/LICENSE +201 -0
- package/README.md +270 -0
- package/dist/entities/address/address-collection.d.ts +6 -0
- package/dist/entities/address/address-collection.js +11 -0
- package/dist/entities/address/address.d.ts +19 -0
- package/dist/entities/address/address.js +36 -0
- package/dist/entities/address/index.d.ts +2 -0
- package/dist/entities/address/index.js +18 -0
- package/dist/entities/adjustment/adjustment-collection.d.ts +6 -0
- package/dist/entities/adjustment/adjustment-collection.js +11 -0
- package/dist/entities/adjustment/adjustment-item-totals.d.ts +8 -0
- package/dist/entities/adjustment/adjustment-item-totals.js +18 -0
- package/dist/entities/adjustment/adjustment-item.d.ts +13 -0
- package/dist/entities/adjustment/adjustment-item.js +25 -0
- package/dist/entities/adjustment/adjustment-proration.d.ts +8 -0
- package/dist/entities/adjustment/adjustment-proration.js +19 -0
- package/dist/entities/adjustment/adjustment-time-period.d.ts +7 -0
- package/dist/entities/adjustment/adjustment-time-period.js +16 -0
- package/dist/entities/adjustment/adjustment.d.ts +21 -0
- package/dist/entities/adjustment/adjustment.js +41 -0
- package/dist/entities/adjustment/index.d.ts +6 -0
- package/dist/entities/adjustment/index.js +22 -0
- package/dist/entities/business/business-collection.d.ts +6 -0
- package/dist/entities/business/business-collection.js +11 -0
- package/dist/entities/business/business.d.ts +16 -0
- package/dist/entities/business/business.js +31 -0
- package/dist/entities/business/contacts.d.ts +7 -0
- package/dist/entities/business/contacts.js +16 -0
- package/dist/entities/business/index.d.ts +3 -0
- package/dist/entities/business/index.js +19 -0
- package/dist/entities/customer/customer-collection.d.ts +6 -0
- package/dist/entities/customer/customer-collection.js +11 -0
- package/dist/entities/customer/customer.d.ts +16 -0
- package/dist/entities/customer/customer.js +30 -0
- package/dist/entities/customer/index.d.ts +2 -0
- package/dist/entities/customer/index.js +18 -0
- package/dist/entities/discount/discount-collection.d.ts +6 -0
- package/dist/entities/discount/discount-collection.js +11 -0
- package/dist/entities/discount/discount.d.ts +22 -0
- package/dist/entities/discount/discount.js +44 -0
- package/dist/entities/discount/index.d.ts +2 -0
- package/dist/entities/discount/index.js +18 -0
- package/dist/entities/index.d.ts +12 -0
- package/dist/entities/index.js +26 -0
- package/dist/entities/price/index.d.ts +4 -0
- package/dist/entities/price/index.js +20 -0
- package/dist/entities/price/price-collection.d.ts +6 -0
- package/dist/entities/price/price-collection.js +11 -0
- package/dist/entities/price/price-quantity.d.ts +7 -0
- package/dist/entities/price/price-quantity.js +16 -0
- package/dist/entities/price/price-with-includes.d.ts +19 -0
- package/dist/entities/price/price-with-includes.js +37 -0
- package/dist/entities/price/price.d.ts +18 -0
- package/dist/entities/price/price.js +35 -0
- package/dist/entities/product/index.d.ts +3 -0
- package/dist/entities/product/index.js +19 -0
- package/dist/entities/product/product-collection.d.ts +6 -0
- package/dist/entities/product/product-collection.js +11 -0
- package/dist/entities/product/product-with-includes.d.ts +16 -0
- package/dist/entities/product/product-with-includes.js +32 -0
- package/dist/entities/product/product.d.ts +15 -0
- package/dist/entities/product/product.js +28 -0
- package/dist/entities/shared/adjustment-original-amount.d.ts +8 -0
- package/dist/entities/shared/adjustment-original-amount.js +16 -0
- package/dist/entities/shared/billing-details.d.ts +10 -0
- package/dist/entities/shared/billing-details.js +21 -0
- package/dist/entities/shared/chargeback-fee.d.ts +8 -0
- package/dist/entities/shared/chargeback-fee.js +17 -0
- package/dist/entities/shared/index.d.ts +19 -0
- package/dist/entities/shared/index.js +35 -0
- package/dist/entities/shared/money.d.ts +8 -0
- package/dist/entities/shared/money.js +16 -0
- package/dist/entities/shared/payment-card.d.ts +11 -0
- package/dist/entities/shared/payment-card.js +22 -0
- package/dist/entities/shared/payment-method-details.d.ts +9 -0
- package/dist/entities/shared/payment-method-details.js +17 -0
- package/dist/entities/shared/payout-totals-adjustment.d.ts +14 -0
- package/dist/entities/shared/payout-totals-adjustment.js +29 -0
- package/dist/entities/shared/tax-rates-used.d.ts +8 -0
- package/dist/entities/shared/tax-rates-used.js +17 -0
- package/dist/entities/shared/time-period.d.ts +8 -0
- package/dist/entities/shared/time-period.js +16 -0
- package/dist/entities/shared/total-adjustments.d.ts +12 -0
- package/dist/entities/shared/total-adjustments.js +24 -0
- package/dist/entities/shared/totals.d.ts +9 -0
- package/dist/entities/shared/totals.js +20 -0
- package/dist/entities/shared/transaction-checkout.d.ts +6 -0
- package/dist/entities/shared/transaction-checkout.js +14 -0
- package/dist/entities/shared/transaction-payment-attempt.d.ts +15 -0
- package/dist/entities/shared/transaction-payment-attempt.js +31 -0
- package/dist/entities/shared/transaction-payout-totals-adjusted.d.ts +14 -0
- package/dist/entities/shared/transaction-payout-totals-adjusted.js +29 -0
- package/dist/entities/shared/transaction-payout-totals.d.ts +16 -0
- package/dist/entities/shared/transaction-payout-totals.js +32 -0
- package/dist/entities/shared/transaction-totals-adjusted.d.ts +13 -0
- package/dist/entities/shared/transaction-totals-adjusted.js +26 -0
- package/dist/entities/shared/transaction-totals.d.ts +16 -0
- package/dist/entities/shared/transaction-totals.js +32 -0
- package/dist/entities/shared/unit-price-override.d.ts +9 -0
- package/dist/entities/shared/unit-price-override.js +17 -0
- package/dist/entities/shared/unit-totals.d.ts +9 -0
- package/dist/entities/shared/unit-totals.js +20 -0
- package/dist/entities/subscription/index.d.ts +12 -0
- package/dist/entities/subscription/index.js +28 -0
- package/dist/entities/subscription/next-transaction.d.ts +9 -0
- package/dist/entities/subscription/next-transaction.js +19 -0
- package/dist/entities/subscription/subscription-collection.d.ts +6 -0
- package/dist/entities/subscription/subscription-collection.js +11 -0
- package/dist/entities/subscription/subscription-discount.d.ts +8 -0
- package/dist/entities/subscription/subscription-discount.js +18 -0
- package/dist/entities/subscription/subscription-includes.d.ts +31 -0
- package/dist/entities/subscription/subscription-includes.js +67 -0
- package/dist/entities/subscription/subscription-item.d.ts +16 -0
- package/dist/entities/subscription/subscription-item.js +33 -0
- package/dist/entities/subscription/subscription-management.d.ts +7 -0
- package/dist/entities/subscription/subscription-management.js +16 -0
- package/dist/entities/subscription/subscription-price.d.ts +14 -0
- package/dist/entities/subscription/subscription-price.js +27 -0
- package/dist/entities/subscription/subscription-scheduled-change.d.ts +9 -0
- package/dist/entities/subscription/subscription-scheduled-change.js +18 -0
- package/dist/entities/subscription/subscription-time-period.d.ts +7 -0
- package/dist/entities/subscription/subscription-time-period.js +16 -0
- package/dist/entities/subscription/subscription.d.ts +29 -0
- package/dist/entities/subscription/subscription.js +61 -0
- package/dist/entities/subscription/transaction-details-preview.d.ts +9 -0
- package/dist/entities/subscription/transaction-details-preview.js +19 -0
- package/dist/entities/subscription/transaction-line-item-preview.d.ts +12 -0
- package/dist/entities/subscription/transaction-line-item-preview.js +25 -0
- package/dist/entities/transaction/adjustment-totals-breakdown.d.ts +8 -0
- package/dist/entities/transaction/adjustment-totals-breakdown.js +18 -0
- package/dist/entities/transaction/adjustment-totals.d.ts +14 -0
- package/dist/entities/transaction/adjustment-totals.js +27 -0
- package/dist/entities/transaction/index.d.ts +12 -0
- package/dist/entities/transaction/index.js +28 -0
- package/dist/entities/transaction/transaction-adjustment-item.d.ts +13 -0
- package/dist/entities/transaction/transaction-adjustment-item.js +29 -0
- package/dist/entities/transaction/transaction-adjustment.d.ts +21 -0
- package/dist/entities/transaction/transaction-adjustment.js +41 -0
- package/dist/entities/transaction/transaction-collection.d.ts +6 -0
- package/dist/entities/transaction/transaction-collection.js +11 -0
- package/dist/entities/transaction/transaction-details.d.ts +12 -0
- package/dist/entities/transaction/transaction-details.js +31 -0
- package/dist/entities/transaction/transaction-includes.d.ts +35 -0
- package/dist/entities/transaction/transaction-includes.js +74 -0
- package/dist/entities/transaction/transaction-item.d.ts +10 -0
- package/dist/entities/transaction/transaction-item.js +21 -0
- package/dist/entities/transaction/transaction-line-item.d.ts +14 -0
- package/dist/entities/transaction/transaction-line-item.js +31 -0
- package/dist/entities/transaction/transaction-proration.d.ts +8 -0
- package/dist/entities/transaction/transaction-proration.js +19 -0
- package/dist/entities/transaction/transaction.d.ts +29 -0
- package/dist/entities/transaction/transaction.js +59 -0
- package/dist/entities/transaction/transactions-time-period.d.ts +7 -0
- package/dist/entities/transaction/transactions-time-period.js +16 -0
- package/dist/enums/adjustment/adjustment-action.d.ts +1 -0
- package/dist/enums/adjustment/adjustment-action.js +2 -0
- package/dist/enums/adjustment/adjustment-currency-code.d.ts +1 -0
- package/dist/enums/adjustment/adjustment-currency-code.js +2 -0
- package/dist/enums/adjustment/adjustment-status.d.ts +1 -0
- package/dist/enums/adjustment/adjustment-status.js +2 -0
- package/dist/enums/adjustment/adjustment-type.d.ts +1 -0
- package/dist/enums/adjustment/adjustment-type.js +2 -0
- package/dist/enums/adjustment/index.d.ts +4 -0
- package/dist/enums/adjustment/index.js +20 -0
- package/dist/enums/discount/discount-status.d.ts +1 -0
- package/dist/enums/discount/discount-status.js +2 -0
- package/dist/enums/discount/discount-type.d.ts +1 -0
- package/dist/enums/discount/discount-type.js +2 -0
- package/dist/enums/discount/index.d.ts +2 -0
- package/dist/enums/discount/index.js +18 -0
- package/dist/enums/index.d.ts +5 -0
- package/dist/enums/index.js +21 -0
- package/dist/enums/shared/collection-mode.d.ts +1 -0
- package/dist/enums/shared/collection-mode.js +2 -0
- package/dist/enums/shared/country-code.d.ts +1 -0
- package/dist/enums/shared/country-code.js +2 -0
- package/dist/enums/shared/currency-code.d.ts +1 -0
- package/dist/enums/shared/currency-code.js +2 -0
- package/dist/enums/shared/error-code.d.ts +1 -0
- package/dist/enums/shared/error-code.js +2 -0
- package/dist/enums/shared/index.d.ts +13 -0
- package/dist/enums/shared/index.js +29 -0
- package/dist/enums/shared/interval.d.ts +1 -0
- package/dist/enums/shared/interval.js +2 -0
- package/dist/enums/shared/payment-attempt-status.d.ts +1 -0
- package/dist/enums/shared/payment-attempt-status.js +2 -0
- package/dist/enums/shared/payment-type.d.ts +1 -0
- package/dist/enums/shared/payment-type.js +2 -0
- package/dist/enums/shared/payout-currency-code.d.ts +1 -0
- package/dist/enums/shared/payout-currency-code.js +2 -0
- package/dist/enums/shared/status.d.ts +1 -0
- package/dist/enums/shared/status.js +2 -0
- package/dist/enums/shared/tax-category.d.ts +1 -0
- package/dist/enums/shared/tax-category.js +2 -0
- package/dist/enums/shared/tax-mode.d.ts +1 -0
- package/dist/enums/shared/tax-mode.js +2 -0
- package/dist/enums/shared/transaction-origin.d.ts +1 -0
- package/dist/enums/shared/transaction-origin.js +2 -0
- package/dist/enums/shared/transaction-status.d.ts +1 -0
- package/dist/enums/shared/transaction-status.js +2 -0
- package/dist/enums/subscription/index.d.ts +5 -0
- package/dist/enums/subscription/index.js +21 -0
- package/dist/enums/subscription/proration-billing-mode.d.ts +1 -0
- package/dist/enums/subscription/proration-billing-mode.js +2 -0
- package/dist/enums/subscription/scheduled-change-action.d.ts +1 -0
- package/dist/enums/subscription/scheduled-change-action.js +2 -0
- package/dist/enums/subscription/subscription-effective-from.d.ts +1 -0
- package/dist/enums/subscription/subscription-effective-from.js +2 -0
- package/dist/enums/subscription/subscription-item-status.d.ts +1 -0
- package/dist/enums/subscription/subscription-item-status.js +2 -0
- package/dist/enums/subscription/subscription-status.d.ts +1 -0
- package/dist/enums/subscription/subscription-status.js +2 -0
- package/dist/enums/transaction/index.d.ts +1 -0
- package/dist/enums/transaction/index.js +17 -0
- package/dist/enums/transaction/payment-card-type.d.ts +1 -0
- package/dist/enums/transaction/payment-card-type.js +2 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +28 -0
- package/dist/internal/api/client.d.ts +13 -0
- package/dist/internal/api/client.js +69 -0
- package/dist/internal/api/constants.d.ts +2 -0
- package/dist/internal/api/constants.js +8 -0
- package/dist/internal/api/environment.d.ts +4 -0
- package/dist/internal/api/environment.js +8 -0
- package/dist/internal/base/base-resource.d.ts +8 -0
- package/dist/internal/base/base-resource.js +21 -0
- package/dist/internal/base/collection.d.ts +13 -0
- package/dist/internal/base/collection.js +65 -0
- package/dist/internal/base/index.d.ts +4 -0
- package/dist/internal/base/index.js +20 -0
- package/dist/internal/base/path-parameters.d.ts +6 -0
- package/dist/internal/base/path-parameters.js +20 -0
- package/dist/internal/base/query-parameters.d.ts +5 -0
- package/dist/internal/base/query-parameters.js +19 -0
- package/dist/internal/errors/generic.d.ts +12 -0
- package/dist/internal/errors/generic.js +25 -0
- package/dist/internal/index.d.ts +3 -0
- package/dist/internal/index.js +5 -0
- package/dist/internal/types/config.d.ts +4 -0
- package/dist/internal/types/config.js +2 -0
- package/dist/internal/types/response.d.ts +31 -0
- package/dist/internal/types/response.js +2 -0
- package/dist/notifications/index.d.ts +1 -0
- package/dist/notifications/index.js +17 -0
- package/dist/notifications/validator/notifications-validator.d.ts +5 -0
- package/dist/notifications/validator/notifications-validator.js +41 -0
- package/dist/paddle.d.ts +16 -0
- package/dist/paddle.js +24 -0
- package/dist/resources/addresses/index.d.ts +10 -0
- package/dist/resources/addresses/index.js +79 -0
- package/dist/resources/addresses/operations/create-address-path-parameters.d.ts +3 -0
- package/dist/resources/addresses/operations/create-address-path-parameters.js +2 -0
- package/dist/resources/addresses/operations/create-address-request-body.d.ts +12 -0
- package/dist/resources/addresses/operations/create-address-request-body.js +2 -0
- package/dist/resources/addresses/operations/get-address-path-parameters.d.ts +4 -0
- package/dist/resources/addresses/operations/get-address-path-parameters.js +2 -0
- package/dist/resources/addresses/operations/index.d.ts +7 -0
- package/dist/resources/addresses/operations/index.js +23 -0
- package/dist/resources/addresses/operations/list-address-path-parameters.d.ts +3 -0
- package/dist/resources/addresses/operations/list-address-path-parameters.js +2 -0
- package/dist/resources/addresses/operations/list-address-query-parameters.d.ts +9 -0
- package/dist/resources/addresses/operations/list-address-query-parameters.js +2 -0
- package/dist/resources/addresses/operations/update-address-path-parameters.d.ts +4 -0
- package/dist/resources/addresses/operations/update-address-path-parameters.js +2 -0
- package/dist/resources/addresses/operations/update-address-request-body.d.ts +13 -0
- package/dist/resources/addresses/operations/update-address-request-body.js +2 -0
- package/dist/resources/adjustments/index.d.ts +8 -0
- package/dist/resources/adjustments/index.js +49 -0
- package/dist/resources/adjustments/operations/create-adjustment-request-body.d.ts +12 -0
- package/dist/resources/adjustments/operations/create-adjustment-request-body.js +2 -0
- package/dist/resources/adjustments/operations/index.d.ts +2 -0
- package/dist/resources/adjustments/operations/index.js +18 -0
- package/dist/resources/adjustments/operations/list-adjustment-query-parameters.d.ts +12 -0
- package/dist/resources/adjustments/operations/list-adjustment-query-parameters.js +2 -0
- package/dist/resources/businesses/index.d.ts +10 -0
- package/dist/resources/businesses/index.js +79 -0
- package/dist/resources/businesses/operations/create-business-path-parameters.d.ts +3 -0
- package/dist/resources/businesses/operations/create-business-path-parameters.js +2 -0
- package/dist/resources/businesses/operations/create-business-request-body.d.ts +8 -0
- package/dist/resources/businesses/operations/create-business-request-body.js +2 -0
- package/dist/resources/businesses/operations/get-business-path-parameters.d.ts +4 -0
- package/dist/resources/businesses/operations/get-business-path-parameters.js +2 -0
- package/dist/resources/businesses/operations/index.d.ts +7 -0
- package/dist/resources/businesses/operations/index.js +23 -0
- package/dist/resources/businesses/operations/list-business-path-parameters.d.ts +3 -0
- package/dist/resources/businesses/operations/list-business-path-parameters.js +2 -0
- package/dist/resources/businesses/operations/list-business-query-parameters.d.ts +9 -0
- package/dist/resources/businesses/operations/list-business-query-parameters.js +2 -0
- package/dist/resources/businesses/operations/update-business-path-parameters.d.ts +4 -0
- package/dist/resources/businesses/operations/update-business-path-parameters.js +2 -0
- package/dist/resources/businesses/operations/update-business-request-body.d.ts +10 -0
- package/dist/resources/businesses/operations/update-business-request-body.js +2 -0
- package/dist/resources/customers/index.d.ts +10 -0
- package/dist/resources/customers/index.js +71 -0
- package/dist/resources/customers/operations/create-customer-request-body.d.ts +7 -0
- package/dist/resources/customers/operations/create-customer-request-body.js +2 -0
- package/dist/resources/customers/operations/get-customer-path-parameters.d.ts +3 -0
- package/dist/resources/customers/operations/get-customer-path-parameters.js +2 -0
- package/dist/resources/customers/operations/index.d.ts +5 -0
- package/dist/resources/customers/operations/index.js +21 -0
- package/dist/resources/customers/operations/list-customer-query-parameters.d.ts +9 -0
- package/dist/resources/customers/operations/list-customer-query-parameters.js +2 -0
- package/dist/resources/customers/operations/update-customer-path-parameters.d.ts +3 -0
- package/dist/resources/customers/operations/update-customer-path-parameters.js +2 -0
- package/dist/resources/customers/operations/update-customer-request-body.d.ts +9 -0
- package/dist/resources/customers/operations/update-customer-request-body.js +2 -0
- package/dist/resources/discounts/index.d.ts +10 -0
- package/dist/resources/discounts/index.js +71 -0
- package/dist/resources/discounts/operations/create-discount-request-body.d.ts +14 -0
- package/dist/resources/discounts/operations/create-discount-request-body.js +2 -0
- package/dist/resources/discounts/operations/get-discount-path-parameters.d.ts +3 -0
- package/dist/resources/discounts/operations/get-discount-path-parameters.js +2 -0
- package/dist/resources/discounts/operations/index.d.ts +5 -0
- package/dist/resources/discounts/operations/index.js +21 -0
- package/dist/resources/discounts/operations/list-discount-query-parameters.d.ts +9 -0
- package/dist/resources/discounts/operations/list-discount-query-parameters.js +2 -0
- package/dist/resources/discounts/operations/update-discount-path-parameters.d.ts +3 -0
- package/dist/resources/discounts/operations/update-discount-path-parameters.js +2 -0
- package/dist/resources/discounts/operations/update-discount-request-body.d.ts +15 -0
- package/dist/resources/discounts/operations/update-discount-request-body.js +2 -0
- package/dist/resources/index.d.ts +9 -0
- package/dist/resources/index.js +25 -0
- package/dist/resources/prices/index.d.ts +10 -0
- package/dist/resources/prices/index.js +72 -0
- package/dist/resources/prices/operations/create-price-request-body.d.ts +13 -0
- package/dist/resources/prices/operations/create-price-request-body.js +2 -0
- package/dist/resources/prices/operations/get-price-path-parameters.d.ts +3 -0
- package/dist/resources/prices/operations/get-price-path-parameters.js +2 -0
- package/dist/resources/prices/operations/get-price-query-parameters.d.ts +3 -0
- package/dist/resources/prices/operations/get-price-query-parameters.js +2 -0
- package/dist/resources/prices/operations/index.d.ts +6 -0
- package/dist/resources/prices/operations/index.js +22 -0
- package/dist/resources/prices/operations/list-price-query-parameters.d.ts +11 -0
- package/dist/resources/prices/operations/list-price-query-parameters.js +2 -0
- package/dist/resources/prices/operations/update-price-path-parameters.d.ts +3 -0
- package/dist/resources/prices/operations/update-price-path-parameters.js +2 -0
- package/dist/resources/prices/operations/update-price-request-body.d.ts +13 -0
- package/dist/resources/prices/operations/update-price-request-body.js +2 -0
- package/dist/resources/products/index.d.ts +10 -0
- package/dist/resources/products/index.js +72 -0
- package/dist/resources/products/operations/create-product-request-body.d.ts +9 -0
- package/dist/resources/products/operations/create-product-request-body.js +2 -0
- package/dist/resources/products/operations/get-product-path-parameters.d.ts +3 -0
- package/dist/resources/products/operations/get-product-path-parameters.js +2 -0
- package/dist/resources/products/operations/get-product-query-parameters.d.ts +3 -0
- package/dist/resources/products/operations/get-product-query-parameters.js +2 -0
- package/dist/resources/products/operations/index.d.ts +6 -0
- package/dist/resources/products/operations/index.js +22 -0
- package/dist/resources/products/operations/list-product-query-parameters.d.ts +10 -0
- package/dist/resources/products/operations/list-product-query-parameters.js +2 -0
- package/dist/resources/products/operations/update-product-path-parameters.d.ts +3 -0
- package/dist/resources/products/operations/update-product-path-parameters.js +2 -0
- package/dist/resources/products/operations/update-product-request-body.d.ts +10 -0
- package/dist/resources/products/operations/update-product-request-body.js +2 -0
- package/dist/resources/subscriptions/index.d.ts +9 -0
- package/dist/resources/subscriptions/index.js +64 -0
- package/dist/resources/subscriptions/operations/get-subscription-path-parameters.d.ts +3 -0
- package/dist/resources/subscriptions/operations/get-subscription-path-parameters.js +2 -0
- package/dist/resources/subscriptions/operations/get-subscription-query-parameters.d.ts +3 -0
- package/dist/resources/subscriptions/operations/get-subscription-query-parameters.js +2 -0
- package/dist/resources/subscriptions/operations/index.d.ts +5 -0
- package/dist/resources/subscriptions/operations/index.js +21 -0
- package/dist/resources/subscriptions/operations/list-subscription-query-parameters.d.ts +13 -0
- package/dist/resources/subscriptions/operations/list-subscription-query-parameters.js +2 -0
- package/dist/resources/subscriptions/operations/update-subscription-path-parameters.d.ts +3 -0
- package/dist/resources/subscriptions/operations/update-subscription-path-parameters.js +2 -0
- package/dist/resources/subscriptions/operations/update-subscription-request-body.d.ts +16 -0
- package/dist/resources/subscriptions/operations/update-subscription-request-body.js +2 -0
- package/dist/resources/transactions/index.d.ts +10 -0
- package/dist/resources/transactions/index.js +73 -0
- package/dist/resources/transactions/operations/create-transaction-query-parameters.d.ts +3 -0
- package/dist/resources/transactions/operations/create-transaction-query-parameters.js +2 -0
- package/dist/resources/transactions/operations/create-transaction-request-body.d.ts +21 -0
- package/dist/resources/transactions/operations/create-transaction-request-body.js +2 -0
- package/dist/resources/transactions/operations/get-transaction-path-parameters.d.ts +3 -0
- package/dist/resources/transactions/operations/get-transaction-path-parameters.js +2 -0
- package/dist/resources/transactions/operations/get-transaction-query-parameters.d.ts +3 -0
- package/dist/resources/transactions/operations/get-transaction-query-parameters.js +2 -0
- package/dist/resources/transactions/operations/index.d.ts +7 -0
- package/dist/resources/transactions/operations/index.js +23 -0
- package/dist/resources/transactions/operations/list-transaction-query-parameters.d.ts +16 -0
- package/dist/resources/transactions/operations/list-transaction-query-parameters.js +2 -0
- package/dist/resources/transactions/operations/update-transaction-path-parameters.d.ts +3 -0
- package/dist/resources/transactions/operations/update-transaction-path-parameters.js +2 -0
- package/dist/resources/transactions/operations/update-transaction-request-body.d.ts +21 -0
- package/dist/resources/transactions/operations/update-transaction-request-body.js +2 -0
- package/dist/types/address/address.d.ts +16 -0
- package/dist/types/address/address.js +2 -0
- package/dist/types/address/index.d.ts +1 -0
- package/dist/types/address/index.js +17 -0
- package/dist/types/adjustment/adjustment-item.d.ts +10 -0
- package/dist/types/adjustment/adjustment-item.js +2 -0
- package/dist/types/adjustment/adjustment.d.ts +18 -0
- package/dist/types/adjustment/adjustment.js +2 -0
- package/dist/types/adjustment/adjustments-proration.d.ts +5 -0
- package/dist/types/adjustment/adjustments-proration.js +2 -0
- package/dist/types/adjustment/adjustments-time-period.d.ts +4 -0
- package/dist/types/adjustment/adjustments-time-period.js +2 -0
- package/dist/types/adjustment/index.d.ts +4 -0
- package/dist/types/adjustment/index.js +20 -0
- package/dist/types/business/business.d.ts +13 -0
- package/dist/types/business/business.js +2 -0
- package/dist/types/business/businesses-contacts.d.ts +4 -0
- package/dist/types/business/businesses-contacts.js +2 -0
- package/dist/types/business/index.d.ts +2 -0
- package/dist/types/business/index.js +18 -0
- package/dist/types/customer/customer.d.ts +13 -0
- package/dist/types/customer/customer.js +2 -0
- package/dist/types/customer/index.d.ts +1 -0
- package/dist/types/customer/index.js +17 -0
- package/dist/types/discount/discount.d.ts +19 -0
- package/dist/types/discount/discount.js +2 -0
- package/dist/types/discount/index.d.ts +1 -0
- package/dist/types/discount/index.js +17 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/index.js +26 -0
- package/dist/types/price/index.d.ts +1 -0
- package/dist/types/price/index.js +17 -0
- package/dist/types/price/price.d.ts +16 -0
- package/dist/types/price/price.js +2 -0
- package/dist/types/product/index.d.ts +1 -0
- package/dist/types/product/index.js +17 -0
- package/dist/types/product/product.d.ts +13 -0
- package/dist/types/product/product.js +2 -0
- package/dist/types/shared/adjustment-item-totals.d.ts +5 -0
- package/dist/types/shared/adjustment-item-totals.js +2 -0
- package/dist/types/shared/adjustment-original-amount.d.ts +5 -0
- package/dist/types/shared/adjustment-original-amount.js +2 -0
- package/dist/types/shared/billing-details-update.d.ts +7 -0
- package/dist/types/shared/billing-details-update.js +2 -0
- package/dist/types/shared/billing-details.d.ts +7 -0
- package/dist/types/shared/billing-details.js +2 -0
- package/dist/types/shared/chargeback-fee.d.ts +5 -0
- package/dist/types/shared/chargeback-fee.js +2 -0
- package/dist/types/shared/custom-data.d.ts +1 -0
- package/dist/types/shared/custom-data.js +2 -0
- package/dist/types/shared/index.d.ts +27 -0
- package/dist/types/shared/index.js +43 -0
- package/dist/types/shared/money.d.ts +5 -0
- package/dist/types/shared/money.js +2 -0
- package/dist/types/shared/payment-card.d.ts +8 -0
- package/dist/types/shared/payment-card.js +2 -0
- package/dist/types/shared/payment-method-details.d.ts +6 -0
- package/dist/types/shared/payment-method-details.js +2 -0
- package/dist/types/shared/payout-totals-adjustment.d.ts +11 -0
- package/dist/types/shared/payout-totals-adjustment.js +2 -0
- package/dist/types/shared/price-quantity.d.ts +4 -0
- package/dist/types/shared/price-quantity.js +2 -0
- package/dist/types/shared/shared-price.d.ts +15 -0
- package/dist/types/shared/shared-price.js +2 -0
- package/dist/types/shared/shared-product.d.ts +12 -0
- package/dist/types/shared/shared-product.js +2 -0
- package/dist/types/shared/tax-rates-used.d.ts +5 -0
- package/dist/types/shared/tax-rates-used.js +2 -0
- package/dist/types/shared/time-period.d.ts +5 -0
- package/dist/types/shared/time-period.js +2 -0
- package/dist/types/shared/total-adjustments.d.ts +9 -0
- package/dist/types/shared/total-adjustments.js +2 -0
- package/dist/types/shared/totals.d.ts +6 -0
- package/dist/types/shared/totals.js +2 -0
- package/dist/types/shared/transaction-checkout.d.ts +3 -0
- package/dist/types/shared/transaction-checkout.js +2 -0
- package/dist/types/shared/transaction-details-preview.d.ts +6 -0
- package/dist/types/shared/transaction-details-preview.js +2 -0
- package/dist/types/shared/transaction-line-item-preview.d.ts +9 -0
- package/dist/types/shared/transaction-line-item-preview.js +2 -0
- package/dist/types/shared/transaction-payment-attempt.d.ts +12 -0
- package/dist/types/shared/transaction-payment-attempt.js +2 -0
- package/dist/types/shared/transaction-payout-totals-adjusted.d.ts +11 -0
- package/dist/types/shared/transaction-payout-totals-adjusted.js +2 -0
- package/dist/types/shared/transaction-payout-totals.d.ts +13 -0
- package/dist/types/shared/transaction-payout-totals.js +2 -0
- package/dist/types/shared/transaction-totals-adjusted.d.ts +10 -0
- package/dist/types/shared/transaction-totals-adjusted.js +2 -0
- package/dist/types/shared/transaction-totals.d.ts +13 -0
- package/dist/types/shared/transaction-totals.js +2 -0
- package/dist/types/shared/unit-price-override.d.ts +6 -0
- package/dist/types/shared/unit-price-override.js +2 -0
- package/dist/types/shared/unit-totals.d.ts +6 -0
- package/dist/types/shared/unit-totals.js +2 -0
- package/dist/types/subscription/index.d.ts +10 -0
- package/dist/types/subscription/index.js +26 -0
- package/dist/types/subscription/next-transaction.d.ts +6 -0
- package/dist/types/subscription/next-transaction.js +2 -0
- package/dist/types/subscription/subscription-discount.d.ts +5 -0
- package/dist/types/subscription/subscription-discount.js +2 -0
- package/dist/types/subscription/subscription-item.d.ts +13 -0
- package/dist/types/subscription/subscription-item.js +2 -0
- package/dist/types/subscription/subscription-management.d.ts +4 -0
- package/dist/types/subscription/subscription-management.js +2 -0
- package/dist/types/subscription/subscription-price.d.ts +11 -0
- package/dist/types/subscription/subscription-price.js +2 -0
- package/dist/types/subscription/subscription-response.d.ts +28 -0
- package/dist/types/subscription/subscription-response.js +2 -0
- package/dist/types/subscription/subscription-scheduled-change.d.ts +6 -0
- package/dist/types/subscription/subscription-scheduled-change.js +2 -0
- package/dist/types/subscription/subscription-time-period.d.ts +4 -0
- package/dist/types/subscription/subscription-time-period.js +2 -0
- package/dist/types/subscription/subscription-update-item.d.ts +4 -0
- package/dist/types/subscription/subscription-update-item.js +2 -0
- package/dist/types/transaction/adjustment-totals-breakdown.d.ts +5 -0
- package/dist/types/transaction/adjustment-totals-breakdown.js +2 -0
- package/dist/types/transaction/adjustment-totals.d.ts +11 -0
- package/dist/types/transaction/adjustment-totals.js +2 -0
- package/dist/types/transaction/index.d.ts +10 -0
- package/dist/types/transaction/index.js +26 -0
- package/dist/types/transaction/transaction-adjustment-item.d.ts +10 -0
- package/dist/types/transaction/transaction-adjustment-item.js +2 -0
- package/dist/types/transaction/transaction-adjustment.d.ts +18 -0
- package/dist/types/transaction/transaction-adjustment.js +2 -0
- package/dist/types/transaction/transaction-details.d.ts +9 -0
- package/dist/types/transaction/transaction-details.js +2 -0
- package/dist/types/transaction/transaction-item.d.ts +7 -0
- package/dist/types/transaction/transaction-item.js +2 -0
- package/dist/types/transaction/transaction-line-item.d.ts +11 -0
- package/dist/types/transaction/transaction-line-item.js +2 -0
- package/dist/types/transaction/transaction-proration.d.ts +5 -0
- package/dist/types/transaction/transaction-proration.js +2 -0
- package/dist/types/transaction/transaction.d.ts +32 -0
- package/dist/types/transaction/transaction.js +2 -0
- package/dist/types/transaction/transactions-time-period.d.ts +4 -0
- package/dist/types/transaction/transactions-time-period.js +2 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +4 -0
- package/package.json +58 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type QueryParameters } from '../base';
|
|
2
|
+
import { type PaddleOptions } from '../types/config';
|
|
3
|
+
export declare class Client {
|
|
4
|
+
private readonly apiKey;
|
|
5
|
+
private readonly options;
|
|
6
|
+
private readonly baseUrl;
|
|
7
|
+
constructor(apiKey: string, options: PaddleOptions);
|
|
8
|
+
private getBaseUrl;
|
|
9
|
+
private getHeaders;
|
|
10
|
+
get<Q, R>(url: string, queryParams?: QueryParameters<Q>): Promise<R>;
|
|
11
|
+
post<B, R>(url: string, requestBody: B): Promise<R>;
|
|
12
|
+
patch<B, R>(url: string, requestBody: B): Promise<R>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.Client = void 0;
|
|
16
|
+
const constants_1 = require("./constants");
|
|
17
|
+
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
18
|
+
const version_1 = require("../../version");
|
|
19
|
+
const environment_1 = require("./environment");
|
|
20
|
+
class Client {
|
|
21
|
+
constructor(apiKey, options) {
|
|
22
|
+
this.apiKey = apiKey;
|
|
23
|
+
this.options = options;
|
|
24
|
+
this.baseUrl = this.getBaseUrl(this.options.environment);
|
|
25
|
+
}
|
|
26
|
+
getBaseUrl(environment) {
|
|
27
|
+
const urlBasedOnEnv = constants_1.API_ENVIRONMENT_TO_BASE_URL_MAP[environment !== null && environment !== void 0 ? environment : environment_1.Environment.production];
|
|
28
|
+
return urlBasedOnEnv || '';
|
|
29
|
+
}
|
|
30
|
+
getHeaders() {
|
|
31
|
+
return {
|
|
32
|
+
Authorization: `bearer ${this.apiKey}`,
|
|
33
|
+
'user-agent': `PaddleSDK/node ${version_1.SDK_VERSION}`,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
get(url, queryParams) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
let finalUrl = url.includes(this.baseUrl) ? url : `${this.baseUrl}${url}`;
|
|
39
|
+
if (!finalUrl.includes('?') && queryParams) {
|
|
40
|
+
finalUrl += queryParams.toQueryString();
|
|
41
|
+
}
|
|
42
|
+
const rawResponse = yield (0, node_fetch_1.default)(finalUrl, {
|
|
43
|
+
headers: this.getHeaders(),
|
|
44
|
+
});
|
|
45
|
+
return rawResponse.json();
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
post(url, requestBody) {
|
|
49
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const rawResponse = yield (0, node_fetch_1.default)(`${this.baseUrl}${url}`, {
|
|
51
|
+
method: 'POST',
|
|
52
|
+
body: JSON.stringify(requestBody),
|
|
53
|
+
headers: this.getHeaders(),
|
|
54
|
+
});
|
|
55
|
+
return rawResponse.json();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
patch(url, requestBody) {
|
|
59
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
60
|
+
const rawResponse = yield (0, node_fetch_1.default)(`${this.baseUrl}${url}`, {
|
|
61
|
+
method: 'PATCH',
|
|
62
|
+
body: JSON.stringify(requestBody),
|
|
63
|
+
headers: this.getHeaders(),
|
|
64
|
+
});
|
|
65
|
+
return rawResponse.json();
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.Client = Client;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.API_ENVIRONMENT_TO_BASE_URL_MAP = void 0;
|
|
4
|
+
const environment_1 = require("./environment");
|
|
5
|
+
exports.API_ENVIRONMENT_TO_BASE_URL_MAP = {
|
|
6
|
+
[environment_1.Environment.production]: 'https://api.paddle.com',
|
|
7
|
+
[environment_1.Environment.sandbox]: 'https://sandbox-api.paddle.com',
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Environment = void 0;
|
|
4
|
+
var Environment;
|
|
5
|
+
(function (Environment) {
|
|
6
|
+
Environment["sandbox"] = "sandbox";
|
|
7
|
+
Environment["production"] = "production";
|
|
8
|
+
})(Environment || (exports.Environment = Environment = {}));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Client } from '../api/client';
|
|
2
|
+
import { type ErrorResponse, type Response } from '../types/response';
|
|
3
|
+
export declare class BaseResource {
|
|
4
|
+
protected readonly client: Client;
|
|
5
|
+
constructor(client: Client);
|
|
6
|
+
protected handleError(error: ErrorResponse): void;
|
|
7
|
+
protected handleResponse<T>(response: Response<T> | ErrorResponse): T;
|
|
8
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BaseResource = void 0;
|
|
4
|
+
const generic_1 = require("../errors/generic");
|
|
5
|
+
class BaseResource {
|
|
6
|
+
constructor(client) {
|
|
7
|
+
this.client = client;
|
|
8
|
+
}
|
|
9
|
+
handleError(error) {
|
|
10
|
+
if (error.error) {
|
|
11
|
+
throw new generic_1.ApiError(error.error);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
handleResponse(response) {
|
|
15
|
+
const entityResponse = response;
|
|
16
|
+
const error = response;
|
|
17
|
+
this.handleError(error);
|
|
18
|
+
return entityResponse.data;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.BaseResource = BaseResource;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type Client } from '../api/client';
|
|
2
|
+
import { type ErrorResponse, type ResponsePaginated } from '../types/response';
|
|
3
|
+
export declare abstract class Collection<T, C> implements AsyncIterable<C> {
|
|
4
|
+
private readonly client;
|
|
5
|
+
private hasMore;
|
|
6
|
+
private nextLink;
|
|
7
|
+
private data;
|
|
8
|
+
constructor(client: Client, initialUri: string);
|
|
9
|
+
next(): Promise<C[]>;
|
|
10
|
+
protected handlePaginatedResponse<T>(response: ResponsePaginated<T> | ErrorResponse): ResponsePaginated<T>;
|
|
11
|
+
abstract fromJson(data: any): C;
|
|
12
|
+
[Symbol.asyncIterator](): AsyncIterator<C>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
12
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
13
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
14
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
15
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
16
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
17
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
18
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
19
|
+
function fulfill(value) { resume("next", value); }
|
|
20
|
+
function reject(value) { resume("throw", value); }
|
|
21
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.Collection = void 0;
|
|
25
|
+
const generic_1 = require("../errors/generic");
|
|
26
|
+
class Collection {
|
|
27
|
+
constructor(client, initialUri) {
|
|
28
|
+
this.client = client;
|
|
29
|
+
this.hasMore = true;
|
|
30
|
+
this.data = [];
|
|
31
|
+
this.nextLink = initialUri;
|
|
32
|
+
}
|
|
33
|
+
next() {
|
|
34
|
+
var _a;
|
|
35
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const response = yield this.client.get(this.nextLink);
|
|
37
|
+
const handledResponse = this.handlePaginatedResponse(response);
|
|
38
|
+
this.hasMore = (_a = handledResponse.meta.pagination.has_more) !== null && _a !== void 0 ? _a : false;
|
|
39
|
+
this.nextLink = handledResponse.meta.pagination.next;
|
|
40
|
+
this.data = handledResponse.data.map((data) => this.fromJson(data));
|
|
41
|
+
return this.data.length > 0 ? this.data : [];
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
handlePaginatedResponse(response) {
|
|
45
|
+
const entityResponse = response;
|
|
46
|
+
const error = response;
|
|
47
|
+
if (error.error) {
|
|
48
|
+
throw new generic_1.ApiError(error.error);
|
|
49
|
+
}
|
|
50
|
+
return entityResponse;
|
|
51
|
+
}
|
|
52
|
+
[Symbol.asyncIterator]() {
|
|
53
|
+
return __asyncGenerator(this, arguments, function* _a() {
|
|
54
|
+
while (this.hasMore) {
|
|
55
|
+
yield __await(this.next());
|
|
56
|
+
for (let index = 0; index < this.data.length; index++) {
|
|
57
|
+
if (this.data[index]) {
|
|
58
|
+
yield yield __await(this.data[index]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.Collection = Collection;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./base-resource"), exports);
|
|
18
|
+
__exportStar(require("./query-parameters"), exports);
|
|
19
|
+
__exportStar(require("./path-parameters"), exports);
|
|
20
|
+
__exportStar(require("./collection"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PathParameters = void 0;
|
|
4
|
+
class PathParameters {
|
|
5
|
+
constructor(url, pathParameters) {
|
|
6
|
+
this.url = url;
|
|
7
|
+
this.pathParameters = pathParameters;
|
|
8
|
+
}
|
|
9
|
+
deriveUrl() {
|
|
10
|
+
let updatedUrl = this.url;
|
|
11
|
+
for (const key in this.pathParameters) {
|
|
12
|
+
const value = this.pathParameters[key];
|
|
13
|
+
if (key && value) {
|
|
14
|
+
updatedUrl = updatedUrl.split(`{${key}}`).join(value.toString());
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return updatedUrl;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.PathParameters = PathParameters;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QueryParameters = void 0;
|
|
4
|
+
class QueryParameters {
|
|
5
|
+
constructor(queryParameters) {
|
|
6
|
+
this.queryParameters = queryParameters;
|
|
7
|
+
}
|
|
8
|
+
toQueryString() {
|
|
9
|
+
const urlSearchParam = new URLSearchParams();
|
|
10
|
+
for (const key in this.queryParameters) {
|
|
11
|
+
const value = this.queryParameters[key];
|
|
12
|
+
if (key && value) {
|
|
13
|
+
urlSearchParam.append(key, `${value}`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return '?' + urlSearchParam.toString();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.QueryParameters = QueryParameters;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ErrorDetail } from '../../internal';
|
|
2
|
+
export declare class ApiError extends Error {
|
|
3
|
+
private readonly type;
|
|
4
|
+
private readonly code;
|
|
5
|
+
private readonly detail;
|
|
6
|
+
private readonly documentationUrl;
|
|
7
|
+
constructor(errorDetail: ErrorDetail);
|
|
8
|
+
getType(): string;
|
|
9
|
+
getCode(): string;
|
|
10
|
+
getDetail(): string;
|
|
11
|
+
getDocumentation(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ApiError = void 0;
|
|
4
|
+
class ApiError extends Error {
|
|
5
|
+
constructor(errorDetail) {
|
|
6
|
+
super(errorDetail.detail);
|
|
7
|
+
this.type = errorDetail.type;
|
|
8
|
+
this.code = errorDetail.code;
|
|
9
|
+
this.detail = errorDetail.detail;
|
|
10
|
+
this.documentationUrl = errorDetail.documentationUrl;
|
|
11
|
+
}
|
|
12
|
+
getType() {
|
|
13
|
+
return this.type;
|
|
14
|
+
}
|
|
15
|
+
getCode() {
|
|
16
|
+
return this.code;
|
|
17
|
+
}
|
|
18
|
+
getDetail() {
|
|
19
|
+
return this.detail;
|
|
20
|
+
}
|
|
21
|
+
getDocumentation() {
|
|
22
|
+
return this.documentationUrl;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.ApiError = ApiError;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Environment = void 0;
|
|
4
|
+
var environment_1 = require("./api/environment");
|
|
5
|
+
Object.defineProperty(exports, "Environment", { enumerable: true, get: function () { return environment_1.Environment; } });
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface Pagination {
|
|
2
|
+
per_page: number;
|
|
3
|
+
next: string;
|
|
4
|
+
has_more: boolean;
|
|
5
|
+
estimated_total: number;
|
|
6
|
+
}
|
|
7
|
+
export interface Meta {
|
|
8
|
+
request_id: string;
|
|
9
|
+
}
|
|
10
|
+
export interface MetaPaginated {
|
|
11
|
+
request_id: string;
|
|
12
|
+
pagination: Pagination;
|
|
13
|
+
}
|
|
14
|
+
export interface Response<T> {
|
|
15
|
+
data: T;
|
|
16
|
+
meta: Meta;
|
|
17
|
+
}
|
|
18
|
+
export interface ResponsePaginated<T> {
|
|
19
|
+
data: T[];
|
|
20
|
+
meta: MetaPaginated;
|
|
21
|
+
}
|
|
22
|
+
export interface ErrorDetail {
|
|
23
|
+
type: string;
|
|
24
|
+
code: string;
|
|
25
|
+
detail: string;
|
|
26
|
+
documentationUrl: string;
|
|
27
|
+
}
|
|
28
|
+
export interface ErrorResponse {
|
|
29
|
+
error: ErrorDetail;
|
|
30
|
+
meta: Meta;
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './validator/notifications-validator';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./validator/notifications-validator"), exports);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotificationsValidator = void 0;
|
|
4
|
+
const crypto_1 = require("crypto");
|
|
5
|
+
class NotificationsValidator {
|
|
6
|
+
extractHeader(header) {
|
|
7
|
+
const parts = header.split(';');
|
|
8
|
+
let ts = '';
|
|
9
|
+
let h1 = '';
|
|
10
|
+
for (const part of parts) {
|
|
11
|
+
const [key, value] = part.split('=');
|
|
12
|
+
if (value) {
|
|
13
|
+
if (key === 'ts') {
|
|
14
|
+
ts = value;
|
|
15
|
+
}
|
|
16
|
+
else if (key === 'h1') {
|
|
17
|
+
h1 = value;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (ts && h1) {
|
|
22
|
+
return { ts: parseInt(ts), h1 };
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
throw new Error('Invalid paddle signature');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
isValidSignature(requestBody, secretKey, signature) {
|
|
29
|
+
const headers = this.extractHeader(signature);
|
|
30
|
+
const payloadWithTime = `${headers.ts}:${requestBody}`;
|
|
31
|
+
if (new Date().getTime() > new Date((headers.ts + NotificationsValidator.MAX_VALID_TIME_DIFFERENCE) * 1000).getTime()) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
const hmac = (0, crypto_1.createHmac)('sha256', secretKey);
|
|
35
|
+
hmac.update(payloadWithTime);
|
|
36
|
+
const computedHash = hmac.digest('hex');
|
|
37
|
+
return computedHash === headers.h1;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.NotificationsValidator = NotificationsValidator;
|
|
41
|
+
NotificationsValidator.MAX_VALID_TIME_DIFFERENCE = 5;
|
package/dist/paddle.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AddressesResource, AdjustmentsResource, BusinessesResource, CustomersResource, DiscountsResource, PricesResource, ProductsResource, SubscriptionsResource, TransactionsResource } from './resources';
|
|
2
|
+
import { type PaddleOptions } from './internal';
|
|
3
|
+
export declare class Paddle {
|
|
4
|
+
private readonly client;
|
|
5
|
+
private readonly defaultPaddleOptions;
|
|
6
|
+
products: ProductsResource;
|
|
7
|
+
prices: PricesResource;
|
|
8
|
+
transactions: TransactionsResource;
|
|
9
|
+
adjustments: AdjustmentsResource;
|
|
10
|
+
customers: CustomersResource;
|
|
11
|
+
addresses: AddressesResource;
|
|
12
|
+
businesses: BusinessesResource;
|
|
13
|
+
discounts: DiscountsResource;
|
|
14
|
+
subscriptions: SubscriptionsResource;
|
|
15
|
+
constructor(apiKey: string, options: PaddleOptions);
|
|
16
|
+
}
|
package/dist/paddle.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Paddle = void 0;
|
|
4
|
+
const client_1 = require("./internal/api/client");
|
|
5
|
+
const resources_1 = require("./resources");
|
|
6
|
+
const internal_1 = require("./internal");
|
|
7
|
+
class Paddle {
|
|
8
|
+
constructor(apiKey, options) {
|
|
9
|
+
this.defaultPaddleOptions = {
|
|
10
|
+
environment: internal_1.Environment.production,
|
|
11
|
+
};
|
|
12
|
+
this.client = new client_1.Client(apiKey, Object.assign(Object.assign({}, this.defaultPaddleOptions), options));
|
|
13
|
+
this.products = new resources_1.ProductsResource(this.client);
|
|
14
|
+
this.prices = new resources_1.PricesResource(this.client);
|
|
15
|
+
this.transactions = new resources_1.TransactionsResource(this.client);
|
|
16
|
+
this.adjustments = new resources_1.AdjustmentsResource(this.client);
|
|
17
|
+
this.customers = new resources_1.CustomersResource(this.client);
|
|
18
|
+
this.addresses = new resources_1.AddressesResource(this.client);
|
|
19
|
+
this.businesses = new resources_1.BusinessesResource(this.client);
|
|
20
|
+
this.discounts = new resources_1.DiscountsResource(this.client);
|
|
21
|
+
this.subscriptions = new resources_1.SubscriptionsResource(this.client);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.Paddle = Paddle;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Address, AddressCollection } from '../../entities';
|
|
2
|
+
import { BaseResource } from '../../internal/base';
|
|
3
|
+
import { type ListAddressQueryParameters, type CreateAddressRequestBody, type UpdateAddressRequestBody } from './operations';
|
|
4
|
+
export * from './operations';
|
|
5
|
+
export declare class AddressesResource extends BaseResource {
|
|
6
|
+
list(customerId: string, queryParams?: ListAddressQueryParameters): Promise<AddressCollection>;
|
|
7
|
+
create(customerId: string, createAddressParameters: CreateAddressRequestBody): Promise<Address>;
|
|
8
|
+
get(customerId: string, addressId: string): Promise<Address>;
|
|
9
|
+
update(customerId: string, addressId: string, updateProduct: UpdateAddressRequestBody): Promise<Address>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.AddressesResource = void 0;
|
|
27
|
+
const entities_1 = require("../../entities");
|
|
28
|
+
const base_1 = require("../../internal/base");
|
|
29
|
+
const AddressPaths = {
|
|
30
|
+
list: '/customers/{customer_id}/addresses',
|
|
31
|
+
create: '/customers/{customer_id}/addresses',
|
|
32
|
+
get: '/customers/{customer_id}/addresses/{address_id}',
|
|
33
|
+
update: '/customers/{customer_id}/addresses/{address_id}',
|
|
34
|
+
};
|
|
35
|
+
__exportStar(require("./operations"), exports);
|
|
36
|
+
class AddressesResource extends base_1.BaseResource {
|
|
37
|
+
list(customerId, queryParams) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const queryParameters = new base_1.QueryParameters(queryParams);
|
|
40
|
+
const urlWithPathParams = new base_1.PathParameters(AddressPaths.list, {
|
|
41
|
+
customer_id: customerId,
|
|
42
|
+
}).deriveUrl();
|
|
43
|
+
return new entities_1.AddressCollection(this.client, urlWithPathParams + queryParameters.toQueryString());
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
create(customerId, createAddressParameters) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const urlWithPathParams = new base_1.PathParameters(AddressPaths.create, {
|
|
49
|
+
customer_id: customerId,
|
|
50
|
+
}).deriveUrl();
|
|
51
|
+
const response = yield this.client.post(urlWithPathParams, createAddressParameters);
|
|
52
|
+
const data = this.handleResponse(response);
|
|
53
|
+
return new entities_1.Address(data);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
get(customerId, addressId) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const urlWithPathParams = new base_1.PathParameters(AddressPaths.get, {
|
|
59
|
+
customer_id: customerId,
|
|
60
|
+
address_id: addressId,
|
|
61
|
+
}).deriveUrl();
|
|
62
|
+
const response = yield this.client.get(urlWithPathParams);
|
|
63
|
+
const data = this.handleResponse(response);
|
|
64
|
+
return new entities_1.Address(data);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
update(customerId, addressId, updateProduct) {
|
|
68
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
+
const urlWithPathParams = new base_1.PathParameters(AddressPaths.update, {
|
|
70
|
+
customer_id: customerId,
|
|
71
|
+
address_id: addressId,
|
|
72
|
+
}).deriveUrl();
|
|
73
|
+
const response = yield this.client.patch(urlWithPathParams, updateProduct);
|
|
74
|
+
const data = this.handleResponse(response);
|
|
75
|
+
return new entities_1.Address(data);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.AddressesResource = AddressesResource;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ICustomData } from '../../../types';
|
|
2
|
+
import { type CountryCode } from '../../../enums';
|
|
3
|
+
export interface CreateAddressRequestBody {
|
|
4
|
+
country_code: CountryCode;
|
|
5
|
+
description?: string | undefined | null;
|
|
6
|
+
first_line?: string | undefined | null;
|
|
7
|
+
second_line?: string | undefined | null;
|
|
8
|
+
city?: string | undefined | null;
|
|
9
|
+
postal_code?: string | undefined | null;
|
|
10
|
+
region?: string | undefined | null;
|
|
11
|
+
custom_data?: ICustomData | undefined | null;
|
|
12
|
+
}
|