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,38 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Entity import Entity
|
|
6
|
+
from paddle_billing.Entities.Shared import Contacts, CustomData, ImportMeta, Status
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class Business(Entity):
|
|
11
|
+
id: str
|
|
12
|
+
customer_id: str
|
|
13
|
+
name: str
|
|
14
|
+
company_number: str | None
|
|
15
|
+
tax_identifier: str | None
|
|
16
|
+
status: Status
|
|
17
|
+
contacts: list[Contacts]
|
|
18
|
+
created_at: datetime
|
|
19
|
+
updated_at: datetime
|
|
20
|
+
custom_data: CustomData | None = None
|
|
21
|
+
import_meta: ImportMeta | None = None
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def from_dict(cls, data: dict) -> Business:
|
|
26
|
+
return Business(
|
|
27
|
+
id = data['id'],
|
|
28
|
+
customer_id = data['customer_id'],
|
|
29
|
+
name = data['name'],
|
|
30
|
+
company_number = data.get('company_number'),
|
|
31
|
+
tax_identifier = data.get('tax_identifier'),
|
|
32
|
+
status = Status(data['status']),
|
|
33
|
+
created_at = datetime.fromisoformat(data['created_at']),
|
|
34
|
+
updated_at = datetime.fromisoformat(data['updated_at']),
|
|
35
|
+
contacts = [Contacts.from_dict(contact) for contact in data['contacts']],
|
|
36
|
+
custom_data = CustomData(data['custom_data']) if data.get('custom_data') else None,
|
|
37
|
+
import_meta = ImportMeta.from_dict(data['import_meta']) if data.get('import_meta') else None,
|
|
38
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AddressCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> AddressCollection:
|
|
10
|
+
from paddle_billing.Entities.Address import Address
|
|
11
|
+
|
|
12
|
+
items: list[Address] = [Address.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return AddressCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AdjustmentCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> AdjustmentCollection:
|
|
10
|
+
from paddle_billing.Entities.Adjustment import Adjustment
|
|
11
|
+
|
|
12
|
+
items: list[Adjustment] = [Adjustment.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return AdjustmentCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class BusinessCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> BusinessCollection:
|
|
10
|
+
from paddle_billing.Entities.Business import Business
|
|
11
|
+
|
|
12
|
+
items: list[Business] = [Business.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return BusinessCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
from collections.abc import Iterator
|
|
3
|
+
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Collection(ABC, Iterator):
|
|
8
|
+
def __init__(self, items, paginator: Paginator | None = None):
|
|
9
|
+
self.items = items
|
|
10
|
+
self.paginator = paginator
|
|
11
|
+
self._pointer = 0
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def from_list(self, data, paginator: Paginator | None = None):
|
|
16
|
+
pass
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def __iter__(self):
|
|
20
|
+
self._pointer = 0
|
|
21
|
+
|
|
22
|
+
return self
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def __next__(self):
|
|
26
|
+
if self._pointer < len(self.items):
|
|
27
|
+
result = self.items[self._pointer]
|
|
28
|
+
self._pointer += 1
|
|
29
|
+
|
|
30
|
+
return result
|
|
31
|
+
|
|
32
|
+
if self.paginator and self.paginator.has_more:
|
|
33
|
+
new_collection = self.paginator.next_page()
|
|
34
|
+
self.items.extend(new_collection.items) # Append new items
|
|
35
|
+
self.paginator = new_collection.paginator
|
|
36
|
+
|
|
37
|
+
return self.__next__() # Continue iteration with new items
|
|
38
|
+
|
|
39
|
+
raise StopIteration
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def current(self):
|
|
43
|
+
return self.items[self._pointer]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def key(self):
|
|
47
|
+
return getattr(self.items[self._pointer], 'id', self._pointer)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CreditBalanceCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> CreditBalanceCollection:
|
|
10
|
+
from paddle_billing.Entities.CreditBalance import CreditBalance
|
|
11
|
+
|
|
12
|
+
items: list[CreditBalance] = [CreditBalance.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return CreditBalanceCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class CustomerCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> CustomerCollection:
|
|
10
|
+
from paddle_billing.Entities.Customer import Customer
|
|
11
|
+
|
|
12
|
+
items: list[Customer] = [Customer.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return CustomerCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class DiscountCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> DiscountCollection:
|
|
10
|
+
from paddle_billing.Entities.Discount import Discount
|
|
11
|
+
|
|
12
|
+
items: list[Discount] = [Discount.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return DiscountCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class EventCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> EventCollection:
|
|
10
|
+
from paddle_billing.Entities.Event import Event
|
|
11
|
+
|
|
12
|
+
items: list[Event] = [Event.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return EventCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class EventTypeCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> EventTypeCollection:
|
|
10
|
+
from paddle_billing.Entities.EventType import EventType
|
|
11
|
+
|
|
12
|
+
items: list[EventType] = [EventType.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return EventTypeCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class NotificationCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> NotificationCollection:
|
|
10
|
+
from paddle_billing.Entities.Notification import Notification
|
|
11
|
+
|
|
12
|
+
items: list[Notification] = [Notification.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return NotificationCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class NotificationLogCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> NotificationLogCollection:
|
|
10
|
+
from paddle_billing.Entities.NotificationLog import NotificationLog
|
|
11
|
+
|
|
12
|
+
items: list[NotificationLog] = [NotificationLog.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return NotificationLogCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class NotificationSettingCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> NotificationSettingCollection:
|
|
10
|
+
from paddle_billing.Entities.Notification import Notification
|
|
11
|
+
|
|
12
|
+
items: list[Notification] = [Notification.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return NotificationSettingCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from paddle_billing.ResponseParser import ResponseParser
|
|
2
|
+
|
|
3
|
+
from typing import TYPE_CHECKING
|
|
4
|
+
if TYPE_CHECKING:
|
|
5
|
+
from paddle_billing.Client import Client
|
|
6
|
+
from paddle_billing.Entities.Collections import Collection
|
|
7
|
+
from paddle_billing.Entities.Shared import Pagination
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Paginator:
|
|
11
|
+
def __init__(self, client: 'Client', pagination: 'Pagination', mapper):
|
|
12
|
+
self._client = client
|
|
13
|
+
self._pagination = pagination
|
|
14
|
+
self._mapper = mapper
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def has_more(self) -> bool:
|
|
19
|
+
return self._pagination.has_more
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def next_page(self) -> 'Collection':
|
|
23
|
+
response = self._client.get_raw(self._pagination.next)
|
|
24
|
+
response_parser = ResponseParser(response)
|
|
25
|
+
|
|
26
|
+
return self._mapper.from_list(
|
|
27
|
+
response_parser.get_data(),
|
|
28
|
+
Paginator(self._client, response_parser.get_pagination(), self._mapper)
|
|
29
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class PriceCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> PriceCollection:
|
|
10
|
+
from paddle_billing.Entities.Price import Price
|
|
11
|
+
|
|
12
|
+
items: list[Price] = [Price.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return PriceCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ProductCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> ProductCollection:
|
|
10
|
+
from paddle_billing.Entities.Product import Product
|
|
11
|
+
|
|
12
|
+
items: list[Product] = [Product.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return ProductCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class ReportCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> ReportCollection:
|
|
10
|
+
from paddle_billing.Entities.Report import Report
|
|
11
|
+
|
|
12
|
+
items: list[Report] = [Report.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return ReportCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SubscriptionCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> SubscriptionCollection:
|
|
10
|
+
from paddle_billing.Entities.Subscription import Subscription
|
|
11
|
+
|
|
12
|
+
items: list[Subscription] = [Subscription.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return SubscriptionCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class SubscriptionPreviewCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> SubscriptionPreviewCollection:
|
|
10
|
+
from paddle_billing.Entities.SubscriptionPreview import SubscriptionPreview
|
|
11
|
+
|
|
12
|
+
items: list[SubscriptionPreview] = [SubscriptionPreview.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return SubscriptionPreviewCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TransactionCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> TransactionCollection:
|
|
10
|
+
from paddle_billing.Entities.Transaction import Transaction
|
|
11
|
+
|
|
12
|
+
items: list[Transaction] = [Transaction.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return TransactionCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TransactionPreviewCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> TransactionPreviewCollection:
|
|
10
|
+
from paddle_billing.Entities.TransactionPreview import TransactionPreview
|
|
11
|
+
|
|
12
|
+
items: list[TransactionPreview] = [TransactionPreview.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return TransactionPreviewCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
4
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class TransactionsDataCollection(Collection):
|
|
8
|
+
@classmethod
|
|
9
|
+
def from_list(cls, items_data: list, paginator: Paginator | None = None) -> TransactionsDataCollection:
|
|
10
|
+
from paddle_billing.Entities.TransactionData import TransactionData
|
|
11
|
+
|
|
12
|
+
items: list[TransactionData] = [TransactionData.from_dict(item) for item in items_data]
|
|
13
|
+
|
|
14
|
+
return TransactionsDataCollection(items, paginator)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def __next__(self):
|
|
18
|
+
return super().__next__()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from paddle_billing.Entities.Collections.AddressCollection import AddressCollection
|
|
2
|
+
from paddle_billing.Entities.Collections.AdjustmentCollection import AdjustmentCollection
|
|
3
|
+
from paddle_billing.Entities.Collections.BusinessCollection import BusinessCollection
|
|
4
|
+
from paddle_billing.Entities.Collections.Collection import Collection
|
|
5
|
+
from paddle_billing.Entities.Collections.CreditBalanceCollection import CreditBalanceCollection
|
|
6
|
+
from paddle_billing.Entities.Collections.CustomerCollection import CustomerCollection
|
|
7
|
+
from paddle_billing.Entities.Collections.DiscountCollection import DiscountCollection
|
|
8
|
+
from paddle_billing.Entities.Collections.EventCollection import EventCollection
|
|
9
|
+
from paddle_billing.Entities.Collections.EventTypeCollection import EventTypeCollection
|
|
10
|
+
from paddle_billing.Entities.Collections.NotificationCollection import NotificationCollection
|
|
11
|
+
from paddle_billing.Entities.Collections.NotificationLogCollection import NotificationLogCollection
|
|
12
|
+
from paddle_billing.Entities.Collections.NotificationSettingCollection import NotificationSettingCollection
|
|
13
|
+
from paddle_billing.Entities.Collections.Paginator import Paginator
|
|
14
|
+
from paddle_billing.Entities.Collections.PriceCollection import PriceCollection
|
|
15
|
+
from paddle_billing.Entities.Collections.ProductCollection import ProductCollection
|
|
16
|
+
from paddle_billing.Entities.Collections.ReportCollection import ReportCollection
|
|
17
|
+
from paddle_billing.Entities.Collections.SubscriptionCollection import SubscriptionCollection
|
|
18
|
+
from paddle_billing.Entities.Collections.SubscriptionPreviewCollection import SubscriptionPreviewCollection
|
|
19
|
+
from paddle_billing.Entities.Collections.TransactionCollection import TransactionCollection
|
|
20
|
+
from paddle_billing.Entities.Collections.TransactionPreviewCollection import TransactionPreviewCollection
|
|
21
|
+
from paddle_billing.Entities.Collections.TransactionsDataCollection import TransactionsDataCollection
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
|
|
4
|
+
from paddle_billing.Entities.Entity import Entity
|
|
5
|
+
from paddle_billing.Entities.Shared import CurrencyCode
|
|
6
|
+
from paddle_billing.Entities.Adjustments import AdjustmentCustomerBalance
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class CreditBalance(Entity):
|
|
11
|
+
customer_id: str
|
|
12
|
+
currency_code: CurrencyCode
|
|
13
|
+
balance: AdjustmentCustomerBalance
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@classmethod
|
|
17
|
+
def from_dict(cls, data: dict) -> CreditBalance:
|
|
18
|
+
return CreditBalance(
|
|
19
|
+
customer_id = data['customer_id'],
|
|
20
|
+
currency_code = CurrencyCode(data['currency_code']),
|
|
21
|
+
balance = AdjustmentCustomerBalance.from_dict(data['balance']),
|
|
22
|
+
)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
from datetime import datetime
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Entity import Entity
|
|
6
|
+
from paddle_billing.Entities.Shared import CustomData, ImportMeta, Status
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class Customer(Entity):
|
|
11
|
+
id: str
|
|
12
|
+
name: str | None
|
|
13
|
+
email: str
|
|
14
|
+
marketing_consent: bool
|
|
15
|
+
status: Status
|
|
16
|
+
locale: str
|
|
17
|
+
created_at: datetime
|
|
18
|
+
updated_at: datetime
|
|
19
|
+
custom_data: CustomData | None = None
|
|
20
|
+
import_meta: ImportMeta | None = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@classmethod
|
|
24
|
+
def from_dict(cls, data: dict) -> Customer:
|
|
25
|
+
return Customer(
|
|
26
|
+
id = data['id'],
|
|
27
|
+
name = data.get('name'),
|
|
28
|
+
email = data['email'],
|
|
29
|
+
marketing_consent = data['marketing_consent'],
|
|
30
|
+
status = Status(data['status']),
|
|
31
|
+
locale = data['locale'],
|
|
32
|
+
created_at = datetime.fromisoformat(data['created_at']),
|
|
33
|
+
updated_at = datetime.fromisoformat(data['updated_at']),
|
|
34
|
+
custom_data = CustomData(data['custom_data']) if data.get('custom_data') else None,
|
|
35
|
+
import_meta = ImportMeta.from_dict(data['import_meta']) if data.get('import_meta') else None,
|
|
36
|
+
)
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from datetime import datetime, timedelta, timezone
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class DateTime:
|
|
5
|
+
PADDLE_RFC3339_UTC = '%Y-%m-%dT%H:%M:%S.%fZ' # trailing Z for UTC
|
|
6
|
+
PADDLE_RFC3339_OFFSET = '%Y-%m-%dT%H:%M:%S.%f%z' # actual timezone offset when not UTC
|
|
7
|
+
PADDLE_RFC3339 = PADDLE_RFC3339_UTC # default to UTC
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def __init__(self, datetime_str: str = 'now'):
|
|
11
|
+
if datetime_str == 'now':
|
|
12
|
+
self._datetime = datetime.now(timezone.utc)
|
|
13
|
+
else:
|
|
14
|
+
self._datetime = datetime.fromisoformat(datetime_str).replace(tzinfo=timezone.utc)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@property
|
|
18
|
+
def as_datetime(self):
|
|
19
|
+
return self._datetime
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def format(self, fmt: str | None = None) -> str:
|
|
23
|
+
"""Returns a RFC3339 formatted datetime string, and handles trailing Z"""
|
|
24
|
+
if self._datetime.tzinfo == timezone.utc or self._datetime.utcoffset() == timedelta(0):
|
|
25
|
+
return f"{self._datetime.strftime(fmt if fmt is not None else self.PADDLE_RFC3339)}"
|
|
26
|
+
else:
|
|
27
|
+
return f"{self._datetime.strftime(fmt if fmt is not None else self.PADDLE_RFC3339_OFFSET)}"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@classmethod
|
|
31
|
+
def from_datetime(cls, date: datetime | str):
|
|
32
|
+
if isinstance(date, str) and date == '0001-01-01T00:00:00Z':
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
date_str = date if isinstance(date, str) else date.strftime(cls.PADDLE_RFC3339)
|
|
36
|
+
try:
|
|
37
|
+
return cls(date_str)
|
|
38
|
+
except Exception:
|
|
39
|
+
return None
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def __str__(self):
|
|
43
|
+
return self.format()
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from .Entity import Entity
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
|
|
6
|
+
from paddle_billing.Entities.Discounts import DiscountStatus, DiscountType
|
|
7
|
+
from paddle_billing.Entities.Shared import CurrencyCode, ImportMeta
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class Discount(Entity):
|
|
12
|
+
id: str
|
|
13
|
+
status: DiscountStatus
|
|
14
|
+
description: str
|
|
15
|
+
enabled_for_checkout: bool
|
|
16
|
+
code: str | None
|
|
17
|
+
type: DiscountType
|
|
18
|
+
amount: str
|
|
19
|
+
currency_code: CurrencyCode | None
|
|
20
|
+
recur: bool
|
|
21
|
+
maximum_recurring_intervals: int | None
|
|
22
|
+
usage_limit: int | None
|
|
23
|
+
restrict_to: list[str] | None
|
|
24
|
+
expires_at: datetime | None
|
|
25
|
+
times_used: int
|
|
26
|
+
created_at: datetime
|
|
27
|
+
updated_at: datetime
|
|
28
|
+
import_meta: ImportMeta | None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@classmethod
|
|
32
|
+
def from_dict(cls, data: dict) -> Discount:
|
|
33
|
+
return Discount(
|
|
34
|
+
id = data['id'],
|
|
35
|
+
status = DiscountStatus(data['status']),
|
|
36
|
+
description = data['description'],
|
|
37
|
+
enabled_for_checkout = data['enabled_for_checkout'],
|
|
38
|
+
code = data.get('code'),
|
|
39
|
+
type = DiscountType(data['type']),
|
|
40
|
+
amount = data['amount'],
|
|
41
|
+
recur = data['recur'],
|
|
42
|
+
maximum_recurring_intervals = data.get('maximum_recurring_intervals'),
|
|
43
|
+
usage_limit = data.get('usage_limit'),
|
|
44
|
+
restrict_to = data.get('restrict_to'),
|
|
45
|
+
times_used = data['times_used'],
|
|
46
|
+
created_at = datetime.fromisoformat(data['created_at']),
|
|
47
|
+
updated_at = datetime.fromisoformat(data['updated_at']),
|
|
48
|
+
currency_code = CurrencyCode(data['currency_code']) if data.get('currency_code') else None,
|
|
49
|
+
expires_at = datetime.fromisoformat(data['expires_at']) if data.get('expires_at') else None,
|
|
50
|
+
import_meta = ImportMeta.from_dict(data['import_meta']) if data.get('import_meta') else None,
|
|
51
|
+
)
|