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,280 @@
|
|
|
1
|
+
from json import loads
|
|
2
|
+
from pytest import mark
|
|
3
|
+
from urllib.parse import unquote
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Collections import DiscountCollection
|
|
6
|
+
from paddle_billing.Entities.Discount import Discount
|
|
7
|
+
from paddle_billing.Entities.Discounts import DiscountStatus, DiscountType
|
|
8
|
+
from paddle_billing.Entities.Shared import CurrencyCode, Status
|
|
9
|
+
|
|
10
|
+
from paddle_billing.Resources.Discounts.Operations import CreateDiscount, ListDiscounts, UpdateDiscount
|
|
11
|
+
from paddle_billing.Resources.Shared.Operations import Pager
|
|
12
|
+
|
|
13
|
+
from tests.Utils.TestClient import mock_requests, test_client
|
|
14
|
+
from tests.Utils.ReadsFixture import ReadsFixtures
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class TestDiscountsClient:
|
|
18
|
+
@mark.parametrize(
|
|
19
|
+
'operation, expected_request_body, expected_response_status, expected_response_body, expected_url',
|
|
20
|
+
[
|
|
21
|
+
(
|
|
22
|
+
CreateDiscount(
|
|
23
|
+
'10',
|
|
24
|
+
'Nonprofit discount',
|
|
25
|
+
DiscountType.Percentage,
|
|
26
|
+
True,
|
|
27
|
+
True,
|
|
28
|
+
CurrencyCode.USD,
|
|
29
|
+
),
|
|
30
|
+
ReadsFixtures.read_raw_json_fixture('request/create_basic'),
|
|
31
|
+
200,
|
|
32
|
+
ReadsFixtures.read_raw_json_fixture('response/minimal_entity'),
|
|
33
|
+
'/discounts',
|
|
34
|
+
), (
|
|
35
|
+
CreateDiscount(
|
|
36
|
+
'10',
|
|
37
|
+
'Nonprofit discount',
|
|
38
|
+
DiscountType.Percentage,
|
|
39
|
+
True,
|
|
40
|
+
True,
|
|
41
|
+
CurrencyCode.USD,
|
|
42
|
+
code='ABCDE12345',
|
|
43
|
+
maximum_recurring_intervals=5,
|
|
44
|
+
usage_limit=1000,
|
|
45
|
+
restrict_to=['pro_01gsz4t5hdjse780zja8vvr7jg', 'pro_01gsz4s0w61y0pp88528f1wvvb'],
|
|
46
|
+
expires_at='2025-01-01 10:00:00',
|
|
47
|
+
),
|
|
48
|
+
ReadsFixtures.read_raw_json_fixture('request/create_full'),
|
|
49
|
+
200,
|
|
50
|
+
ReadsFixtures.read_raw_json_fixture('response/full_entity'),
|
|
51
|
+
'/discounts',
|
|
52
|
+
),
|
|
53
|
+
],
|
|
54
|
+
ids=[
|
|
55
|
+
"Create discount with basic data",
|
|
56
|
+
"Create discount with full data",
|
|
57
|
+
],
|
|
58
|
+
)
|
|
59
|
+
def test_create_discount_uses_expected_payload(
|
|
60
|
+
self,
|
|
61
|
+
test_client,
|
|
62
|
+
mock_requests,
|
|
63
|
+
operation,
|
|
64
|
+
expected_request_body,
|
|
65
|
+
expected_response_status,
|
|
66
|
+
expected_response_body,
|
|
67
|
+
expected_url,
|
|
68
|
+
):
|
|
69
|
+
expected_url = f"{test_client.base_url}{expected_url}"
|
|
70
|
+
mock_requests.post(expected_url, status_code=expected_response_status, text=expected_response_body)
|
|
71
|
+
|
|
72
|
+
response = test_client.client.discounts.create(operation)
|
|
73
|
+
response_json = test_client.client.discounts.response.json()
|
|
74
|
+
request_json = test_client.client.payload
|
|
75
|
+
last_request = mock_requests.last_request
|
|
76
|
+
|
|
77
|
+
assert isinstance(response, Discount)
|
|
78
|
+
assert last_request is not None
|
|
79
|
+
assert last_request.method == 'POST'
|
|
80
|
+
assert test_client.client.status_code == expected_response_status
|
|
81
|
+
assert unquote(last_request.url) == expected_url, \
|
|
82
|
+
"The URL does not match the expected URL, verify the query string is correct"
|
|
83
|
+
assert loads(request_json) == loads(expected_request_body), \
|
|
84
|
+
"The request JSON doesn't match the expected fixture JSON"
|
|
85
|
+
assert response_json == loads(str(expected_response_body)), \
|
|
86
|
+
"The response JSON doesn't match the expected fixture JSON"
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@mark.parametrize(
|
|
90
|
+
'discount_id, operation, expected_request_body, expected_response_status, expected_response_body, expected_url',
|
|
91
|
+
[
|
|
92
|
+
(
|
|
93
|
+
'dsc_01h83xenpcfjyhkqr4x214m02x',
|
|
94
|
+
UpdateDiscount(enabled_for_checkout=False),
|
|
95
|
+
ReadsFixtures.read_raw_json_fixture('request/update_single'),
|
|
96
|
+
200,
|
|
97
|
+
ReadsFixtures.read_raw_json_fixture('response/full_entity'),
|
|
98
|
+
'/discounts/dsc_01h83xenpcfjyhkqr4x214m02x',
|
|
99
|
+
), (
|
|
100
|
+
'dsc_01h83xenpcfjyhkqr4x214m02x',
|
|
101
|
+
UpdateDiscount(enabled_for_checkout=False, code=None),
|
|
102
|
+
ReadsFixtures.read_raw_json_fixture('request/update_partial'),
|
|
103
|
+
200,
|
|
104
|
+
ReadsFixtures.read_raw_json_fixture('response/full_entity'),
|
|
105
|
+
'/discounts/dsc_01h83xenpcfjyhkqr4x214m02x',
|
|
106
|
+
), (
|
|
107
|
+
'dsc_01h83xenpcfjyhkqr4x214m02x',
|
|
108
|
+
UpdateDiscount(
|
|
109
|
+
description = 'Nonprofit discount',
|
|
110
|
+
enabled_for_checkout = True,
|
|
111
|
+
type = DiscountType.Percentage,
|
|
112
|
+
amount = '10',
|
|
113
|
+
recur = True,
|
|
114
|
+
currency_code = CurrencyCode.USD,
|
|
115
|
+
code = 'ABCDE12345',
|
|
116
|
+
maximum_recurring_intervals = 5,
|
|
117
|
+
usage_limit = 1000,
|
|
118
|
+
expires_at = '2025-01-01 10:00:00',
|
|
119
|
+
status = DiscountStatus.Active,
|
|
120
|
+
restrict_to = [
|
|
121
|
+
'pro_01gsz4t5hdjse780zja8vvr7jg',
|
|
122
|
+
'pro_01gsz4s0w61y0pp88528f1wvvb',
|
|
123
|
+
],
|
|
124
|
+
),
|
|
125
|
+
ReadsFixtures.read_raw_json_fixture('request/update_full'),
|
|
126
|
+
200,
|
|
127
|
+
ReadsFixtures.read_raw_json_fixture('response/full_entity'),
|
|
128
|
+
'/discounts/dsc_01h83xenpcfjyhkqr4x214m02x'
|
|
129
|
+
),
|
|
130
|
+
],
|
|
131
|
+
ids=[
|
|
132
|
+
"Update discount with single new value",
|
|
133
|
+
"Update discount with partial new values",
|
|
134
|
+
"Update discount with completely new values",
|
|
135
|
+
],
|
|
136
|
+
)
|
|
137
|
+
def test_update_discount_uses_expected_payload(
|
|
138
|
+
self,
|
|
139
|
+
test_client,
|
|
140
|
+
mock_requests,
|
|
141
|
+
discount_id,
|
|
142
|
+
operation,
|
|
143
|
+
expected_request_body,
|
|
144
|
+
expected_response_status,
|
|
145
|
+
expected_response_body,
|
|
146
|
+
expected_url,
|
|
147
|
+
):
|
|
148
|
+
expected_url = f"{test_client.base_url}{expected_url}"
|
|
149
|
+
mock_requests.patch(expected_url, status_code=expected_response_status, text=expected_response_body)
|
|
150
|
+
|
|
151
|
+
response = test_client.client.discounts.update(discount_id, operation)
|
|
152
|
+
response_json = test_client.client.discounts.response.json()
|
|
153
|
+
request_json = test_client.client.payload
|
|
154
|
+
last_request = mock_requests.last_request
|
|
155
|
+
|
|
156
|
+
assert isinstance(response, Discount)
|
|
157
|
+
assert last_request is not None
|
|
158
|
+
assert last_request.method == 'PATCH'
|
|
159
|
+
assert test_client.client.status_code == expected_response_status
|
|
160
|
+
assert unquote(last_request.url) == expected_url, \
|
|
161
|
+
"The URL does not match the expected URL, verify the query string is correct"
|
|
162
|
+
assert loads(request_json) == loads(expected_request_body), \
|
|
163
|
+
"The request JSON doesn't match the expected fixture JSON"
|
|
164
|
+
assert response_json == loads(str(expected_response_body)), \
|
|
165
|
+
"The response JSON doesn't match the expected fixture JSON"
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
@mark.parametrize(
|
|
169
|
+
'operation, expected_response_status, expected_response_body, expected_url',
|
|
170
|
+
[
|
|
171
|
+
(
|
|
172
|
+
ListDiscounts(),
|
|
173
|
+
200,
|
|
174
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
175
|
+
'/discounts',
|
|
176
|
+
), (
|
|
177
|
+
ListDiscounts(Pager()),
|
|
178
|
+
200,
|
|
179
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
180
|
+
'/discounts?order_by=id[asc]&per_page=50',
|
|
181
|
+
), (
|
|
182
|
+
ListDiscounts(Pager(after='dsc_01h83xenpcfjyhkqr4x214m02x')),
|
|
183
|
+
200,
|
|
184
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
185
|
+
'/discounts?after=dsc_01h83xenpcfjyhkqr4x214m02x&order_by=id[asc]&per_page=50',
|
|
186
|
+
), (
|
|
187
|
+
ListDiscounts(statuses=[Status.Archived]),
|
|
188
|
+
200,
|
|
189
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
190
|
+
'/discounts?status=archived',
|
|
191
|
+
), (
|
|
192
|
+
ListDiscounts(ids=['dsc_01h83xenpcfjyhkqr4x214m02x']),
|
|
193
|
+
200,
|
|
194
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
195
|
+
'/discounts?id=dsc_01h83xenpcfjyhkqr4x214m02x',
|
|
196
|
+
), (
|
|
197
|
+
ListDiscounts(ids=['dsc_01h83xenpcfjyhkqr4x214m02x', 'dsc_01gtgraak4chyhnp47rrdv89ad']),
|
|
198
|
+
200,
|
|
199
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
200
|
+
'/discounts?id=dsc_01h83xenpcfjyhkqr4x214m02x,dsc_01gtgraak4chyhnp47rrdv89ad',
|
|
201
|
+
), (
|
|
202
|
+
ListDiscounts(codes=['ABCDE12345']),
|
|
203
|
+
200,
|
|
204
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
205
|
+
'/discounts?code=ABCDE12345',
|
|
206
|
+
), (
|
|
207
|
+
ListDiscounts(codes=['ABCDE12345', '54321EDCBA']),
|
|
208
|
+
200,
|
|
209
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
210
|
+
'/discounts?code=ABCDE12345,54321EDCBA',
|
|
211
|
+
),
|
|
212
|
+
],
|
|
213
|
+
ids=[
|
|
214
|
+
"List discounts without pagination",
|
|
215
|
+
"List discounts with default pagination",
|
|
216
|
+
"List paginated discounts after specified discount id",
|
|
217
|
+
"List discounts filtered by archived status",
|
|
218
|
+
"List discounts filtered by id",
|
|
219
|
+
"List discounts filtered by multiple ids",
|
|
220
|
+
"List discounts filtered by discount id",
|
|
221
|
+
"List discounts filtered by multiple discount ids",
|
|
222
|
+
],
|
|
223
|
+
)
|
|
224
|
+
def test_list_discounts_returns_expected_response(
|
|
225
|
+
self,
|
|
226
|
+
test_client,
|
|
227
|
+
mock_requests,
|
|
228
|
+
operation,
|
|
229
|
+
expected_response_status,
|
|
230
|
+
expected_response_body,
|
|
231
|
+
expected_url,
|
|
232
|
+
):
|
|
233
|
+
expected_url = f"{test_client.base_url}{expected_url}"
|
|
234
|
+
mock_requests.get(expected_url, status_code=expected_response_status)
|
|
235
|
+
|
|
236
|
+
response = test_client.client.discounts.list(operation)
|
|
237
|
+
last_request = mock_requests.last_request
|
|
238
|
+
|
|
239
|
+
assert isinstance(response, DiscountCollection)
|
|
240
|
+
assert last_request is not None
|
|
241
|
+
assert last_request.method == 'GET'
|
|
242
|
+
assert test_client.client.status_code == expected_response_status
|
|
243
|
+
assert unquote(last_request.url) == expected_url, \
|
|
244
|
+
"The URL does not match the expected URL, verify the query string is correct"
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
@mark.parametrize(
|
|
248
|
+
'discount_id, expected_response_status, expected_response_body, expected_url',
|
|
249
|
+
[(
|
|
250
|
+
'dsc_01h83xenpcfjyhkqr4x214m02x',
|
|
251
|
+
200,
|
|
252
|
+
ReadsFixtures.read_raw_json_fixture('response/full_entity'),
|
|
253
|
+
'/discounts/dsc_01h83xenpcfjyhkqr4x214m02x',
|
|
254
|
+
)],
|
|
255
|
+
ids=["Get discount"],
|
|
256
|
+
)
|
|
257
|
+
def test_get_discounts_returns_expected_response(
|
|
258
|
+
self,
|
|
259
|
+
test_client,
|
|
260
|
+
mock_requests,
|
|
261
|
+
discount_id,
|
|
262
|
+
expected_response_status,
|
|
263
|
+
expected_response_body,
|
|
264
|
+
expected_url,
|
|
265
|
+
):
|
|
266
|
+
expected_url = f"{test_client.base_url}{expected_url}"
|
|
267
|
+
mock_requests.get(expected_url, status_code=expected_response_status, text=expected_response_body)
|
|
268
|
+
|
|
269
|
+
response = test_client.client.discounts.get(discount_id)
|
|
270
|
+
response_json = test_client.client.discounts.response.json()
|
|
271
|
+
last_request = mock_requests.last_request
|
|
272
|
+
|
|
273
|
+
assert isinstance(response, Discount)
|
|
274
|
+
assert last_request is not None
|
|
275
|
+
assert last_request.method == 'GET'
|
|
276
|
+
assert test_client.client.status_code == expected_response_status
|
|
277
|
+
assert unquote(last_request.url) == expected_url, \
|
|
278
|
+
"The URL does not match the expected URL, verify the query string is correct"
|
|
279
|
+
assert response_json == loads(str(expected_response_body)), \
|
|
280
|
+
"The response JSON generated by ResponseParser() doesn't match the expected fixture JSON"
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
from json import loads
|
|
2
|
+
from pytest import mark
|
|
3
|
+
from urllib.parse import unquote
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Collections import EventTypeCollection
|
|
6
|
+
|
|
7
|
+
from tests.Utils.TestClient import mock_requests, test_client
|
|
8
|
+
from tests.Utils.ReadsFixture import ReadsFixtures
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class TestEventTypesClient:
|
|
12
|
+
@mark.parametrize(
|
|
13
|
+
'expected_response_status, expected_response_body, expected_url',
|
|
14
|
+
[(
|
|
15
|
+
200,
|
|
16
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
17
|
+
'/event-types',
|
|
18
|
+
)],
|
|
19
|
+
ids=["List event types"],
|
|
20
|
+
)
|
|
21
|
+
def test_list_event_types_returns_expected_response(
|
|
22
|
+
self,
|
|
23
|
+
test_client,
|
|
24
|
+
mock_requests,
|
|
25
|
+
expected_response_status,
|
|
26
|
+
expected_response_body,
|
|
27
|
+
expected_url,
|
|
28
|
+
):
|
|
29
|
+
expected_url = f"{test_client.base_url}{expected_url}"
|
|
30
|
+
mock_requests.get(expected_url, status_code=expected_response_status, text=expected_response_body)
|
|
31
|
+
|
|
32
|
+
event_types = test_client.client.event_types.list()
|
|
33
|
+
response_json = test_client.client.event_types.response.json()
|
|
34
|
+
last_request = mock_requests.last_request
|
|
35
|
+
|
|
36
|
+
assert isinstance(event_types, EventTypeCollection)
|
|
37
|
+
assert last_request is not None
|
|
38
|
+
assert last_request.method == 'GET'
|
|
39
|
+
assert test_client.client.status_code == expected_response_status
|
|
40
|
+
assert unquote(last_request.url) == expected_url, \
|
|
41
|
+
"The URL does not match the expected URL"
|
|
42
|
+
assert response_json == loads(str(expected_response_body)), \
|
|
43
|
+
"The response JSON doesn't match the expected fixture JSON"
|
|
File without changes
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from json import loads
|
|
2
|
+
from pytest import mark
|
|
3
|
+
from urllib.parse import unquote
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Collections import EventCollection
|
|
6
|
+
|
|
7
|
+
from paddle_billing.Resources.Events.Operations import ListEvents
|
|
8
|
+
from paddle_billing.Resources.Shared.Operations import Pager
|
|
9
|
+
|
|
10
|
+
from tests.Utils.TestClient import mock_requests, test_client
|
|
11
|
+
from tests.Utils.ReadsFixture import ReadsFixtures
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class TestEventsClient:
|
|
15
|
+
@mark.parametrize(
|
|
16
|
+
'operation, expected_response_status, expected_response_body, expected_url',
|
|
17
|
+
[
|
|
18
|
+
(
|
|
19
|
+
ListEvents(),
|
|
20
|
+
200,
|
|
21
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
22
|
+
'/events',
|
|
23
|
+
), (
|
|
24
|
+
ListEvents(Pager()),
|
|
25
|
+
200,
|
|
26
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
27
|
+
'/events?order_by=id[asc]&per_page=50',
|
|
28
|
+
), (
|
|
29
|
+
ListEvents(Pager(after='evt_01h83xenpcfjyhkqr4x214m02x')),
|
|
30
|
+
200,
|
|
31
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
32
|
+
'/events?after=evt_01h83xenpcfjyhkqr4x214m02x&order_by=id[asc]&per_page=50',
|
|
33
|
+
),
|
|
34
|
+
],
|
|
35
|
+
ids=[
|
|
36
|
+
"List events",
|
|
37
|
+
"List paginated events",
|
|
38
|
+
"List paginated events after specified event id",
|
|
39
|
+
],
|
|
40
|
+
)
|
|
41
|
+
def test_list_events_returns_expected_response(
|
|
42
|
+
self,
|
|
43
|
+
test_client,
|
|
44
|
+
mock_requests,
|
|
45
|
+
operation,
|
|
46
|
+
expected_response_status,
|
|
47
|
+
expected_response_body,
|
|
48
|
+
expected_url,
|
|
49
|
+
):
|
|
50
|
+
expected_url = f"{test_client.base_url}{expected_url}"
|
|
51
|
+
mock_requests.get(expected_url, status_code=expected_response_status, text=expected_response_body)
|
|
52
|
+
|
|
53
|
+
events = test_client.client.events.list(operation)
|
|
54
|
+
response_json = test_client.client.events.response.json()
|
|
55
|
+
last_request = mock_requests.last_request
|
|
56
|
+
|
|
57
|
+
assert isinstance(events, EventCollection)
|
|
58
|
+
assert last_request is not None
|
|
59
|
+
assert last_request.method == 'GET'
|
|
60
|
+
assert test_client.client.status_code == expected_response_status
|
|
61
|
+
assert unquote(last_request.url) == expected_url, \
|
|
62
|
+
"The URL does not match the expected URL, verify the query string is correct"
|
|
63
|
+
assert response_json == loads(str(expected_response_body)), \
|
|
64
|
+
"The response JSON doesn't match the expected fixture JSON"
|
|
File without changes
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
from json import loads
|
|
2
|
+
from pytest import mark
|
|
3
|
+
from urllib.parse import unquote
|
|
4
|
+
|
|
5
|
+
from paddle_billing.Entities.Collections import NotificationLogCollection
|
|
6
|
+
|
|
7
|
+
from paddle_billing.Resources.NotificationLogs.Operations import ListNotificationLogs
|
|
8
|
+
from paddle_billing.Resources.Shared.Operations import Pager
|
|
9
|
+
|
|
10
|
+
from tests.Utils.TestClient import mock_requests, test_client
|
|
11
|
+
from tests.Utils.ReadsFixture import ReadsFixtures
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# The notification id to use for these tests
|
|
15
|
+
TEST_ID = 'ntf_01hher6hqs35t9dzq84g3ggqvh'
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class TestNotificationLogsClient:
|
|
19
|
+
@mark.parametrize(
|
|
20
|
+
'operation, expected_response_status, expected_response_body, expected_url',
|
|
21
|
+
[
|
|
22
|
+
(
|
|
23
|
+
ListNotificationLogs(),
|
|
24
|
+
200,
|
|
25
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
26
|
+
f"/notifications/{TEST_ID}/logs"
|
|
27
|
+
), (
|
|
28
|
+
ListNotificationLogs(Pager()),
|
|
29
|
+
200,
|
|
30
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
31
|
+
f"/notifications/{TEST_ID}/logs?order_by=id[asc]&per_page=50"
|
|
32
|
+
), (
|
|
33
|
+
ListNotificationLogs(Pager(after='pro_01gsz4s0w61y0pp88528f1wvvb')),
|
|
34
|
+
200,
|
|
35
|
+
ReadsFixtures.read_raw_json_fixture('response/list_default'),
|
|
36
|
+
f"/notifications/{TEST_ID}/logs?after=pro_01gsz4s0w61y0pp88528f1wvvb&order_by=id[asc]&per_page=50"
|
|
37
|
+
),
|
|
38
|
+
],
|
|
39
|
+
ids=[
|
|
40
|
+
"List events",
|
|
41
|
+
"List paginated events",
|
|
42
|
+
"List paginated events after specified product id",
|
|
43
|
+
],
|
|
44
|
+
)
|
|
45
|
+
def test_list_notification_logs_returns_expected_response(
|
|
46
|
+
self,
|
|
47
|
+
test_client,
|
|
48
|
+
mock_requests,
|
|
49
|
+
operation,
|
|
50
|
+
expected_response_status,
|
|
51
|
+
expected_response_body,
|
|
52
|
+
expected_url,
|
|
53
|
+
):
|
|
54
|
+
expected_url = f"{test_client.base_url}{expected_url}"
|
|
55
|
+
mock_requests.get(expected_url, status_code=expected_response_status, text=expected_response_body)
|
|
56
|
+
|
|
57
|
+
response = test_client.client.notification_logs.list(TEST_ID, operation=operation)
|
|
58
|
+
response_json = test_client.client.notification_logs.response.json()
|
|
59
|
+
last_request = mock_requests.last_request
|
|
60
|
+
|
|
61
|
+
assert isinstance(response, NotificationLogCollection)
|
|
62
|
+
assert last_request is not None
|
|
63
|
+
assert last_request.method == 'GET'
|
|
64
|
+
assert test_client.client.status_code == expected_response_status
|
|
65
|
+
assert unquote(last_request.url) == expected_url, \
|
|
66
|
+
"The URL does not match the expected URL"
|
|
67
|
+
assert response_json == loads(str(expected_response_body)), \
|
|
68
|
+
"The response JSON doesn't match the expected fixture JSON"
|
|
File without changes
|