paddle-python-sdk 0.1.0__py3-none-any.whl
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.
- examples/__init__.py +0 -0
- examples/catalog_management.py +166 -0
- examples/event_polling.py +56 -0
- examples/get_products.py +46 -0
- examples/logger.py +31 -0
- paddle_billing/Client.py +201 -0
- paddle_billing/ConditionallyRemoveImportMeta.py +14 -0
- paddle_billing/Entities/Address.py +44 -0
- paddle_billing/Entities/Adjustment.py +45 -0
- paddle_billing/Entities/Adjustments/AdjustmentCustomerBalance.py +18 -0
- paddle_billing/Entities/Adjustments/AdjustmentItem.py +26 -0
- paddle_billing/Entities/Adjustments/__init__.py +2 -0
- paddle_billing/Entities/Business.py +38 -0
- paddle_billing/Entities/Collections/AddressCollection.py +18 -0
- paddle_billing/Entities/Collections/AdjustmentCollection.py +18 -0
- paddle_billing/Entities/Collections/BusinessCollection.py +18 -0
- paddle_billing/Entities/Collections/Collection.py +47 -0
- paddle_billing/Entities/Collections/CreditBalanceCollection.py +18 -0
- paddle_billing/Entities/Collections/CustomerCollection.py +18 -0
- paddle_billing/Entities/Collections/DiscountCollection.py +18 -0
- paddle_billing/Entities/Collections/EventCollection.py +18 -0
- paddle_billing/Entities/Collections/EventTypeCollection.py +18 -0
- paddle_billing/Entities/Collections/NotificationCollection.py +18 -0
- paddle_billing/Entities/Collections/NotificationLogCollection.py +18 -0
- paddle_billing/Entities/Collections/NotificationSettingCollection.py +18 -0
- paddle_billing/Entities/Collections/Paginator.py +29 -0
- paddle_billing/Entities/Collections/PriceCollection.py +18 -0
- paddle_billing/Entities/Collections/ProductCollection.py +18 -0
- paddle_billing/Entities/Collections/ReportCollection.py +18 -0
- paddle_billing/Entities/Collections/SubscriptionCollection.py +18 -0
- paddle_billing/Entities/Collections/SubscriptionPreviewCollection.py +18 -0
- paddle_billing/Entities/Collections/TransactionCollection.py +18 -0
- paddle_billing/Entities/Collections/TransactionPreviewCollection.py +18 -0
- paddle_billing/Entities/Collections/TransactionsDataCollection.py +18 -0
- paddle_billing/Entities/Collections/__init__.py +21 -0
- paddle_billing/Entities/CreditBalance.py +22 -0
- paddle_billing/Entities/Customer.py +36 -0
- paddle_billing/Entities/DateTime.py +43 -0
- paddle_billing/Entities/Discount.py +51 -0
- paddle_billing/Entities/Discounts/DiscountStatus.py +8 -0
- paddle_billing/Entities/Discounts/DiscountType.py +7 -0
- paddle_billing/Entities/Discounts/__init__.py +2 -0
- paddle_billing/Entities/Entity.py +12 -0
- paddle_billing/Entities/Event.py +51 -0
- paddle_billing/Entities/EventType.py +23 -0
- paddle_billing/Entities/Events/EventTypeName.py +52 -0
- paddle_billing/Entities/Events/__init__.py +1 -0
- paddle_billing/Entities/Notification.py +42 -0
- paddle_billing/Entities/NotificationLog.py +25 -0
- paddle_billing/Entities/NotificationSetting.py +34 -0
- paddle_billing/Entities/NotificationSettings/NotificationSettingType.py +6 -0
- paddle_billing/Entities/NotificationSettings/__init__.py +1 -0
- paddle_billing/Entities/Notifications/NotificationOrigin.py +6 -0
- paddle_billing/Entities/Notifications/NotificationPayout.py +24 -0
- paddle_billing/Entities/Notifications/NotificationPayoutStatus.py +6 -0
- paddle_billing/Entities/Notifications/NotificationStatus.py +8 -0
- paddle_billing/Entities/Notifications/__init__.py +4 -0
- paddle_billing/Entities/Price.py +68 -0
- paddle_billing/Entities/PricePreview.py +34 -0
- paddle_billing/Entities/PricingPreviews/PricePreviewDetails.py +15 -0
- paddle_billing/Entities/PricingPreviews/PricePreviewDiscounts.py +20 -0
- paddle_billing/Entities/PricingPreviews/PricePreviewItem.py +16 -0
- paddle_billing/Entities/PricingPreviews/PricePreviewLineItem.py +38 -0
- paddle_billing/Entities/PricingPreviews/PricePreviewTotalsFormatted.py +20 -0
- paddle_billing/Entities/PricingPreviews/PricePreviewUnitTotalsFormatted.py +20 -0
- paddle_billing/Entities/PricingPreviews/__init__.py +6 -0
- paddle_billing/Entities/Product.py +45 -0
- paddle_billing/Entities/Report.py +32 -0
- paddle_billing/Entities/ReportCSV.py +13 -0
- paddle_billing/Entities/Reports/ReportFilter.py +20 -0
- paddle_billing/Entities/Reports/ReportFilterName.py +17 -0
- paddle_billing/Entities/Reports/ReportFilterOperator.py +6 -0
- paddle_billing/Entities/Reports/ReportStatus.py +8 -0
- paddle_billing/Entities/Reports/ReportType.py +10 -0
- paddle_billing/Entities/Reports/__init__.py +5 -0
- paddle_billing/Entities/Shared/Action.py +10 -0
- paddle_billing/Entities/Shared/AddressPreview.py +18 -0
- paddle_billing/Entities/Shared/AdjustmentItemTotals.py +18 -0
- paddle_billing/Entities/Shared/AdjustmentProration.py +18 -0
- paddle_billing/Entities/Shared/AdjustmentStatus.py +8 -0
- paddle_billing/Entities/Shared/AdjustmentTimePeriod.py +17 -0
- paddle_billing/Entities/Shared/AdjustmentTotals.py +26 -0
- paddle_billing/Entities/Shared/AdjustmentType.py +8 -0
- paddle_billing/Entities/Shared/AvailablePaymentMethods.py +11 -0
- paddle_billing/Entities/Shared/BillingDetails.py +22 -0
- paddle_billing/Entities/Shared/BillingDetailsUpdate.py +22 -0
- paddle_billing/Entities/Shared/Card.py +24 -0
- paddle_billing/Entities/Shared/CatalogType.py +6 -0
- paddle_billing/Entities/Shared/ChargebackFee.py +18 -0
- paddle_billing/Entities/Shared/Checkout.py +12 -0
- paddle_billing/Entities/Shared/CollectionMode.py +6 -0
- paddle_billing/Entities/Shared/Contacts.py +16 -0
- paddle_billing/Entities/Shared/CountryCode.py +233 -0
- paddle_billing/Entities/Shared/CurrencyCode.py +34 -0
- paddle_billing/Entities/Shared/CurrencyCodeAdjustments.py +7 -0
- paddle_billing/Entities/Shared/CurrencyCodePayouts.py +17 -0
- paddle_billing/Entities/Shared/CustomData.py +10 -0
- paddle_billing/Entities/Shared/Data.py +9 -0
- paddle_billing/Entities/Shared/ErrorCode.py +21 -0
- paddle_billing/Entities/Shared/ImportMeta.py +16 -0
- paddle_billing/Entities/Shared/Interval.py +8 -0
- paddle_billing/Entities/Shared/Meta.py +7 -0
- paddle_billing/Entities/Shared/MetaPaginated.py +18 -0
- paddle_billing/Entities/Shared/MethodDetails.py +19 -0
- paddle_billing/Entities/Shared/Money.py +28 -0
- paddle_billing/Entities/Shared/Original.py +18 -0
- paddle_billing/Entities/Shared/Pagination.py +20 -0
- paddle_billing/Entities/Shared/PaymentAttemptStatus.py +13 -0
- paddle_billing/Entities/Shared/PaymentMethodType.py +14 -0
- paddle_billing/Entities/Shared/PayoutTotalsAdjustment.py +29 -0
- paddle_billing/Entities/Shared/PriceQuantity.py +16 -0
- paddle_billing/Entities/Shared/Status.py +6 -0
- paddle_billing/Entities/Shared/TaxCategory.py +13 -0
- paddle_billing/Entities/Shared/TaxMode.py +7 -0
- paddle_billing/Entities/Shared/TaxRatesUsed.py +18 -0
- paddle_billing/Entities/Shared/TimePeriod.py +18 -0
- paddle_billing/Entities/Shared/Totals.py +20 -0
- paddle_billing/Entities/Shared/TransactionDetailsPreview.py +22 -0
- paddle_billing/Entities/Shared/TransactionLineItemPreview.py +28 -0
- paddle_billing/Entities/Shared/TransactionOrigin.py +10 -0
- paddle_billing/Entities/Shared/TransactionPaymentAttempt.py +35 -0
- paddle_billing/Entities/Shared/TransactionPayoutTotals.py +36 -0
- paddle_billing/Entities/Shared/TransactionPayoutTotalsAdjusted.py +29 -0
- paddle_billing/Entities/Shared/TransactionStatus.py +11 -0
- paddle_billing/Entities/Shared/TransactionTotals.py +36 -0
- paddle_billing/Entities/Shared/TransactionTotalsAdjusted.py +28 -0
- paddle_billing/Entities/Shared/UnitPriceOverride.py +19 -0
- paddle_billing/Entities/Shared/UnitTotals.py +20 -0
- paddle_billing/Entities/Shared/__init__.py +56 -0
- paddle_billing/Entities/Subscription.py +86 -0
- paddle_billing/Entities/SubscriptionPreview.py +79 -0
- paddle_billing/Entities/Subscriptions/SubscriptionAdjustmentItem.py +24 -0
- paddle_billing/Entities/Subscriptions/SubscriptionAdjustmentPreview.py +22 -0
- paddle_billing/Entities/Subscriptions/SubscriptionCharge.py +18 -0
- paddle_billing/Entities/Subscriptions/SubscriptionCredit.py +18 -0
- paddle_billing/Entities/Subscriptions/SubscriptionDetails.py +34 -0
- paddle_billing/Entities/Subscriptions/SubscriptionDiscount.py +19 -0
- paddle_billing/Entities/Subscriptions/SubscriptionEffectiveFrom.py +6 -0
- paddle_billing/Entities/Subscriptions/SubscriptionItem.py +35 -0
- paddle_billing/Entities/Subscriptions/SubscriptionItemStatus.py +7 -0
- paddle_billing/Entities/Subscriptions/SubscriptionItems.py +20 -0
- paddle_billing/Entities/Subscriptions/SubscriptionItemsWithPrice.py +19 -0
- paddle_billing/Entities/Subscriptions/SubscriptionManagementUrls.py +16 -0
- paddle_billing/Entities/Subscriptions/SubscriptionNextTransaction.py +23 -0
- paddle_billing/Entities/Subscriptions/SubscriptionNonCatalogPrice.py +30 -0
- paddle_billing/Entities/Subscriptions/SubscriptionNonCatalogPriceWithProduct.py +32 -0
- paddle_billing/Entities/Subscriptions/SubscriptionNonCatalogProduct.py +26 -0
- paddle_billing/Entities/Subscriptions/SubscriptionOnPaymentFailure.py +6 -0
- paddle_billing/Entities/Subscriptions/SubscriptionPreviewSubscriptionUpdateSummary.py +22 -0
- paddle_billing/Entities/Subscriptions/SubscriptionPrice.py +28 -0
- paddle_billing/Entities/Subscriptions/SubscriptionProration.py +18 -0
- paddle_billing/Entities/Subscriptions/SubscriptionProrationBillingMode.py +9 -0
- paddle_billing/Entities/Subscriptions/SubscriptionResult.py +22 -0
- paddle_billing/Entities/Subscriptions/SubscriptionResultAction.py +6 -0
- paddle_billing/Entities/Subscriptions/SubscriptionResumeEffectiveFrom.py +5 -0
- paddle_billing/Entities/Subscriptions/SubscriptionScheduledChange.py +21 -0
- paddle_billing/Entities/Subscriptions/SubscriptionScheduledChangeAction.py +7 -0
- paddle_billing/Entities/Subscriptions/SubscriptionStatus.py +10 -0
- paddle_billing/Entities/Subscriptions/SubscriptionTimePeriod.py +17 -0
- paddle_billing/Entities/Subscriptions/SubscriptionTransactionItem.py +23 -0
- paddle_billing/Entities/Subscriptions/SubscriptionTransactionLineItem.py +33 -0
- paddle_billing/Entities/Subscriptions/SubscriptionUpdateItem.py +16 -0
- paddle_billing/Entities/Subscriptions/__init__.py +31 -0
- paddle_billing/Entities/Transaction.py +98 -0
- paddle_billing/Entities/TransactionData.py +15 -0
- paddle_billing/Entities/TransactionPreview.py +40 -0
- paddle_billing/Entities/Transactions/TransactionAdjustmentsTotals.py +30 -0
- paddle_billing/Entities/Transactions/TransactionBreakdown.py +18 -0
- paddle_billing/Entities/Transactions/TransactionCardType.py +14 -0
- paddle_billing/Entities/Transactions/TransactionCreateItem.py +16 -0
- paddle_billing/Entities/Transactions/TransactionCreateItemWithPrice.py +11 -0
- paddle_billing/Entities/Transactions/TransactionDetails.py +32 -0
- paddle_billing/Entities/Transactions/TransactionItem.py +24 -0
- paddle_billing/Entities/Transactions/TransactionItemPreviewWithNonCatalogPrice.py +21 -0
- paddle_billing/Entities/Transactions/TransactionItemPreviewWithPrice.py +24 -0
- paddle_billing/Entities/Transactions/TransactionItemPreviewWithPriceId.py +18 -0
- paddle_billing/Entities/Transactions/TransactionLineItem.py +35 -0
- paddle_billing/Entities/Transactions/TransactionNonCatalogPrice.py +39 -0
- paddle_billing/Entities/Transactions/TransactionNonCatalogPriceWithProduct.py +41 -0
- paddle_billing/Entities/Transactions/TransactionNonCatalogProduct.py +25 -0
- paddle_billing/Entities/Transactions/TransactionProration.py +18 -0
- paddle_billing/Entities/Transactions/TransactionTimePeriod.py +17 -0
- paddle_billing/Entities/Transactions/TransactionUpdateTransactionItem.py +8 -0
- paddle_billing/Entities/Transactions/__init__.py +20 -0
- paddle_billing/Entities/__init__.py +0 -0
- paddle_billing/EnumStringify.py +2 -0
- paddle_billing/Environment.py +14 -0
- paddle_billing/Exceptions/ApiError.py +28 -0
- paddle_billing/Exceptions/ApiErrors/AddressApiError.py +5 -0
- paddle_billing/Exceptions/ApiErrors/AdjustmentApiError.py +5 -0
- paddle_billing/Exceptions/ApiErrors/BusinessApiError.py +5 -0
- paddle_billing/Exceptions/ApiErrors/CustomerApiError.py +5 -0
- paddle_billing/Exceptions/ApiErrors/DiscountApiError.py +5 -0
- paddle_billing/Exceptions/ApiErrors/PriceApiError.py +5 -0
- paddle_billing/Exceptions/ApiErrors/ProductApiError.py +5 -0
- paddle_billing/Exceptions/ApiErrors/SubscriptionApiError.py +5 -0
- paddle_billing/Exceptions/ApiErrors/TransactionApiError.py +5 -0
- paddle_billing/Exceptions/ApiErrors/__init__.py +0 -0
- paddle_billing/Exceptions/FieldError.py +8 -0
- paddle_billing/Exceptions/SdkException.py +2 -0
- paddle_billing/Exceptions/SdkExceptions/InvalidArgumentException.py +8 -0
- paddle_billing/Exceptions/SdkExceptions/MalformedResponse.py +7 -0
- paddle_billing/Exceptions/SdkExceptions/__init__.py +0 -0
- paddle_billing/Exceptions/__init__.py +0 -0
- paddle_billing/FiltersNone.py +8 -0
- paddle_billing/FiltersUndefined.py +11 -0
- paddle_billing/HasParameters.py +11 -0
- paddle_billing/Logger/Formatter.py +18 -0
- paddle_billing/Logger/NullHandler.py +6 -0
- paddle_billing/Logger/__init__.py +30 -0
- paddle_billing/Notifications/Entities/Address.py +44 -0
- paddle_billing/Notifications/Entities/Adjustment.py +45 -0
- paddle_billing/Notifications/Entities/Adjustments/AdjustmentItem.py +26 -0
- paddle_billing/Notifications/Entities/Adjustments/__init__.py +1 -0
- paddle_billing/Notifications/Entities/Business.py +39 -0
- paddle_billing/Notifications/Entities/Businesses/BusinessesContacts.py +16 -0
- paddle_billing/Notifications/Entities/Businesses/__init__.py +1 -0
- paddle_billing/Notifications/Entities/Customer.py +36 -0
- paddle_billing/Notifications/Entities/DateTime.py +43 -0
- paddle_billing/Notifications/Entities/Discount.py +51 -0
- paddle_billing/Notifications/Entities/Discounts/DiscountStatus.py +8 -0
- paddle_billing/Notifications/Entities/Discounts/DiscountType.py +7 -0
- paddle_billing/Notifications/Entities/Discounts/__init__.py +2 -0
- paddle_billing/Notifications/Entities/Entity.py +12 -0
- paddle_billing/Notifications/Entities/Payout.py +24 -0
- paddle_billing/Notifications/Entities/Payouts/PayoutStatus.py +6 -0
- paddle_billing/Notifications/Entities/Payouts/__init__.py +1 -0
- paddle_billing/Notifications/Entities/Price.py +66 -0
- paddle_billing/Notifications/Entities/Product.py +45 -0
- paddle_billing/Notifications/Entities/Report.py +32 -0
- paddle_billing/Notifications/Entities/Reports/ReportFilter.py +20 -0
- paddle_billing/Notifications/Entities/Reports/ReportFilterName.py +17 -0
- paddle_billing/Notifications/Entities/Reports/ReportFilterOperator.py +6 -0
- paddle_billing/Notifications/Entities/Reports/ReportStatus.py +8 -0
- paddle_billing/Notifications/Entities/Reports/ReportType.py +10 -0
- paddle_billing/Notifications/Entities/Reports/__init__.py +5 -0
- paddle_billing/Notifications/Entities/Shared/Action.py +10 -0
- paddle_billing/Notifications/Entities/Shared/AddressPreview.py +18 -0
- paddle_billing/Notifications/Entities/Shared/AdjustmentItemTotals.py +18 -0
- paddle_billing/Notifications/Entities/Shared/AdjustmentProration.py +18 -0
- paddle_billing/Notifications/Entities/Shared/AdjustmentStatus.py +8 -0
- paddle_billing/Notifications/Entities/Shared/AdjustmentTimePeriod.py +17 -0
- paddle_billing/Notifications/Entities/Shared/AdjustmentTotals.py +26 -0
- paddle_billing/Notifications/Entities/Shared/AdjustmentType.py +8 -0
- paddle_billing/Notifications/Entities/Shared/AvailablePaymentMethods.py +11 -0
- paddle_billing/Notifications/Entities/Shared/BillingDetails.py +22 -0
- paddle_billing/Notifications/Entities/Shared/Card.py +24 -0
- paddle_billing/Notifications/Entities/Shared/CatalogType.py +6 -0
- paddle_billing/Notifications/Entities/Shared/ChargebackFee.py +18 -0
- paddle_billing/Notifications/Entities/Shared/Checkout.py +12 -0
- paddle_billing/Notifications/Entities/Shared/CollectionMode.py +6 -0
- paddle_billing/Notifications/Entities/Shared/CountryCode.py +233 -0
- paddle_billing/Notifications/Entities/Shared/CurrencyCode.py +34 -0
- paddle_billing/Notifications/Entities/Shared/CurrencyCodeAdjustments.py +7 -0
- paddle_billing/Notifications/Entities/Shared/CurrencyCodePayouts.py +17 -0
- paddle_billing/Notifications/Entities/Shared/CustomData.py +10 -0
- paddle_billing/Notifications/Entities/Shared/Data.py +9 -0
- paddle_billing/Notifications/Entities/Shared/ErrorCode.py +21 -0
- paddle_billing/Notifications/Entities/Shared/ImportMeta.py +16 -0
- paddle_billing/Notifications/Entities/Shared/Interval.py +8 -0
- paddle_billing/Notifications/Entities/Shared/MethodDetails.py +19 -0
- paddle_billing/Notifications/Entities/Shared/Money.py +28 -0
- paddle_billing/Notifications/Entities/Shared/Original.py +18 -0
- paddle_billing/Notifications/Entities/Shared/PaymentAttemptStatus.py +13 -0
- paddle_billing/Notifications/Entities/Shared/PaymentMethodType.py +15 -0
- paddle_billing/Notifications/Entities/Shared/PayoutTotalsAdjustment.py +29 -0
- paddle_billing/Notifications/Entities/Shared/PriceQuantity.py +16 -0
- paddle_billing/Notifications/Entities/Shared/Status.py +6 -0
- paddle_billing/Notifications/Entities/Shared/TaxCategory.py +13 -0
- paddle_billing/Notifications/Entities/Shared/TaxMode.py +7 -0
- paddle_billing/Notifications/Entities/Shared/TaxRatesUsed.py +18 -0
- paddle_billing/Notifications/Entities/Shared/TimePeriod.py +18 -0
- paddle_billing/Notifications/Entities/Shared/Totals.py +20 -0
- paddle_billing/Notifications/Entities/Shared/TransactionOrigin.py +10 -0
- paddle_billing/Notifications/Entities/Shared/TransactionPaymentAttempt.py +35 -0
- paddle_billing/Notifications/Entities/Shared/TransactionPayoutTotals.py +36 -0
- paddle_billing/Notifications/Entities/Shared/TransactionPayoutTotalsAdjusted.py +29 -0
- paddle_billing/Notifications/Entities/Shared/TransactionStatus.py +11 -0
- paddle_billing/Notifications/Entities/Shared/TransactionTotals.py +36 -0
- paddle_billing/Notifications/Entities/Shared/TransactionTotalsAdjusted.py +28 -0
- paddle_billing/Notifications/Entities/Shared/UnitPriceOverride.py +19 -0
- paddle_billing/Notifications/Entities/Shared/UnitTotals.py +20 -0
- paddle_billing/Notifications/Entities/Shared/__init__.py +46 -0
- paddle_billing/Notifications/Entities/Subscription.py +76 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionAdjustmentItem.py +24 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionCharge.py +18 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionCredit.py +18 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionDiscount.py +19 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionEffectiveFrom.py +6 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionItem.py +35 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionItemStatus.py +7 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionOnPaymentFailure.py +6 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionPrice.py +28 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionScheduledChange.py +21 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionScheduledChangeAction.py +7 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionStatus.py +10 -0
- paddle_billing/Notifications/Entities/Subscriptions/SubscriptionTimePeriod.py +17 -0
- paddle_billing/Notifications/Entities/Subscriptions/__init__.py +13 -0
- paddle_billing/Notifications/Entities/Transaction.py +75 -0
- paddle_billing/Notifications/Entities/Transactions/TransactionAdjustmentsTotals.py +30 -0
- paddle_billing/Notifications/Entities/Transactions/TransactionBreakdown.py +18 -0
- paddle_billing/Notifications/Entities/Transactions/TransactionCardType.py +14 -0
- paddle_billing/Notifications/Entities/Transactions/TransactionDetails.py +32 -0
- paddle_billing/Notifications/Entities/Transactions/TransactionItem.py +24 -0
- paddle_billing/Notifications/Entities/Transactions/TransactionLineItem.py +35 -0
- paddle_billing/Notifications/Entities/Transactions/TransactionProration.py +18 -0
- paddle_billing/Notifications/Entities/Transactions/TransactionTimePeriod.py +17 -0
- paddle_billing/Notifications/Entities/Transactions/__init__.py +11 -0
- paddle_billing/Notifications/Entities/__init__.py +0 -0
- paddle_billing/Notifications/Events/AddressCreated.py +17 -0
- paddle_billing/Notifications/Events/AddressUpdated.py +17 -0
- paddle_billing/Notifications/Events/AdjustmentCreated.py +17 -0
- paddle_billing/Notifications/Events/AdjustmentUpdated.py +17 -0
- paddle_billing/Notifications/Events/BusinessCreated.py +17 -0
- paddle_billing/Notifications/Events/BusinessUpdated.py +17 -0
- paddle_billing/Notifications/Events/CustomerCreated.py +17 -0
- paddle_billing/Notifications/Events/CustomerUpdated.py +17 -0
- paddle_billing/Notifications/Events/DiscountCreated.py +17 -0
- paddle_billing/Notifications/Events/DiscountImported.py +17 -0
- paddle_billing/Notifications/Events/DiscountUpdated.py +17 -0
- paddle_billing/Notifications/Events/PayoutCreated.py +17 -0
- paddle_billing/Notifications/Events/PayoutPaid.py +17 -0
- paddle_billing/Notifications/Events/PriceCreated.py +17 -0
- paddle_billing/Notifications/Events/PriceUpdated.py +17 -0
- paddle_billing/Notifications/Events/ProductCreated.py +17 -0
- paddle_billing/Notifications/Events/ProductUpdated.py +17 -0
- paddle_billing/Notifications/Events/ReportCreated.py +17 -0
- paddle_billing/Notifications/Events/ReportUpdated.py +17 -0
- paddle_billing/Notifications/Events/SubscriptionActivated.py +17 -0
- paddle_billing/Notifications/Events/SubscriptionCanceled.py +17 -0
- paddle_billing/Notifications/Events/SubscriptionCreated.py +17 -0
- paddle_billing/Notifications/Events/SubscriptionImported.py +17 -0
- paddle_billing/Notifications/Events/SubscriptionPastDue.py +17 -0
- paddle_billing/Notifications/Events/SubscriptionPaused.py +17 -0
- paddle_billing/Notifications/Events/SubscriptionResumed.py +17 -0
- paddle_billing/Notifications/Events/SubscriptionTrialing.py +17 -0
- paddle_billing/Notifications/Events/SubscriptionUpdated.py +17 -0
- paddle_billing/Notifications/Events/TransactionBilled.py +17 -0
- paddle_billing/Notifications/Events/TransactionCanceled.py +17 -0
- paddle_billing/Notifications/Events/TransactionCompleted.py +16 -0
- paddle_billing/Notifications/Events/TransactionCreated.py +17 -0
- paddle_billing/Notifications/Events/TransactionPaid.py +17 -0
- paddle_billing/Notifications/Events/TransactionPastDue.py +17 -0
- paddle_billing/Notifications/Events/TransactionPaymentFailed.py +17 -0
- paddle_billing/Notifications/Events/TransactionReady.py +17 -0
- paddle_billing/Notifications/Events/TransactionUpdated.py +17 -0
- paddle_billing/Notifications/Events/__init__.py +0 -0
- paddle_billing/Notifications/PaddleSignature.py +128 -0
- paddle_billing/Notifications/Secret.py +8 -0
- paddle_billing/Notifications/Verifier.py +55 -0
- paddle_billing/Notifications/__init__.py +3 -0
- paddle_billing/Options.py +10 -0
- paddle_billing/PaddleStrEnum.py +44 -0
- paddle_billing/RecursivelyRemoveKey.py +14 -0
- paddle_billing/Resources/Addresses/AddressesClient.py +58 -0
- paddle_billing/Resources/Addresses/Operations/CreateAddress.py +20 -0
- paddle_billing/Resources/Addresses/Operations/ListAddresses.py +42 -0
- paddle_billing/Resources/Addresses/Operations/UpdateAddress.py +21 -0
- paddle_billing/Resources/Addresses/Operations/__init__.py +3 -0
- paddle_billing/Resources/Addresses/__init__.py +0 -0
- paddle_billing/Resources/Adjustments/AdjustmentsClient.py +36 -0
- paddle_billing/Resources/Adjustments/Operations/Create/AdjustmentItem.py +11 -0
- paddle_billing/Resources/Adjustments/Operations/Create/__init__.py +0 -0
- paddle_billing/Resources/Adjustments/Operations/CreateAdjustment.py +28 -0
- paddle_billing/Resources/Adjustments/Operations/ListAdjustments.py +60 -0
- paddle_billing/Resources/Adjustments/Operations/__init__.py +3 -0
- paddle_billing/Resources/Adjustments/__init__.py +0 -0
- paddle_billing/Resources/Businesses/BusinessesClient.py +58 -0
- paddle_billing/Resources/Businesses/Operations/CreateBusiness.py +17 -0
- paddle_billing/Resources/Businesses/Operations/ListBusinesses.py +45 -0
- paddle_billing/Resources/Businesses/Operations/UpdateBusiness.py +18 -0
- paddle_billing/Resources/Businesses/Operations/__init__.py +3 -0
- paddle_billing/Resources/Businesses/__init__.py +0 -0
- paddle_billing/Resources/Customers/CustomersClient.py +65 -0
- paddle_billing/Resources/Customers/Operations/CreateCustomer.py +16 -0
- paddle_billing/Resources/Customers/Operations/ListCreditBalances.py +28 -0
- paddle_billing/Resources/Customers/Operations/ListCustomers.py +50 -0
- paddle_billing/Resources/Customers/Operations/UpdateCustomer.py +17 -0
- paddle_billing/Resources/Customers/Operations/__init__.py +4 -0
- paddle_billing/Resources/Customers/__init__.py +0 -0
- paddle_billing/Resources/Discounts/DiscountsClient.py +55 -0
- paddle_billing/Resources/Discounts/Operations/CreateDiscount.py +24 -0
- paddle_billing/Resources/Discounts/Operations/ListDiscounts.py +46 -0
- paddle_billing/Resources/Discounts/Operations/UpdateDiscount.py +25 -0
- paddle_billing/Resources/Discounts/Operations/__init__.py +3 -0
- paddle_billing/Resources/Discounts/__init__.py +0 -0
- paddle_billing/Resources/EventTypes/EventTypesClient.py +22 -0
- paddle_billing/Resources/EventTypes/__init__.py +0 -0
- paddle_billing/Resources/Events/EventsClient.py +26 -0
- paddle_billing/Resources/Events/Operations/ListEvents.py +12 -0
- paddle_billing/Resources/Events/Operations/__init__.py +1 -0
- paddle_billing/Resources/Events/__init__.py +0 -0
- paddle_billing/Resources/NotificationLogs/NotificationLogsClient.py +26 -0
- paddle_billing/Resources/NotificationLogs/Operations/ListNotificationLogs.py +11 -0
- paddle_billing/Resources/NotificationLogs/Operations/__init__.py +1 -0
- paddle_billing/Resources/NotificationLogs/__init__.py +0 -0
- paddle_billing/Resources/NotificationSettings/NotificationSettingsClient.py +54 -0
- paddle_billing/Resources/NotificationSettings/Operations/CreateNotificationSetting.py +21 -0
- paddle_billing/Resources/NotificationSettings/Operations/UpdateNotificationSetting.py +20 -0
- paddle_billing/Resources/NotificationSettings/Operations/__init__.py +2 -0
- paddle_billing/Resources/NotificationSettings/__init__.py +0 -0
- paddle_billing/Resources/Notifications/NotificationsClient.py +44 -0
- paddle_billing/Resources/Notifications/Operations/ListNotifications.py +58 -0
- paddle_billing/Resources/Notifications/Operations/__init__.py +1 -0
- paddle_billing/Resources/Notifications/__init__.py +0 -0
- paddle_billing/Resources/Prices/Operations/CreatePrice.py +23 -0
- paddle_billing/Resources/Prices/Operations/List/Includes.py +5 -0
- paddle_billing/Resources/Prices/Operations/List/__init__.py +0 -0
- paddle_billing/Resources/Prices/Operations/ListPrices.py +62 -0
- paddle_billing/Resources/Prices/Operations/UpdatePrice.py +23 -0
- paddle_billing/Resources/Prices/Operations/__init__.py +4 -0
- paddle_billing/Resources/Prices/PricesClient.py +65 -0
- paddle_billing/Resources/Prices/__init__.py +0 -0
- paddle_billing/Resources/PricingPreviews/Operations/PreviewPrice.py +20 -0
- paddle_billing/Resources/PricingPreviews/Operations/__init__.py +1 -0
- paddle_billing/Resources/PricingPreviews/PricingPreviewsClient.py +20 -0
- paddle_billing/Resources/PricingPreviews/__init__.py +0 -0
- paddle_billing/Resources/Products/Operations/CreateProduct.py +18 -0
- paddle_billing/Resources/Products/Operations/List/Includes.py +5 -0
- paddle_billing/Resources/Products/Operations/List/__init__.py +0 -0
- paddle_billing/Resources/Products/Operations/ListProducts.py +59 -0
- paddle_billing/Resources/Products/Operations/UpdateProduct.py +19 -0
- paddle_billing/Resources/Products/Operations/__init__.py +4 -0
- paddle_billing/Resources/Products/ProductsClient.py +70 -0
- paddle_billing/Resources/Products/__init__.py +0 -0
- paddle_billing/Resources/Reports/Operations/CreateReport.py +27 -0
- paddle_billing/Resources/Reports/Operations/ListReports.py +35 -0
- paddle_billing/Resources/Reports/Operations/__init__.py +2 -0
- paddle_billing/Resources/Reports/ReportsClient.py +51 -0
- paddle_billing/Resources/Reports/__init__.py +0 -0
- paddle_billing/Resources/Shared/Operations/List/Comparator.py +8 -0
- paddle_billing/Resources/Shared/Operations/List/DateComparison.py +31 -0
- paddle_billing/Resources/Shared/Operations/List/OrderBy.py +21 -0
- paddle_billing/Resources/Shared/Operations/List/Pager.py +24 -0
- paddle_billing/Resources/Shared/Operations/List/__init__.py +0 -0
- paddle_billing/Resources/Shared/Operations/__init__.py +4 -0
- paddle_billing/Resources/Shared/__init__.py +0 -0
- paddle_billing/Resources/Subscriptions/Operations/CancelSubscription.py +12 -0
- paddle_billing/Resources/Subscriptions/Operations/CreateOneTimeCharge.py +22 -0
- paddle_billing/Resources/Subscriptions/Operations/Get/Includes.py +6 -0
- paddle_billing/Resources/Subscriptions/Operations/Get/__init__.py +0 -0
- paddle_billing/Resources/Subscriptions/Operations/ListSubscriptions.py +59 -0
- paddle_billing/Resources/Subscriptions/Operations/PauseSubscription.py +19 -0
- paddle_billing/Resources/Subscriptions/Operations/PreviewOneTimeCharge.py +22 -0
- paddle_billing/Resources/Subscriptions/Operations/PreviewUpdateSubscription.py +37 -0
- paddle_billing/Resources/Subscriptions/Operations/ResumeSubscription.py +17 -0
- paddle_billing/Resources/Subscriptions/Operations/Update/SubscriptionDiscount.py +9 -0
- paddle_billing/Resources/Subscriptions/Operations/Update/__init__.py +0 -0
- paddle_billing/Resources/Subscriptions/Operations/UpdateSubscription.py +37 -0
- paddle_billing/Resources/Subscriptions/Operations/__init__.py +10 -0
- paddle_billing/Resources/Subscriptions/SubscriptionsClient.py +121 -0
- paddle_billing/Resources/Subscriptions/__init__.py +0 -0
- paddle_billing/Resources/Transactions/Operations/CreateTransaction.py +25 -0
- paddle_billing/Resources/Transactions/Operations/List/Includes.py +11 -0
- paddle_billing/Resources/Transactions/Operations/List/Origin.py +10 -0
- paddle_billing/Resources/Transactions/Operations/List/__init__.py +0 -0
- paddle_billing/Resources/Transactions/Operations/ListTransactions.py +86 -0
- paddle_billing/Resources/Transactions/Operations/PreviewTransaction.py +24 -0
- paddle_billing/Resources/Transactions/Operations/UpdateTransaction.py +25 -0
- paddle_billing/Resources/Transactions/Operations/__init__.py +6 -0
- paddle_billing/Resources/Transactions/TransactionsClient.py +90 -0
- paddle_billing/Resources/Transactions/__init__.py +0 -0
- paddle_billing/Resources/__init__.py +0 -0
- paddle_billing/ResponseParser.py +65 -0
- paddle_billing/Undefined.py +2 -0
- paddle_billing/__init__.py +4 -0
- paddle_python_sdk-0.1.0.dist-info/LICENSE +190 -0
- paddle_python_sdk-0.1.0.dist-info/METADATA +184 -0
- paddle_python_sdk-0.1.0.dist-info/RECORD +517 -0
- paddle_python_sdk-0.1.0.dist-info/WHEEL +5 -0
- paddle_python_sdk-0.1.0.dist-info/top_level.txt +3 -0
- tests/Functional/Resources/Addresses/__init__.py +0 -0
- tests/Functional/Resources/Addresses/test_AddressesClient.py +274 -0
- tests/Functional/Resources/Adjustments/__init__.py +0 -0
- tests/Functional/Resources/Adjustments/test_AdjustmentsClient.py +188 -0
- tests/Functional/Resources/Businesses/__init__.py +0 -0
- tests/Functional/Resources/Businesses/test_BusinessesClient.py +279 -0
- tests/Functional/Resources/Customers/__init__.py +0 -0
- tests/Functional/Resources/Customers/test_CustomersClient.py +291 -0
- tests/Functional/Resources/Discounts/__init__.py +0 -0
- tests/Functional/Resources/Discounts/test_DiscountsClient.py +280 -0
- tests/Functional/Resources/EventTypes/__init__.py +0 -0
- tests/Functional/Resources/EventTypes/test_EventTypesClient.py +43 -0
- tests/Functional/Resources/Events/__init__.py +0 -0
- tests/Functional/Resources/Events/test_EventsClient.py +64 -0
- tests/Functional/Resources/NotificationLogs/__init__.py +0 -0
- tests/Functional/Resources/NotificationLogs/test_NotificationLogsClient.py +68 -0
- tests/Functional/Resources/NotificationSettings/__init__.py +0 -0
- tests/Functional/Resources/NotificationSettings/test_NotificationSettingsClient.py +287 -0
- tests/Functional/Resources/Notifications/__init__.py +0 -0
- tests/Functional/Resources/Notifications/test_NotificationsClient.py +202 -0
- tests/Functional/Resources/Prices/__init__.py +0 -0
- tests/Functional/Resources/Prices/test_PricesClient.py +307 -0
- tests/Functional/Resources/PricingPreviews/__init__.py +0 -0
- tests/Functional/Resources/PricingPreviews/test_PricingPreviewsClient.py +92 -0
- tests/Functional/Resources/Products/__init__.py +0 -0
- tests/Functional/Resources/Products/test_ProductsClient.py +271 -0
- tests/Functional/Resources/Reports/__init__.py +0 -0
- tests/Functional/Resources/Reports/test_ReportsClient.py +197 -0
- tests/Functional/Resources/Subscriptions/__init__.py +0 -0
- tests/Functional/Resources/Subscriptions/test_SubscriptionsClient.py +758 -0
- tests/Functional/Resources/Transactions/__init__.py +0 -0
- tests/Functional/Resources/Transactions/test_TransactionsClient.py +585 -0
- tests/Functional/Resources/__init__.py +0 -0
- tests/Functional/__init__.py +0 -0
- tests/Unit/Logger/__init__.py +0 -0
- tests/Unit/Logger/test_Logger.py +10 -0
- tests/Unit/Notification/__init__.py +0 -0
- tests/Unit/Notification/test_Verifier.py +63 -0
- tests/Unit/PaddleStrEnum/__init__.py +0 -0
- tests/Unit/PaddleStrEnum/test_PaddleStrEnum.py +52 -0
- tests/Unit/__init__.py +0 -0
- tests/Utils/FakeResponse.py +6 -0
- tests/Utils/ReadsFixture.py +33 -0
- tests/Utils/TestClient.py +48 -0
- tests/Utils/__init__.py +1 -0
- tests/__init__.py +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Subscription import Subscription
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SubscriptionPaused(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Subscription,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Subscription import Subscription
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SubscriptionResumed(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Subscription,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Subscription import Subscription
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SubscriptionTrialing(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Subscription,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Subscription import Subscription
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class SubscriptionUpdated(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Subscription,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Transaction import Transaction
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TransactionBilled(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Transaction,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Transaction import Transaction
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TransactionCanceled(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Transaction,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Transaction import Transaction
|
|
7
|
+
|
|
8
|
+
class TransactionCompleted(Event):
|
|
9
|
+
def __init__(
|
|
10
|
+
self,
|
|
11
|
+
event_id: str,
|
|
12
|
+
event_type: EventTypeName,
|
|
13
|
+
occurred_at: datetime,
|
|
14
|
+
data: Transaction,
|
|
15
|
+
):
|
|
16
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Transaction import Transaction
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TransactionCreated(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Transaction,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Transaction import Transaction
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TransactionPaid(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Transaction,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Transaction import Transaction
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TransactionPastDue(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Transaction,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Transaction import Transaction
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TransactionPaymentFailed(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Transaction,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Transaction import Transaction
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TransactionReady(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Transaction,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Event import Event
|
|
4
|
+
from paddle_billing.Entities.Events import EventTypeName
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Entities.Transaction import Transaction
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class TransactionUpdated(Event):
|
|
10
|
+
def __init__(
|
|
11
|
+
self,
|
|
12
|
+
event_id: str,
|
|
13
|
+
event_type: EventTypeName,
|
|
14
|
+
occurred_at: datetime,
|
|
15
|
+
data: Transaction,
|
|
16
|
+
):
|
|
17
|
+
super().__init__(event_id, event_type, occurred_at, data)
|
|
File without changes
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
from hashlib import sha256
|
|
2
|
+
from hmac import HMAC, compare_digest, new as hmac_new
|
|
3
|
+
|
|
4
|
+
from paddle_billing.Logger import get_logger
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Notifications.Secret import Secret
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class PaddleSignature:
|
|
10
|
+
def __init__(self):
|
|
11
|
+
"""
|
|
12
|
+
Verifies the integrity of a Paddle signature
|
|
13
|
+
"""
|
|
14
|
+
self.log = get_logger()
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def HASH_ALGORITHM_1(self): # noqa N802
|
|
19
|
+
return 'h1'
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def HEADER(self): # noqa N802
|
|
23
|
+
return 'Paddle-Signature'
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def TIMESTAMP(self): # noqa N802
|
|
27
|
+
return 'ts'
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@staticmethod
|
|
31
|
+
def parse(signature_header: str) -> tuple:
|
|
32
|
+
"""
|
|
33
|
+
Parse the Paddle-Signature header to extract the timestamp and signature
|
|
34
|
+
|
|
35
|
+
:param signature_header: The Paddle-Signature key=value from the webhook event's headers
|
|
36
|
+
:return: A tuple containing (timestamp, signature)
|
|
37
|
+
"""
|
|
38
|
+
components = {
|
|
39
|
+
PaddleSignature().TIMESTAMP: 0,
|
|
40
|
+
'hashes': {PaddleSignature().HASH_ALGORITHM_1: []},
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
for key_value_pair in signature_header.split(";"):
|
|
44
|
+
if '=' in key_value_pair:
|
|
45
|
+
key, value = key_value_pair.split('=')
|
|
46
|
+
|
|
47
|
+
if key == PaddleSignature().TIMESTAMP:
|
|
48
|
+
components[PaddleSignature().TIMESTAMP] = value
|
|
49
|
+
elif key == PaddleSignature().HASH_ALGORITHM_1:
|
|
50
|
+
components['hashes'][PaddleSignature().HASH_ALGORITHM_1].append(value)
|
|
51
|
+
else:
|
|
52
|
+
raise ValueError(f"Unrecognized Paddle-Signature key")
|
|
53
|
+
|
|
54
|
+
return int(components[PaddleSignature().TIMESTAMP]), components['hashes']
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@staticmethod
|
|
58
|
+
def calculate_hmac(secret_key: str, data: bytes) -> HMAC:
|
|
59
|
+
return hmac_new(secret_key.encode('utf-8'), data, sha256)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def __do_comparison(self, generated_signature: str, signature: str) -> bool:
|
|
63
|
+
self.log.debug(f"Comparing received Paddle signature '{signature}' to our calculated signature: '{generated_signature}'")
|
|
64
|
+
|
|
65
|
+
return compare_digest(generated_signature, signature)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def __do_verify(self, timestamp: str, signatures: list[str], raw_body: str, secret_key: Secret) -> bool:
|
|
69
|
+
"""
|
|
70
|
+
Verifies an individual secret key against a Paddle-Signature header.
|
|
71
|
+
Called by PaddleSignature.verify()
|
|
72
|
+
|
|
73
|
+
:param signatures: The Paddle-Signature header
|
|
74
|
+
:param raw_body: Raw body of the webhook request
|
|
75
|
+
:param secret_key: A Paddle secret key: https://developer.paddle.com/webhooks/signature-verification#get-secret-key
|
|
76
|
+
:return: True on verification success, False on verification failure
|
|
77
|
+
"""
|
|
78
|
+
new_body_to_verify = f"{timestamp}:{raw_body}".encode('utf-8')
|
|
79
|
+
generated_signature = PaddleSignature.calculate_hmac(secret_key.secret_key, new_body_to_verify).hexdigest()
|
|
80
|
+
integrity = False
|
|
81
|
+
|
|
82
|
+
for signature in signatures:
|
|
83
|
+
integrity_result = self.__do_comparison(generated_signature, signature)
|
|
84
|
+
if integrity_result is True:
|
|
85
|
+
integrity = True
|
|
86
|
+
break
|
|
87
|
+
|
|
88
|
+
self.log.info(f"Paddle signature integrity {'passed' if integrity else 'failed'}")
|
|
89
|
+
return integrity
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def verify(self, signature_header: str, raw_body: str, secrets: list[Secret] | Secret) -> bool:
|
|
93
|
+
"""
|
|
94
|
+
https://developer.paddle.com/webhooks/signature-verification
|
|
95
|
+
Performs an integrity check on a Paddle webhook's signature against one or more Secrets
|
|
96
|
+
Handling multiple Secrets is needed because of key rotation situations
|
|
97
|
+
|
|
98
|
+
:param signature_header: The Paddle-Signature header
|
|
99
|
+
:param raw_body: Raw body of the webhook request
|
|
100
|
+
:param secrets: One or more Paddle secret key(s): https://developer.paddle.com/webhooks/signature-verification#get-secret-key
|
|
101
|
+
:return: True if any secret key passes verification success. Raises a ConnectionRefusedError if all secret keys fail verification
|
|
102
|
+
"""
|
|
103
|
+
is_list = type(secrets) is list
|
|
104
|
+
key_count = 'multiple secret keys' if is_list else 'one secret key'
|
|
105
|
+
self.log.info(f"Verifying Paddle signature integrity against {key_count}")
|
|
106
|
+
|
|
107
|
+
timestamp, signature = PaddleSignature.parse(signature_header)
|
|
108
|
+
|
|
109
|
+
if not is_list:
|
|
110
|
+
return self.__do_verify(
|
|
111
|
+
timestamp = timestamp,
|
|
112
|
+
signatures = signature[PaddleSignature().HASH_ALGORITHM_1],
|
|
113
|
+
raw_body = raw_body,
|
|
114
|
+
secret_key = secrets,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
for secret in secrets:
|
|
118
|
+
verification_result = self.__do_verify(
|
|
119
|
+
timestamp = timestamp,
|
|
120
|
+
signatures = signature[PaddleSignature().HASH_ALGORITHM_1],
|
|
121
|
+
raw_body = raw_body,
|
|
122
|
+
secret_key = secret,
|
|
123
|
+
)
|
|
124
|
+
if verification_result is True:
|
|
125
|
+
return True
|
|
126
|
+
|
|
127
|
+
# If we got this far then none of the provided secrets passed verification
|
|
128
|
+
raise ConnectionRefusedError(f"Paddle signature failed integrity check")
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import requests
|
|
2
|
+
|
|
3
|
+
from os import getenv
|
|
4
|
+
from time import time
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Logger import get_logger
|
|
7
|
+
|
|
8
|
+
from paddle_billing.Notifications.Secret import Secret
|
|
9
|
+
from paddle_billing.Notifications.PaddleSignature import PaddleSignature
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class Verifier:
|
|
13
|
+
def __init__(self, maximum_variance: int | None = 5):
|
|
14
|
+
""""""
|
|
15
|
+
self.__maximum_variance = maximum_variance
|
|
16
|
+
self.log = get_logger()
|
|
17
|
+
self.paddle_signature = PaddleSignature()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@property
|
|
21
|
+
def maximum_variance(self) -> int:
|
|
22
|
+
return self.__maximum_variance
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def verify(self, request: requests, secrets: list[Secret] | Secret, verify_time_drift = True):
|
|
26
|
+
"""
|
|
27
|
+
:param request: The request object to verify
|
|
28
|
+
:param secrets: One or more Secrets to use for verifying the request
|
|
29
|
+
:param verify_time_drift: Defaults to True. Set False to disable time drift verification (NOT RECOMMENDED, counters MITM attacks)
|
|
30
|
+
:return: True on verification success, False on verification failure
|
|
31
|
+
"""
|
|
32
|
+
self.log.info(f"Attempting to verify the authenticity of a request")
|
|
33
|
+
|
|
34
|
+
if getenv('TEST_MODE') is not None:
|
|
35
|
+
verify_time_drift = not bool(int(getenv('TEST_MODE', '0'))) # Intentional bool(int())
|
|
36
|
+
|
|
37
|
+
signature_header = request.headers.get(PaddleSignature().HEADER, None)
|
|
38
|
+
if not signature_header:
|
|
39
|
+
self.log.critical(f"Unable to extract the '{PaddleSignature().HEADER}' header from the request")
|
|
40
|
+
return False
|
|
41
|
+
|
|
42
|
+
timestamp, signature = PaddleSignature.parse(signature_header)
|
|
43
|
+
if verify_time_drift and self.maximum_variance > 0 and time() > int(timestamp + self.maximum_variance):
|
|
44
|
+
self.log.critical(f"Too much time has elapsed between the request and this process")
|
|
45
|
+
return False
|
|
46
|
+
|
|
47
|
+
raw_body = None
|
|
48
|
+
if hasattr(request, 'body'):
|
|
49
|
+
raw_body = request.body.decode('utf-8')
|
|
50
|
+
elif hasattr(request, 'content'):
|
|
51
|
+
raw_body = request.content.decode('utf-8')
|
|
52
|
+
elif hasattr(request, 'data'):
|
|
53
|
+
raw_body = request.data.decode('utf-8')
|
|
54
|
+
|
|
55
|
+
return self.paddle_signature.verify(signature_header, raw_body, secrets)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
from enum import EnumMeta, StrEnum
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Undefined import Undefined
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
# Copied from enum.py because IDE complains when calling protected class super()._is_dunder
|
|
7
|
+
def _is_dunder(name):
|
|
8
|
+
"""
|
|
9
|
+
Returns True if a __dunder__ name, False otherwise.
|
|
10
|
+
"""
|
|
11
|
+
return (
|
|
12
|
+
len(name) > 4 and
|
|
13
|
+
name[:2] == name[-2:] == '__' and
|
|
14
|
+
name[2] != '_' and
|
|
15
|
+
name[-3] != '_'
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class PaddleStrEnumMeta(EnumMeta):
|
|
21
|
+
"""
|
|
22
|
+
Returns Undefined() by default when a property doesn't exist
|
|
23
|
+
This provides some flexibility for the SDK to handle Paddle adding new properties to their APIspec
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
def __getattr__(cls, name):
|
|
27
|
+
if _is_dunder(name):
|
|
28
|
+
raise AttributeError(name)
|
|
29
|
+
|
|
30
|
+
try:
|
|
31
|
+
return super().__getattr__(name)
|
|
32
|
+
except AttributeError:
|
|
33
|
+
return Undefined()
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class PaddleStrEnum(StrEnum, metaclass=PaddleStrEnumMeta):
|
|
38
|
+
"""
|
|
39
|
+
Subclass of StrEnum but uses PaddleStrEnumMeta metaclass to set Undefined() value to undefined enum keys
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
@classmethod
|
|
43
|
+
def is_known(cls) -> bool:
|
|
44
|
+
"""Not yet implemented"""
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
def recursively_remove_key(data: list | dict | None, key_to_remove: str):
|
|
2
|
+
"""Remove key recursively from a dict or list"""
|
|
3
|
+
|
|
4
|
+
if data is None:
|
|
5
|
+
return
|
|
6
|
+
|
|
7
|
+
if isinstance(data, dict):
|
|
8
|
+
if key_to_remove in data:
|
|
9
|
+
del data[key_to_remove]
|
|
10
|
+
for value in data.values():
|
|
11
|
+
recursively_remove_key(value, key_to_remove)
|
|
12
|
+
elif isinstance(data, list):
|
|
13
|
+
for item in data:
|
|
14
|
+
recursively_remove_key(item, key_to_remove)
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from paddle_billing.ResponseParser import ResponseParser
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Address import Address
|
|
4
|
+
from paddle_billing.Entities.Collections import Paginator, AddressCollection
|
|
5
|
+
from paddle_billing.Entities.Shared import Status
|
|
6
|
+
|
|
7
|
+
from paddle_billing.Resources.Addresses.Operations import CreateAddress, ListAddresses, UpdateAddress
|
|
8
|
+
|
|
9
|
+
from typing import TYPE_CHECKING
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from paddle_billing.Client import Client
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class AddressesClient:
|
|
15
|
+
def __init__(self, client: 'Client'):
|
|
16
|
+
self.client = client
|
|
17
|
+
self.response = None
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def list(self, customer_id: str, operation: ListAddresses = None) -> AddressCollection:
|
|
21
|
+
if operation is None:
|
|
22
|
+
operation = ListAddresses()
|
|
23
|
+
|
|
24
|
+
self.response = self.client.get_raw(f"/customers/{customer_id}/addresses", operation.get_parameters())
|
|
25
|
+
parser = ResponseParser(self.response)
|
|
26
|
+
|
|
27
|
+
return AddressCollection.from_list(
|
|
28
|
+
parser.get_data(),
|
|
29
|
+
Paginator(self.client, parser.get_pagination(), AddressCollection)
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def get(self, customer_id: str, address_id: str) -> Address:
|
|
34
|
+
self.response = self.client.get_raw(f"/customers/{customer_id}/addresses/{address_id}")
|
|
35
|
+
parser = ResponseParser(self.response)
|
|
36
|
+
|
|
37
|
+
return Address.from_dict(parser.get_data())
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def create(self, customer_id: str, operation: CreateAddress) -> Address:
|
|
41
|
+
self.response = self.client.post_raw(f"/customers/{customer_id}/addresses", operation.get_parameters())
|
|
42
|
+
parser = ResponseParser(self.response)
|
|
43
|
+
|
|
44
|
+
return Address.from_dict(parser.get_data())
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def update(self, customer_id: str, address_id: str, operation: UpdateAddress) -> Address:
|
|
48
|
+
self.response = self.client.patch_raw(
|
|
49
|
+
f"/customers/{customer_id}/addresses/{address_id}",
|
|
50
|
+
operation.get_parameters()
|
|
51
|
+
)
|
|
52
|
+
parser = ResponseParser(self.response)
|
|
53
|
+
|
|
54
|
+
return Address.from_dict(parser.get_data())
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def archive(self, customer_id: str, address_id: str) -> Address:
|
|
58
|
+
return self.update(customer_id, address_id, UpdateAddress(status=Status.Archived))
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from dataclasses import asdict, dataclass
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Undefined import Undefined
|
|
4
|
+
from paddle_billing.Entities.Shared import CountryCode, CustomData
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class CreateAddress:
|
|
9
|
+
country_code: CountryCode
|
|
10
|
+
description: str | None = Undefined()
|
|
11
|
+
first_line: str | None = Undefined()
|
|
12
|
+
second_line: str | None = Undefined()
|
|
13
|
+
city: str | None = Undefined()
|
|
14
|
+
postal_code: str | None = Undefined()
|
|
15
|
+
region: str | None = Undefined()
|
|
16
|
+
custom_data: CustomData | None = Undefined()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_parameters(self) -> dict:
|
|
20
|
+
return asdict(self)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from paddle_billing.EnumStringify import enum_stringify
|
|
2
|
+
from paddle_billing.HasParameters import HasParameters
|
|
3
|
+
|
|
4
|
+
from paddle_billing.Entities.Shared import Status
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Exceptions.SdkExceptions.InvalidArgumentException import InvalidArgumentException
|
|
7
|
+
|
|
8
|
+
from paddle_billing.Resources.Shared.Operations import Pager
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ListAddresses(HasParameters):
|
|
12
|
+
def __init__(
|
|
13
|
+
self,
|
|
14
|
+
pager: Pager | None = None,
|
|
15
|
+
ids: list[str] | None = None,
|
|
16
|
+
statuses: list[Status] | None = None,
|
|
17
|
+
search: str | None = None,
|
|
18
|
+
):
|
|
19
|
+
self.pager = pager
|
|
20
|
+
self.search = search
|
|
21
|
+
self.ids = ids if ids is not None else []
|
|
22
|
+
self.statuses = statuses if statuses is not None else []
|
|
23
|
+
|
|
24
|
+
# Validation
|
|
25
|
+
if any(not isinstance(aid, str) for aid in self.ids):
|
|
26
|
+
raise InvalidArgumentException('ids', 'string')
|
|
27
|
+
if any(not isinstance(status, Status) for status in self.statuses):
|
|
28
|
+
raise InvalidArgumentException('statuses', Status.__name__)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def get_parameters(self) -> dict:
|
|
32
|
+
parameters = {}
|
|
33
|
+
if self.pager:
|
|
34
|
+
parameters.update(self.pager.get_parameters())
|
|
35
|
+
if self.ids:
|
|
36
|
+
parameters['id'] = ','.join(self.ids)
|
|
37
|
+
if self.statuses:
|
|
38
|
+
parameters['status'] = ','.join(map(enum_stringify, self.statuses))
|
|
39
|
+
if self.search:
|
|
40
|
+
parameters['search'] = self.search
|
|
41
|
+
|
|
42
|
+
return parameters
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from dataclasses import asdict, dataclass
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Undefined import Undefined
|
|
4
|
+
from paddle_billing.Entities.Shared import CountryCode, CustomData, Status
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@dataclass
|
|
8
|
+
class UpdateAddress:
|
|
9
|
+
country_code: CountryCode | Undefined = Undefined()
|
|
10
|
+
description: str | None | Undefined = Undefined()
|
|
11
|
+
first_line: str | None | Undefined = Undefined()
|
|
12
|
+
second_line: str | None | Undefined = Undefined()
|
|
13
|
+
city: str | None | Undefined = Undefined()
|
|
14
|
+
postal_code: str | None | Undefined = Undefined()
|
|
15
|
+
region: str | None | Undefined = Undefined()
|
|
16
|
+
custom_data: CustomData | None | Undefined = Undefined()
|
|
17
|
+
status: Status | None | Undefined = Undefined()
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def get_parameters(self) -> dict:
|
|
21
|
+
return asdict(self)
|
|
File without changes
|