diff --git a/paddle_billing/Client.py b/paddle_billing/Client.py index a9073df1..8160762b 100644 --- a/paddle_billing/Client.py +++ b/paddle_billing/Client.py @@ -1,4 +1,4 @@ -from json import dumps as json_dumps +from json import dumps as json_dumps, JSONEncoder from logging import Logger, getLogger from requests import Response, RequestException, Session from requests.adapters import HTTPAdapter @@ -9,6 +9,7 @@ from paddle_billing.FiltersUndefined import FiltersUndefined from paddle_billing.HasParameters import HasParameters from paddle_billing.Options import Options +from paddle_billing.PaddleStrEnum import PaddleStrEnum from paddle_billing.ResponseParser import ResponseParser from paddle_billing.Logger.NullHandler import NullHandler @@ -30,6 +31,12 @@ from paddle_billing.Resources.Subscriptions.SubscriptionsClient import SubscriptionsClient from paddle_billing.Resources.Transactions.TransactionsClient import TransactionsClient +class PayloadEncoder(JSONEncoder): + def default(self, z): + if hasattr(z, 'to_json') and callable(z.to_json): + return z.to_json() + + return super().default(z) class Client: """ @@ -100,7 +107,7 @@ def serialize_json_payload(payload: dict) -> str: if payload.get('custom_data') and 'data' in payload['custom_data']: payload['custom_data'] = payload['custom_data']['data'] - json_payload = json_dumps(payload) + json_payload = json_dumps(payload, cls=PayloadEncoder) final_json = json_payload if json_payload != '[]' else '{}' return final_json diff --git a/paddle_billing/Entities/Discounts/DiscountStatus.py b/paddle_billing/Entities/Discounts/DiscountStatus.py index 110b3774..768a2f60 100644 --- a/paddle_billing/Entities/Discounts/DiscountStatus.py +++ b/paddle_billing/Entities/Discounts/DiscountStatus.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class DiscountStatus(PaddleStrEnum): - Active = 'active' - Archived = 'archived' - Expired = 'expired' - Used = 'used' +class DiscountStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Active: "DiscountStatus" = 'active' + Archived: "DiscountStatus" = 'archived' + Expired: "DiscountStatus" = 'expired' + Used: "DiscountStatus" = 'used' diff --git a/paddle_billing/Entities/Discounts/DiscountType.py b/paddle_billing/Entities/Discounts/DiscountType.py index e257f38e..8be856f1 100644 --- a/paddle_billing/Entities/Discounts/DiscountType.py +++ b/paddle_billing/Entities/Discounts/DiscountType.py @@ -1,7 +1,7 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class DiscountType(PaddleStrEnum): - Flat = 'flat' - FlatPerSeat = 'flat_per_seat' - Percentage = 'percentage' +class DiscountType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Flat: "DiscountType" = 'flat' + FlatPerSeat: "DiscountType" = 'flat_per_seat' + Percentage: "DiscountType" = 'percentage' diff --git a/paddle_billing/Entities/Events/EventTypeName.py b/paddle_billing/Entities/Events/EventTypeName.py index 8eddc88e..a900d5da 100644 --- a/paddle_billing/Entities/Events/EventTypeName.py +++ b/paddle_billing/Entities/Events/EventTypeName.py @@ -1,52 +1,52 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class EventTypeName(PaddleStrEnum): - AddressCreated = 'address.created' - AddressImported = 'address.imported' - AddressUpdated = 'address.updated' - AdjustmentCreated = 'adjustment.created' - AdjustmentUpdated = 'adjustment.updated' - BusinessCreated = 'business.created' - BusinessImported = 'business.imported' - BusinessUpdated = 'business.updated' - CustomerCreated = 'customer.created' - CustomerImported = 'customer.imported' - CustomerUpdated = 'customer.updated' - DiscountCreated = 'discount.created' - DiscountImported = 'discount.imported' - DiscountUpdated = 'discount.updated' - InvoiceCanceled = 'invoice.canceled' - InvoiceCreated = 'invoice.created' - InvoiceIssued = 'invoice.issued' - InvoiceOverdue = 'invoice.overdue' - InvoicePaid = 'invoice.paid' - InvoiceScheduled = 'invoice.scheduled' - PayoutCreated = 'payout.created' - PayoutPaid = 'payout.paid' - PriceCreated = 'price.created' - PriceUpdated = 'price.updated' - PriceImported = 'price.imported' - ProductCreated = 'product.created' - ProductUpdated = 'product.updated' - ProductImported = 'product.imported' - SubscriptionActivated = 'subscription.activated' - SubscriptionCanceled = 'subscription.canceled' - SubscriptionCreated = 'subscription.created' - SubscriptionImported = 'subscription.imported' - SubscriptionPastDue = 'subscription.past_due' - SubscriptionPaused = 'subscription.paused' - SubscriptionResumed = 'subscription.resumed' - SubscriptionTrialing = 'subscription.trialing' - SubscriptionUpdated = 'subscription.updated' - TransactionBilled = 'transaction.billed' - TransactionCanceled = 'transaction.canceled' - TransactionCompleted = 'transaction.completed' - TransactionCreated = 'transaction.created' - TransactionPaid = 'transaction.paid' - TransactionPastDue = 'transaction.past_due' - TransactionPaymentFailed = 'transaction.payment_failed' - TransactionReady = 'transaction.ready' - TransactionUpdated = 'transaction.updated' - ReportCreated = 'report.created' - ReportUpdated = 'report.updated' +class EventTypeName(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + AddressCreated: "EventTypeName" = 'address.created' + AddressImported: "EventTypeName" = 'address.imported' + AddressUpdated: "EventTypeName" = 'address.updated' + AdjustmentCreated: "EventTypeName" = 'adjustment.created' + AdjustmentUpdated: "EventTypeName" = 'adjustment.updated' + BusinessCreated: "EventTypeName" = 'business.created' + BusinessImported: "EventTypeName" = 'business.imported' + BusinessUpdated: "EventTypeName" = 'business.updated' + CustomerCreated: "EventTypeName" = 'customer.created' + CustomerImported: "EventTypeName" = 'customer.imported' + CustomerUpdated: "EventTypeName" = 'customer.updated' + DiscountCreated: "EventTypeName" = 'discount.created' + DiscountImported: "EventTypeName" = 'discount.imported' + DiscountUpdated: "EventTypeName" = 'discount.updated' + InvoiceCanceled: "EventTypeName" = 'invoice.canceled' + InvoiceCreated: "EventTypeName" = 'invoice.created' + InvoiceIssued: "EventTypeName" = 'invoice.issued' + InvoiceOverdue: "EventTypeName" = 'invoice.overdue' + InvoicePaid: "EventTypeName" = 'invoice.paid' + InvoiceScheduled: "EventTypeName" = 'invoice.scheduled' + PayoutCreated: "EventTypeName" = 'payout.created' + PayoutPaid: "EventTypeName" = 'payout.paid' + PriceCreated: "EventTypeName" = 'price.created' + PriceUpdated: "EventTypeName" = 'price.updated' + PriceImported: "EventTypeName" = 'price.imported' + ProductCreated: "EventTypeName" = 'product.created' + ProductUpdated: "EventTypeName" = 'product.updated' + ProductImported: "EventTypeName" = 'product.imported' + SubscriptionActivated: "EventTypeName" = 'subscription.activated' + SubscriptionCanceled: "EventTypeName" = 'subscription.canceled' + SubscriptionCreated: "EventTypeName" = 'subscription.created' + SubscriptionImported: "EventTypeName" = 'subscription.imported' + SubscriptionPastDue: "EventTypeName" = 'subscription.past_due' + SubscriptionPaused: "EventTypeName" = 'subscription.paused' + SubscriptionResumed: "EventTypeName" = 'subscription.resumed' + SubscriptionTrialing: "EventTypeName" = 'subscription.trialing' + SubscriptionUpdated: "EventTypeName" = 'subscription.updated' + TransactionBilled: "EventTypeName" = 'transaction.billed' + TransactionCanceled: "EventTypeName" = 'transaction.canceled' + TransactionCompleted: "EventTypeName" = 'transaction.completed' + TransactionCreated: "EventTypeName" = 'transaction.created' + TransactionPaid: "EventTypeName" = 'transaction.paid' + TransactionPastDue: "EventTypeName" = 'transaction.past_due' + TransactionPaymentFailed: "EventTypeName" = 'transaction.payment_failed' + TransactionReady: "EventTypeName" = 'transaction.ready' + TransactionUpdated: "EventTypeName" = 'transaction.updated' + ReportCreated: "EventTypeName" = 'report.created' + ReportUpdated: "EventTypeName" = 'report.updated' diff --git a/paddle_billing/Entities/NotificationSettings/NotificationSettingType.py b/paddle_billing/Entities/NotificationSettings/NotificationSettingType.py index c15d8665..d6049625 100644 --- a/paddle_billing/Entities/NotificationSettings/NotificationSettingType.py +++ b/paddle_billing/Entities/NotificationSettings/NotificationSettingType.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class NotificationSettingType(PaddleStrEnum): - Email = 'email' - Url = 'url' +class NotificationSettingType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Email: "NotificationSettingType" = 'email' + Url: "NotificationSettingType" = 'url' diff --git a/paddle_billing/Entities/Notifications/NotificationOrigin.py b/paddle_billing/Entities/Notifications/NotificationOrigin.py index 8d4396a5..226b84ee 100644 --- a/paddle_billing/Entities/Notifications/NotificationOrigin.py +++ b/paddle_billing/Entities/Notifications/NotificationOrigin.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class NotificationOrigin(PaddleStrEnum): - Event = 'event' - Replay = 'replay' +class NotificationOrigin(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Event: "NotificationOrigin" = 'event' + Replay: "NotificationOrigin" = 'replay' diff --git a/paddle_billing/Entities/Notifications/NotificationPayoutStatus.py b/paddle_billing/Entities/Notifications/NotificationPayoutStatus.py index 8a921783..15436f68 100644 --- a/paddle_billing/Entities/Notifications/NotificationPayoutStatus.py +++ b/paddle_billing/Entities/Notifications/NotificationPayoutStatus.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class NotificationPayoutStatus(PaddleStrEnum): - Unpaid = 'unpaid' - Paid = 'paid' +class NotificationPayoutStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Unpaid: "NotificationPayoutStatus" = 'unpaid' + Paid: "NotificationPayoutStatus" = 'paid' diff --git a/paddle_billing/Entities/Notifications/NotificationStatus.py b/paddle_billing/Entities/Notifications/NotificationStatus.py index f438f550..469a3c04 100644 --- a/paddle_billing/Entities/Notifications/NotificationStatus.py +++ b/paddle_billing/Entities/Notifications/NotificationStatus.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class NotificationStatus(PaddleStrEnum): - NotAttempted = 'not_attempted' - NeedsRetry = 'needs_retry' - Delivered = 'delivered' - Failed = 'failed' +class NotificationStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + NotAttempted: "NotificationStatus" = 'not_attempted' + NeedsRetry: "NotificationStatus" = 'needs_retry' + Delivered: "NotificationStatus" = 'delivered' + Failed: "NotificationStatus" = 'failed' diff --git a/paddle_billing/Entities/Reports/ReportFilterName.py b/paddle_billing/Entities/Reports/ReportFilterName.py index 9d8df22b..6c0b2f80 100644 --- a/paddle_billing/Entities/Reports/ReportFilterName.py +++ b/paddle_billing/Entities/Reports/ReportFilterName.py @@ -1,17 +1,17 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class ReportFilterName(PaddleStrEnum): - Action = 'action' - CollectionMode = 'collection_mode' - CurrencyCode = 'currency_code' - Origin = 'origin' - PriceStatus = 'price_status' - PriceType = 'price_type' - PriceUpdatedAt = 'price_updated_at' - ProductStatus = 'product_status' - ProductType = 'product_type' - ProductUpdatedAt = 'product_updated_at' - Status = 'status' - Type = 'type' - UpdatedAt = 'updated_at' +class ReportFilterName(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Action: "ReportFilterName" = 'action' + CollectionMode: "ReportFilterName" = 'collection_mode' + CurrencyCode: "ReportFilterName" = 'currency_code' + Origin: "ReportFilterName" = 'origin' + PriceStatus: "ReportFilterName" = 'price_status' + PriceType: "ReportFilterName" = 'price_type' + PriceUpdatedAt: "ReportFilterName" = 'price_updated_at' + ProductStatus: "ReportFilterName" = 'product_status' + ProductType: "ReportFilterName" = 'product_type' + ProductUpdatedAt: "ReportFilterName" = 'product_updated_at' + Status: "ReportFilterName" = 'status' + Type: "ReportFilterName" = 'type' + UpdatedAt: "ReportFilterName" = 'updated_at' diff --git a/paddle_billing/Entities/Reports/ReportFilterOperator.py b/paddle_billing/Entities/Reports/ReportFilterOperator.py index 829b5d5f..41c74af7 100644 --- a/paddle_billing/Entities/Reports/ReportFilterOperator.py +++ b/paddle_billing/Entities/Reports/ReportFilterOperator.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class ReportFilterOperator(PaddleStrEnum): - Lt = 'lt' - Gte = 'gte' +class ReportFilterOperator(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Lt: "ReportFilterOperator" = 'lt' + Gte: "ReportFilterOperator" = 'gte' diff --git a/paddle_billing/Entities/Reports/ReportStatus.py b/paddle_billing/Entities/Reports/ReportStatus.py index 60640919..27dde70a 100644 --- a/paddle_billing/Entities/Reports/ReportStatus.py +++ b/paddle_billing/Entities/Reports/ReportStatus.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class ReportStatus(PaddleStrEnum): - Pending = 'pending' - Ready = 'ready' - Failed = 'failed' - Expired = 'expired' +class ReportStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Pending: "ReportStatus" = 'pending' + Ready: "ReportStatus" = 'ready' + Failed: "ReportStatus" = 'failed' + Expired: "ReportStatus" = 'expired' diff --git a/paddle_billing/Entities/Reports/ReportType.py b/paddle_billing/Entities/Reports/ReportType.py index b5758907..d78ab93f 100644 --- a/paddle_billing/Entities/Reports/ReportType.py +++ b/paddle_billing/Entities/Reports/ReportType.py @@ -1,10 +1,10 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class ReportType(PaddleStrEnum): - Adjustments = 'adjustments' - AdjustmentLineItems = 'adjustment_line_items' - Discounts = 'discounts' - ProductsPrices = 'products_prices' - Transactions = 'transactions' - TransactionLineItems = 'transaction_line_items' +class ReportType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Adjustments: "ReportType" = 'adjustments' + AdjustmentLineItems: "ReportType" = 'adjustment_line_items' + Discounts: "ReportType" = 'discounts' + ProductsPrices: "ReportType" = 'products_prices' + Transactions: "ReportType" = 'transactions' + TransactionLineItems: "ReportType" = 'transaction_line_items' diff --git a/paddle_billing/Entities/Shared/Action.py b/paddle_billing/Entities/Shared/Action.py index d502529d..d0739dcc 100644 --- a/paddle_billing/Entities/Shared/Action.py +++ b/paddle_billing/Entities/Shared/Action.py @@ -1,10 +1,10 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Action(PaddleStrEnum): - Credit = 'credit' - CreditReverse = 'credit_reverse' - Refund = 'refund' - Chargeback = 'chargeback' - ChargebackReverse = 'chargeback_reverse' - ChargebackWarning = 'chargeback_warning' +class Action(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Credit: "Action" = 'credit' + CreditReverse: "Action" = 'credit_reverse' + Refund: "Action" = 'refund' + Chargeback: "Action" = 'chargeback' + ChargebackReverse: "Action" = 'chargeback_reverse' + ChargebackWarning: "Action" = 'chargeback_warning' diff --git a/paddle_billing/Entities/Shared/AdjustmentStatus.py b/paddle_billing/Entities/Shared/AdjustmentStatus.py index 0d0868c7..8ffb0bd3 100644 --- a/paddle_billing/Entities/Shared/AdjustmentStatus.py +++ b/paddle_billing/Entities/Shared/AdjustmentStatus.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class AdjustmentStatus(PaddleStrEnum): - PendingApproval = 'pending_approval' - Approved = 'approved' - Rejected = 'rejected' - Reversed = 'reversed' +class AdjustmentStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + PendingApproval: "AdjustmentStatus" = 'pending_approval' + Approved: "AdjustmentStatus" = 'approved' + Rejected: "AdjustmentStatus" = 'rejected' + Reversed: "AdjustmentStatus" = 'reversed' diff --git a/paddle_billing/Entities/Shared/AdjustmentType.py b/paddle_billing/Entities/Shared/AdjustmentType.py index a8f7d5b2..f3a3f4ce 100644 --- a/paddle_billing/Entities/Shared/AdjustmentType.py +++ b/paddle_billing/Entities/Shared/AdjustmentType.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class AdjustmentType(PaddleStrEnum): - Full = 'full' - Partial = 'partial' - Tax = 'tax' - Proration = 'proration' +class AdjustmentType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Full: "AdjustmentType" = 'full' + Partial: "AdjustmentType" = 'partial' + Tax: "AdjustmentType" = 'tax' + Proration: "AdjustmentType" = 'proration' diff --git a/paddle_billing/Entities/Shared/AvailablePaymentMethods.py b/paddle_billing/Entities/Shared/AvailablePaymentMethods.py index 965d548a..a06aec6e 100644 --- a/paddle_billing/Entities/Shared/AvailablePaymentMethods.py +++ b/paddle_billing/Entities/Shared/AvailablePaymentMethods.py @@ -1,11 +1,11 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class AvailablePaymentMethods(PaddleStrEnum): - Alipay = 'alipay' - ApplePay = 'apple_pay' - Bancontact = 'bancontact' - Card = 'card' - GooglePay = 'google_pay' - Ideal = 'ideal' - Paypal = 'paypal' +class AvailablePaymentMethods(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Alipay: "AvailablePaymentMethods" = 'alipay' + ApplePay: "AvailablePaymentMethods" = 'apple_pay' + Bancontact: "AvailablePaymentMethods" = 'bancontact' + Card: "AvailablePaymentMethods" = 'card' + GooglePay: "AvailablePaymentMethods" = 'google_pay' + Ideal: "AvailablePaymentMethods" = 'ideal' + Paypal: "AvailablePaymentMethods" = 'paypal' diff --git a/paddle_billing/Entities/Shared/CatalogType.py b/paddle_billing/Entities/Shared/CatalogType.py index 57171d58..6d1260d3 100644 --- a/paddle_billing/Entities/Shared/CatalogType.py +++ b/paddle_billing/Entities/Shared/CatalogType.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CatalogType(PaddleStrEnum): - Standard = 'standard' - Custom = 'custom' +class CatalogType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Standard: "CatalogType" = 'standard' + Custom: "CatalogType" = 'custom' diff --git a/paddle_billing/Entities/Shared/CollectionMode.py b/paddle_billing/Entities/Shared/CollectionMode.py index dbdc3fdd..ca8eb823 100644 --- a/paddle_billing/Entities/Shared/CollectionMode.py +++ b/paddle_billing/Entities/Shared/CollectionMode.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CollectionMode(PaddleStrEnum): - Automatic = 'automatic' - Manual = 'manual' +class CollectionMode(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Automatic: "CollectionMode" = 'automatic' + Manual: "CollectionMode" = 'manual' diff --git a/paddle_billing/Entities/Shared/CountryCode.py b/paddle_billing/Entities/Shared/CountryCode.py index f65ea9a9..ec1d0179 100644 --- a/paddle_billing/Entities/Shared/CountryCode.py +++ b/paddle_billing/Entities/Shared/CountryCode.py @@ -1,233 +1,233 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CountryCode(PaddleStrEnum): - AD = 'AD' - AE = 'AE' - AG = 'AG' - AI = 'AI' - AL = 'AL' - AM = 'AM' - AO = 'AO' - AR = 'AR' - AS = 'AS' - AT = 'AT' - AU = 'AU' - AW = 'AW' - AX = 'AX' - AZ = 'AZ' - BA = 'BA' - BB = 'BB' - BD = 'BD' - BE = 'BE' - BF = 'BF' - BG = 'BG' - BH = 'BH' - BI = 'BI' - BJ = 'BJ' - BL = 'BL' - BM = 'BM' - BN = 'BN' - BO = 'BO' - BQ = 'BQ' - BR = 'BR' - BS = 'BS' - BT = 'BT' - BV = 'BV' - BW = 'BW' - BZ = 'BZ' - CA = 'CA' - CC = 'CC' - CG = 'CG' - CH = 'CH' - CI = 'CI' - CK = 'CK' - CL = 'CL' - CM = 'CM' - CN = 'CN' - CO = 'CO' - CR = 'CR' - CV = 'CV' - CW = 'CW' - CX = 'CX' - CY = 'CY' - CZ = 'CZ' - DE = 'DE' - DJ = 'DJ' - DK = 'DK' - DM = 'DM' - DO = 'DO' - DZ = 'DZ' - EC = 'EC' - EE = 'EE' - EG = 'EG' - EH = 'EH' - ER = 'ER' - ES = 'ES' - ET = 'ET' - FI = 'FI' - FJ = 'FJ' - FK = 'FK' - FM = 'FM' - FO = 'FO' - FR = 'FR' - GA = 'GA' - GB = 'GB' - GD = 'GD' - GE = 'GE' - GF = 'GF' - GG = 'GG' - GH = 'GH' - GI = 'GI' - GL = 'GL' - GM = 'GM' - GN = 'GN' - GP = 'GP' - GQ = 'GQ' - GR = 'GR' - GS = 'GS' - GT = 'GT' - GU = 'GU' - GW = 'GW' - GY = 'GY' - HK = 'HK' - HM = 'HM' - HN = 'HN' - HR = 'HR' - HU = 'HU' - ID = 'ID' - IE = 'IE' - IL = 'IL' - IM = 'IM' - IN = 'IN' - IO = 'IO' - IQ = 'IQ' - IS = 'IS' - IT = 'IT' - JE = 'JE' - JM = 'JM' - JO = 'JO' - JP = 'JP' - KE = 'KE' - KG = 'KG' - KH = 'KH' - KI = 'KI' - KM = 'KM' - KN = 'KN' - KR = 'KR' - KW = 'KW' - KY = 'KY' - KZ = 'KZ' - LA = 'LA' - LB = 'LB' - LC = 'LC' - LI = 'LI' - LK = 'LK' - LR = 'LR' - LS = 'LS' - LT = 'LT' - LU = 'LU' - LV = 'LV' - MA = 'MA' - MC = 'MC' - MD = 'MD' - ME = 'ME' - MF = 'MF' - MG = 'MG' - MH = 'MH' - MK = 'MK' - MN = 'MN' - MO = 'MO' - MP = 'MP' - MQ = 'MQ' - MR = 'MR' - MS = 'MS' - MT = 'MT' - MU = 'MU' - MV = 'MV' - MW = 'MW' - MX = 'MX' - MY = 'MY' - MZ = 'MZ' - NA = 'NA' - NC = 'NC' - NE = 'NE' - NF = 'NF' - NG = 'NG' - NL = 'NL' - NO = 'NO' - NP = 'NP' - NR = 'NR' - NU = 'NU' - NZ = 'NZ' - OM = 'OM' - PA = 'PA' - PE = 'PE' - PF = 'PF' - PG = 'PG' - PH = 'PH' - PK = 'PK' - PL = 'PL' - PM = 'PM' - PN = 'PN' - PR = 'PR' - PS = 'PS' - PT = 'PT' - PW = 'PW' - PY = 'PY' - QA = 'QA' - RE = 'RE' - RO = 'RO' - RS = 'RS' - RW = 'RW' - SA = 'SA' - SB = 'SB' - SC = 'SC' - SE = 'SE' - SG = 'SG' - SH = 'SH' - SI = 'SI' - SJ = 'SJ' - SK = 'SK' - SL = 'SL' - SM = 'SM' - SN = 'SN' - SR = 'SR' - ST = 'ST' - SV = 'SV' - SX = 'SX' - SZ = 'SZ' - TC = 'TC' - TD = 'TD' - TF = 'TF' - TG = 'TG' - TH = 'TH' - TJ = 'TJ' - TK = 'TK' - TL = 'TL' - TM = 'TM' - TN = 'TN' - TO = 'TO' - TR = 'TR' - TT = 'TT' - TV = 'TV' - TW = 'TW' - TZ = 'TZ' - UA = 'UA' - UG = 'UG' - UM = 'UM' - US = 'US' - UY = 'UY' - UZ = 'UZ' - VA = 'VA' - VC = 'VC' - VG = 'VG' - VI = 'VI' - VN = 'VN' - VU = 'VU' - WF = 'WF' - WS = 'WS' - XK = 'XK' - YT = 'YT' - ZA = 'ZA' - ZM = 'ZM' +class CountryCode(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + AD: "CountryCode" = 'AD' + AE: "CountryCode" = 'AE' + AG: "CountryCode" = 'AG' + AI: "CountryCode" = 'AI' + AL: "CountryCode" = 'AL' + AM: "CountryCode" = 'AM' + AO: "CountryCode" = 'AO' + AR: "CountryCode" = 'AR' + AS: "CountryCode" = 'AS' + AT: "CountryCode" = 'AT' + AU: "CountryCode" = 'AU' + AW: "CountryCode" = 'AW' + AX: "CountryCode" = 'AX' + AZ: "CountryCode" = 'AZ' + BA: "CountryCode" = 'BA' + BB: "CountryCode" = 'BB' + BD: "CountryCode" = 'BD' + BE: "CountryCode" = 'BE' + BF: "CountryCode" = 'BF' + BG: "CountryCode" = 'BG' + BH: "CountryCode" = 'BH' + BI: "CountryCode" = 'BI' + BJ: "CountryCode" = 'BJ' + BL: "CountryCode" = 'BL' + BM: "CountryCode" = 'BM' + BN: "CountryCode" = 'BN' + BO: "CountryCode" = 'BO' + BQ: "CountryCode" = 'BQ' + BR: "CountryCode" = 'BR' + BS: "CountryCode" = 'BS' + BT: "CountryCode" = 'BT' + BV: "CountryCode" = 'BV' + BW: "CountryCode" = 'BW' + BZ: "CountryCode" = 'BZ' + CA: "CountryCode" = 'CA' + CC: "CountryCode" = 'CC' + CG: "CountryCode" = 'CG' + CH: "CountryCode" = 'CH' + CI: "CountryCode" = 'CI' + CK: "CountryCode" = 'CK' + CL: "CountryCode" = 'CL' + CM: "CountryCode" = 'CM' + CN: "CountryCode" = 'CN' + CO: "CountryCode" = 'CO' + CR: "CountryCode" = 'CR' + CV: "CountryCode" = 'CV' + CW: "CountryCode" = 'CW' + CX: "CountryCode" = 'CX' + CY: "CountryCode" = 'CY' + CZ: "CountryCode" = 'CZ' + DE: "CountryCode" = 'DE' + DJ: "CountryCode" = 'DJ' + DK: "CountryCode" = 'DK' + DM: "CountryCode" = 'DM' + DO: "CountryCode" = 'DO' + DZ: "CountryCode" = 'DZ' + EC: "CountryCode" = 'EC' + EE: "CountryCode" = 'EE' + EG: "CountryCode" = 'EG' + EH: "CountryCode" = 'EH' + ER: "CountryCode" = 'ER' + ES: "CountryCode" = 'ES' + ET: "CountryCode" = 'ET' + FI: "CountryCode" = 'FI' + FJ: "CountryCode" = 'FJ' + FK: "CountryCode" = 'FK' + FM: "CountryCode" = 'FM' + FO: "CountryCode" = 'FO' + FR: "CountryCode" = 'FR' + GA: "CountryCode" = 'GA' + GB: "CountryCode" = 'GB' + GD: "CountryCode" = 'GD' + GE: "CountryCode" = 'GE' + GF: "CountryCode" = 'GF' + GG: "CountryCode" = 'GG' + GH: "CountryCode" = 'GH' + GI: "CountryCode" = 'GI' + GL: "CountryCode" = 'GL' + GM: "CountryCode" = 'GM' + GN: "CountryCode" = 'GN' + GP: "CountryCode" = 'GP' + GQ: "CountryCode" = 'GQ' + GR: "CountryCode" = 'GR' + GS: "CountryCode" = 'GS' + GT: "CountryCode" = 'GT' + GU: "CountryCode" = 'GU' + GW: "CountryCode" = 'GW' + GY: "CountryCode" = 'GY' + HK: "CountryCode" = 'HK' + HM: "CountryCode" = 'HM' + HN: "CountryCode" = 'HN' + HR: "CountryCode" = 'HR' + HU: "CountryCode" = 'HU' + ID: "CountryCode" = 'ID' + IE: "CountryCode" = 'IE' + IL: "CountryCode" = 'IL' + IM: "CountryCode" = 'IM' + IN: "CountryCode" = 'IN' + IO: "CountryCode" = 'IO' + IQ: "CountryCode" = 'IQ' + IS: "CountryCode" = 'IS' + IT: "CountryCode" = 'IT' + JE: "CountryCode" = 'JE' + JM: "CountryCode" = 'JM' + JO: "CountryCode" = 'JO' + JP: "CountryCode" = 'JP' + KE: "CountryCode" = 'KE' + KG: "CountryCode" = 'KG' + KH: "CountryCode" = 'KH' + KI: "CountryCode" = 'KI' + KM: "CountryCode" = 'KM' + KN: "CountryCode" = 'KN' + KR: "CountryCode" = 'KR' + KW: "CountryCode" = 'KW' + KY: "CountryCode" = 'KY' + KZ: "CountryCode" = 'KZ' + LA: "CountryCode" = 'LA' + LB: "CountryCode" = 'LB' + LC: "CountryCode" = 'LC' + LI: "CountryCode" = 'LI' + LK: "CountryCode" = 'LK' + LR: "CountryCode" = 'LR' + LS: "CountryCode" = 'LS' + LT: "CountryCode" = 'LT' + LU: "CountryCode" = 'LU' + LV: "CountryCode" = 'LV' + MA: "CountryCode" = 'MA' + MC: "CountryCode" = 'MC' + MD: "CountryCode" = 'MD' + ME: "CountryCode" = 'ME' + MF: "CountryCode" = 'MF' + MG: "CountryCode" = 'MG' + MH: "CountryCode" = 'MH' + MK: "CountryCode" = 'MK' + MN: "CountryCode" = 'MN' + MO: "CountryCode" = 'MO' + MP: "CountryCode" = 'MP' + MQ: "CountryCode" = 'MQ' + MR: "CountryCode" = 'MR' + MS: "CountryCode" = 'MS' + MT: "CountryCode" = 'MT' + MU: "CountryCode" = 'MU' + MV: "CountryCode" = 'MV' + MW: "CountryCode" = 'MW' + MX: "CountryCode" = 'MX' + MY: "CountryCode" = 'MY' + MZ: "CountryCode" = 'MZ' + NA: "CountryCode" = 'NA' + NC: "CountryCode" = 'NC' + NE: "CountryCode" = 'NE' + NF: "CountryCode" = 'NF' + NG: "CountryCode" = 'NG' + NL: "CountryCode" = 'NL' + NO: "CountryCode" = 'NO' + NP: "CountryCode" = 'NP' + NR: "CountryCode" = 'NR' + NU: "CountryCode" = 'NU' + NZ: "CountryCode" = 'NZ' + OM: "CountryCode" = 'OM' + PA: "CountryCode" = 'PA' + PE: "CountryCode" = 'PE' + PF: "CountryCode" = 'PF' + PG: "CountryCode" = 'PG' + PH: "CountryCode" = 'PH' + PK: "CountryCode" = 'PK' + PL: "CountryCode" = 'PL' + PM: "CountryCode" = 'PM' + PN: "CountryCode" = 'PN' + PR: "CountryCode" = 'PR' + PS: "CountryCode" = 'PS' + PT: "CountryCode" = 'PT' + PW: "CountryCode" = 'PW' + PY: "CountryCode" = 'PY' + QA: "CountryCode" = 'QA' + RE: "CountryCode" = 'RE' + RO: "CountryCode" = 'RO' + RS: "CountryCode" = 'RS' + RW: "CountryCode" = 'RW' + SA: "CountryCode" = 'SA' + SB: "CountryCode" = 'SB' + SC: "CountryCode" = 'SC' + SE: "CountryCode" = 'SE' + SG: "CountryCode" = 'SG' + SH: "CountryCode" = 'SH' + SI: "CountryCode" = 'SI' + SJ: "CountryCode" = 'SJ' + SK: "CountryCode" = 'SK' + SL: "CountryCode" = 'SL' + SM: "CountryCode" = 'SM' + SN: "CountryCode" = 'SN' + SR: "CountryCode" = 'SR' + ST: "CountryCode" = 'ST' + SV: "CountryCode" = 'SV' + SX: "CountryCode" = 'SX' + SZ: "CountryCode" = 'SZ' + TC: "CountryCode" = 'TC' + TD: "CountryCode" = 'TD' + TF: "CountryCode" = 'TF' + TG: "CountryCode" = 'TG' + TH: "CountryCode" = 'TH' + TJ: "CountryCode" = 'TJ' + TK: "CountryCode" = 'TK' + TL: "CountryCode" = 'TL' + TM: "CountryCode" = 'TM' + TN: "CountryCode" = 'TN' + TO: "CountryCode" = 'TO' + TR: "CountryCode" = 'TR' + TT: "CountryCode" = 'TT' + TV: "CountryCode" = 'TV' + TW: "CountryCode" = 'TW' + TZ: "CountryCode" = 'TZ' + UA: "CountryCode" = 'UA' + UG: "CountryCode" = 'UG' + UM: "CountryCode" = 'UM' + US: "CountryCode" = 'US' + UY: "CountryCode" = 'UY' + UZ: "CountryCode" = 'UZ' + VA: "CountryCode" = 'VA' + VC: "CountryCode" = 'VC' + VG: "CountryCode" = 'VG' + VI: "CountryCode" = 'VI' + VN: "CountryCode" = 'VN' + VU: "CountryCode" = 'VU' + WF: "CountryCode" = 'WF' + WS: "CountryCode" = 'WS' + XK: "CountryCode" = 'XK' + YT: "CountryCode" = 'YT' + ZA: "CountryCode" = 'ZA' + ZM: "CountryCode" = 'ZM' diff --git a/paddle_billing/Entities/Shared/CurrencyCode.py b/paddle_billing/Entities/Shared/CurrencyCode.py index 4a47e960..93baaa7f 100644 --- a/paddle_billing/Entities/Shared/CurrencyCode.py +++ b/paddle_billing/Entities/Shared/CurrencyCode.py @@ -1,34 +1,34 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CurrencyCode(PaddleStrEnum): - USD = 'USD' - EUR = 'EUR' - GBP = 'GBP' - JPY = 'JPY' - AUD = 'AUD' - CAD = 'CAD' - CHF = 'CHF' - HKD = 'HKD' - SGD = 'SGD' - SEK = 'SEK' - ARS = 'ARS' - BRL = 'BRL' - CNY = 'CNY' - COP = 'COP' - CZK = 'CZK' - DKK = 'DKK' - HUF = 'HUF' - ILS = 'ILS' - INR = 'INR' - KRW = 'KRW' - MXN = 'MXN' - NOK = 'NOK' - NZD = 'NZD' - PLN = 'PLN' - RUB = 'RUB' - THB = 'THB' - TRY = 'TRY' - TWD = 'TWD' - UAH = 'UAH' - ZAR = 'ZAR' +class CurrencyCode(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + USD: "CurrencyCode" = 'USD' + EUR: "CurrencyCode" = 'EUR' + GBP: "CurrencyCode" = 'GBP' + JPY: "CurrencyCode" = 'JPY' + AUD: "CurrencyCode" = 'AUD' + CAD: "CurrencyCode" = 'CAD' + CHF: "CurrencyCode" = 'CHF' + HKD: "CurrencyCode" = 'HKD' + SGD: "CurrencyCode" = 'SGD' + SEK: "CurrencyCode" = 'SEK' + ARS: "CurrencyCode" = 'ARS' + BRL: "CurrencyCode" = 'BRL' + CNY: "CurrencyCode" = 'CNY' + COP: "CurrencyCode" = 'COP' + CZK: "CurrencyCode" = 'CZK' + DKK: "CurrencyCode" = 'DKK' + HUF: "CurrencyCode" = 'HUF' + ILS: "CurrencyCode" = 'ILS' + INR: "CurrencyCode" = 'INR' + KRW: "CurrencyCode" = 'KRW' + MXN: "CurrencyCode" = 'MXN' + NOK: "CurrencyCode" = 'NOK' + NZD: "CurrencyCode" = 'NZD' + PLN: "CurrencyCode" = 'PLN' + RUB: "CurrencyCode" = 'RUB' + THB: "CurrencyCode" = 'THB' + TRY: "CurrencyCode" = 'TRY' + TWD: "CurrencyCode" = 'TWD' + UAH: "CurrencyCode" = 'UAH' + ZAR: "CurrencyCode" = 'ZAR' diff --git a/paddle_billing/Entities/Shared/CurrencyCodeAdjustments.py b/paddle_billing/Entities/Shared/CurrencyCodeAdjustments.py index 9b214b75..c5b6e3fb 100644 --- a/paddle_billing/Entities/Shared/CurrencyCodeAdjustments.py +++ b/paddle_billing/Entities/Shared/CurrencyCodeAdjustments.py @@ -1,7 +1,7 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CurrencyCodeAdjustments(PaddleStrEnum): - EUR = 'EUR' - GBP = 'GBP' - USD = 'USD' +class CurrencyCodeAdjustments(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + EUR: "CurrencyCodeAdjustments" = 'EUR' + GBP: "CurrencyCodeAdjustments" = 'GBP' + USD: "CurrencyCodeAdjustments" = 'USD' diff --git a/paddle_billing/Entities/Shared/CurrencyCodePayouts.py b/paddle_billing/Entities/Shared/CurrencyCodePayouts.py index 688935f1..40eb2284 100644 --- a/paddle_billing/Entities/Shared/CurrencyCodePayouts.py +++ b/paddle_billing/Entities/Shared/CurrencyCodePayouts.py @@ -1,17 +1,17 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CurrencyCodePayouts(PaddleStrEnum): - AUD = 'AUD' - CAD = 'CAD' - CHF = 'CHF' - CNY = 'CNY' - CZK = 'CZK' - DKK = 'DKK' - EUR = 'EUR' - GBP = 'GBP' - HUF = 'HUF' - PLN = 'PLN' - SEK = 'SEK' - USD = 'USD' - ZAR = 'ZAR' +class CurrencyCodePayouts(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + AUD: "CurrencyCodePayouts" = 'AUD' + CAD: "CurrencyCodePayouts" = 'CAD' + CHF: "CurrencyCodePayouts" = 'CHF' + CNY: "CurrencyCodePayouts" = 'CNY' + CZK: "CurrencyCodePayouts" = 'CZK' + DKK: "CurrencyCodePayouts" = 'DKK' + EUR: "CurrencyCodePayouts" = 'EUR' + GBP: "CurrencyCodePayouts" = 'GBP' + HUF: "CurrencyCodePayouts" = 'HUF' + PLN: "CurrencyCodePayouts" = 'PLN' + SEK: "CurrencyCodePayouts" = 'SEK' + USD: "CurrencyCodePayouts" = 'USD' + ZAR: "CurrencyCodePayouts" = 'ZAR' diff --git a/paddle_billing/Entities/Shared/ErrorCode.py b/paddle_billing/Entities/Shared/ErrorCode.py index d77effeb..df517cb1 100644 --- a/paddle_billing/Entities/Shared/ErrorCode.py +++ b/paddle_billing/Entities/Shared/ErrorCode.py @@ -1,21 +1,21 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class ErrorCode(PaddleStrEnum): - AlreadyCanceled = 'already_canceled' - AlreadyRefunded = 'already_refunded' - AuthenticationFailed = 'authentication_failed' - BlockedCard = 'blocked_card' - Canceled = 'canceled' - Declined = 'declined' - ExpiredCard = 'expired_card' - Fraud = 'fraud' - InvalidAmount = 'invalid_amount' - InvalidPaymentDetails = 'invalid_payment_details' - IssuerUnavailable = 'issuer_unavailable' - NotEnoughBalance = 'not_enough_balance' - PspError = 'psp_error' - RedactedPaymentMethod = 'redacted_payment_method' - SystemError = 'system_error' - TransactionNotPermitted = 'transaction_not_permitted' - Unknown = 'unknown' +class ErrorCode(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + AlreadyCanceled: "ErrorCode" = 'already_canceled' + AlreadyRefunded: "ErrorCode" = 'already_refunded' + AuthenticationFailed: "ErrorCode" = 'authentication_failed' + BlockedCard: "ErrorCode" = 'blocked_card' + Canceled: "ErrorCode" = 'canceled' + Declined: "ErrorCode" = 'declined' + ExpiredCard: "ErrorCode" = 'expired_card' + Fraud: "ErrorCode" = 'fraud' + InvalidAmount: "ErrorCode" = 'invalid_amount' + InvalidPaymentDetails: "ErrorCode" = 'invalid_payment_details' + IssuerUnavailable: "ErrorCode" = 'issuer_unavailable' + NotEnoughBalance: "ErrorCode" = 'not_enough_balance' + PspError: "ErrorCode" = 'psp_error' + RedactedPaymentMethod: "ErrorCode" = 'redacted_payment_method' + SystemError: "ErrorCode" = 'system_error' + TransactionNotPermitted: "ErrorCode" = 'transaction_not_permitted' + Unknown: "ErrorCode" = 'unknown' diff --git a/paddle_billing/Entities/Shared/Interval.py b/paddle_billing/Entities/Shared/Interval.py index 5c82cf61..4d874f5d 100644 --- a/paddle_billing/Entities/Shared/Interval.py +++ b/paddle_billing/Entities/Shared/Interval.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Interval(PaddleStrEnum): - Day = 'day' - Week = 'week' - Month = 'month' - Year = 'year' +class Interval(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Day: "Interval" = 'day' + Week: "Interval" = 'week' + Month: "Interval" = 'month' + Year: "Interval" = 'year' diff --git a/paddle_billing/Entities/Shared/PaymentAttemptStatus.py b/paddle_billing/Entities/Shared/PaymentAttemptStatus.py index e2fd66e5..84f0d05e 100644 --- a/paddle_billing/Entities/Shared/PaymentAttemptStatus.py +++ b/paddle_billing/Entities/Shared/PaymentAttemptStatus.py @@ -1,13 +1,13 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class PaymentAttemptStatus(PaddleStrEnum): - Authorized = 'authorized' - AuthorizedFlagged = 'authorized_flagged' - Canceled = 'canceled' - Captured = 'captured' - Error = 'error' - ActionRequired = 'action_required' - PendingNoActionRequired = 'pending_no_action_required' - Created = 'created' - Unknown = 'unknown' +class PaymentAttemptStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Authorized: "PaymentAttemptStatus" = 'authorized' + AuthorizedFlagged: "PaymentAttemptStatus" = 'authorized_flagged' + Canceled: "PaymentAttemptStatus" = 'canceled' + Captured: "PaymentAttemptStatus" = 'captured' + Error: "PaymentAttemptStatus" = 'error' + ActionRequired: "PaymentAttemptStatus" = 'action_required' + PendingNoActionRequired: "PaymentAttemptStatus" = 'pending_no_action_required' + Created: "PaymentAttemptStatus" = 'created' + Unknown: "PaymentAttemptStatus" = 'unknown' diff --git a/paddle_billing/Entities/Shared/PaymentMethodType.py b/paddle_billing/Entities/Shared/PaymentMethodType.py index 6ea60b39..f5c28ee0 100644 --- a/paddle_billing/Entities/Shared/PaymentMethodType.py +++ b/paddle_billing/Entities/Shared/PaymentMethodType.py @@ -1,14 +1,14 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class PaymentMethodType(PaddleStrEnum): - Alipay = 'alipay' - ApplePay = 'apple_pay' - Bancontact = 'bancontact' - Card = 'card' - GooglePay = 'google_pay' - Ideal = 'ideal' - Offline = 'offline' - Paypal = 'paypal' - Unknown = 'unknown' - WireTransfer = 'wire_transfer' +class PaymentMethodType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Alipay: "PaymentMethodType" = 'alipay' + ApplePay: "PaymentMethodType" = 'apple_pay' + Bancontact: "PaymentMethodType" = 'bancontact' + Card: "PaymentMethodType" = 'card' + GooglePay: "PaymentMethodType" = 'google_pay' + Ideal: "PaymentMethodType" = 'ideal' + Offline: "PaymentMethodType" = 'offline' + Paypal: "PaymentMethodType" = 'paypal' + Unknown: "PaymentMethodType" = 'unknown' + WireTransfer: "PaymentMethodType" = 'wire_transfer' diff --git a/paddle_billing/Entities/Shared/Status.py b/paddle_billing/Entities/Shared/Status.py index 732622d3..4ad0dba6 100644 --- a/paddle_billing/Entities/Shared/Status.py +++ b/paddle_billing/Entities/Shared/Status.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Status(PaddleStrEnum): - Active = 'active' - Archived = 'archived' +class Status(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Active: "Status" = 'active' + Archived: "Status" = 'archived' diff --git a/paddle_billing/Entities/Shared/TaxCategory.py b/paddle_billing/Entities/Shared/TaxCategory.py index 1c90c8f0..0663aae5 100644 --- a/paddle_billing/Entities/Shared/TaxCategory.py +++ b/paddle_billing/Entities/Shared/TaxCategory.py @@ -1,13 +1,13 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class TaxCategory(PaddleStrEnum): - DigitalGoods = 'digital-goods' - Ebooks = 'ebooks' - ImplementationServices = 'implementation-services' - ProfessionalServices = 'professional-services' - Saas = 'saas' - SoftwareProgrammingServices = 'software-programming-services' - Standard = 'standard' - TrainingServices = 'training-services' - WebsiteHosting = 'website-hosting' +class TaxCategory(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + DigitalGoods: "TaxCategory" = 'digital-goods' + Ebooks: "TaxCategory" = 'ebooks' + ImplementationServices: "TaxCategory" = 'implementation-services' + ProfessionalServices: "TaxCategory" = 'professional-services' + Saas: "TaxCategory" = 'saas' + SoftwareProgrammingServices: "TaxCategory" = 'software-programming-services' + Standard: "TaxCategory" = 'standard' + TrainingServices: "TaxCategory" = 'training-services' + WebsiteHosting: "TaxCategory" = 'website-hosting' diff --git a/paddle_billing/Entities/Shared/TaxMode.py b/paddle_billing/Entities/Shared/TaxMode.py index e0605c2c..b7b54616 100644 --- a/paddle_billing/Entities/Shared/TaxMode.py +++ b/paddle_billing/Entities/Shared/TaxMode.py @@ -1,7 +1,7 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class TaxMode(PaddleStrEnum): - AccountSetting = 'account_setting' - External = 'external' - Internal = 'internal' +class TaxMode(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + AccountSetting: "TaxMode" = 'account_setting' + External: "TaxMode" = 'external' + Internal: "TaxMode" = 'internal' diff --git a/paddle_billing/Entities/Shared/TransactionOrigin.py b/paddle_billing/Entities/Shared/TransactionOrigin.py index 3026283a..46baa3ec 100644 --- a/paddle_billing/Entities/Shared/TransactionOrigin.py +++ b/paddle_billing/Entities/Shared/TransactionOrigin.py @@ -1,10 +1,10 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class TransactionOrigin(PaddleStrEnum): - Api = 'api' - SubscriptionCharge = 'subscription_charge' - SubscriptionPaymentMethodChange = 'subscription_payment_method_change' - SubscriptionRecurring = 'subscription_recurring' - SubscriptionUpdate = 'subscription_update' - Web = 'web' +class TransactionOrigin(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Api: "TransactionOrigin" = 'api' + SubscriptionCharge: "TransactionOrigin" = 'subscription_charge' + SubscriptionPaymentMethodChange: "TransactionOrigin" = 'subscription_payment_method_change' + SubscriptionRecurring: "TransactionOrigin" = 'subscription_recurring' + SubscriptionUpdate: "TransactionOrigin" = 'subscription_update' + Web: "TransactionOrigin" = 'web' diff --git a/paddle_billing/Entities/Shared/TransactionStatus.py b/paddle_billing/Entities/Shared/TransactionStatus.py index e8209391..d2e40378 100644 --- a/paddle_billing/Entities/Shared/TransactionStatus.py +++ b/paddle_billing/Entities/Shared/TransactionStatus.py @@ -1,11 +1,11 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class TransactionStatus(PaddleStrEnum): - Draft = 'draft' - Ready = 'ready' - Billed = 'billed' - Paid = 'paid' - Completed = 'completed' - Canceled = 'canceled' - PastDue = 'past_due' +class TransactionStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Draft: "TransactionStatus" = 'draft' + Ready: "TransactionStatus" = 'ready' + Billed: "TransactionStatus" = 'billed' + Paid: "TransactionStatus" = 'paid' + Completed: "TransactionStatus" = 'completed' + Canceled: "TransactionStatus" = 'canceled' + PastDue: "TransactionStatus" = 'past_due' diff --git a/paddle_billing/Entities/Subscriptions/SubscriptionEffectiveFrom.py b/paddle_billing/Entities/Subscriptions/SubscriptionEffectiveFrom.py index 7d8a2441..88c9f3ca 100644 --- a/paddle_billing/Entities/Subscriptions/SubscriptionEffectiveFrom.py +++ b/paddle_billing/Entities/Subscriptions/SubscriptionEffectiveFrom.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionEffectiveFrom(PaddleStrEnum): - NextBillingPeriod = 'next_billing_period' - Immediately = 'immediately' +class SubscriptionEffectiveFrom(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + NextBillingPeriod: "SubscriptionEffectiveFrom" = 'next_billing_period' + Immediately: "SubscriptionEffectiveFrom" = 'immediately' diff --git a/paddle_billing/Entities/Subscriptions/SubscriptionItemStatus.py b/paddle_billing/Entities/Subscriptions/SubscriptionItemStatus.py index d2b36d5c..de920a8c 100644 --- a/paddle_billing/Entities/Subscriptions/SubscriptionItemStatus.py +++ b/paddle_billing/Entities/Subscriptions/SubscriptionItemStatus.py @@ -1,7 +1,7 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionItemStatus(PaddleStrEnum): - Active = 'active' - Inactive = 'inactive' - Trialing = 'trialing' +class SubscriptionItemStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Active: "SubscriptionItemStatus" = 'active' + Inactive: "SubscriptionItemStatus" = 'inactive' + Trialing: "SubscriptionItemStatus" = 'trialing' diff --git a/paddle_billing/Entities/Subscriptions/SubscriptionOnPaymentFailure.py b/paddle_billing/Entities/Subscriptions/SubscriptionOnPaymentFailure.py index 75260adf..af2daed6 100644 --- a/paddle_billing/Entities/Subscriptions/SubscriptionOnPaymentFailure.py +++ b/paddle_billing/Entities/Subscriptions/SubscriptionOnPaymentFailure.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionOnPaymentFailure(PaddleStrEnum): - PreventChange = 'prevent_change' - ApplyChange = 'apply_change' +class SubscriptionOnPaymentFailure(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + PreventChange: "SubscriptionOnPaymentFailure" = 'prevent_change' + ApplyChange: "SubscriptionOnPaymentFailure" = 'apply_change' diff --git a/paddle_billing/Entities/Subscriptions/SubscriptionProrationBillingMode.py b/paddle_billing/Entities/Subscriptions/SubscriptionProrationBillingMode.py index 839b94f6..f441b7a3 100644 --- a/paddle_billing/Entities/Subscriptions/SubscriptionProrationBillingMode.py +++ b/paddle_billing/Entities/Subscriptions/SubscriptionProrationBillingMode.py @@ -1,9 +1,9 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionProrationBillingMode(PaddleStrEnum): - ProratedImmediately = 'prorated_immediately' - ProratedNextBillingPeriod = 'prorated_next_billing_period' - FullImmediately = 'full_immediately' - FullNextBillingPeriod = 'full_next_billing_period' - DoNotBill = 'do_not_bill' +class SubscriptionProrationBillingMode(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + ProratedImmediately: "SubscriptionProrationBillingMode" = 'prorated_immediately' + ProratedNextBillingPeriod: "SubscriptionProrationBillingMode" = 'prorated_next_billing_period' + FullImmediately: "SubscriptionProrationBillingMode" = 'full_immediately' + FullNextBillingPeriod: "SubscriptionProrationBillingMode" = 'full_next_billing_period' + DoNotBill: "SubscriptionProrationBillingMode" = 'do_not_bill' diff --git a/paddle_billing/Entities/Subscriptions/SubscriptionResultAction.py b/paddle_billing/Entities/Subscriptions/SubscriptionResultAction.py index 9334e02f..d798b4ff 100644 --- a/paddle_billing/Entities/Subscriptions/SubscriptionResultAction.py +++ b/paddle_billing/Entities/Subscriptions/SubscriptionResultAction.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionResultAction(PaddleStrEnum): - Credit = 'credit' - Charge = 'charge' +class SubscriptionResultAction(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Credit: "SubscriptionResultAction" = 'credit' + Charge: "SubscriptionResultAction" = 'charge' diff --git a/paddle_billing/Entities/Subscriptions/SubscriptionResumeEffectiveFrom.py b/paddle_billing/Entities/Subscriptions/SubscriptionResumeEffectiveFrom.py index a8826329..d190c018 100644 --- a/paddle_billing/Entities/Subscriptions/SubscriptionResumeEffectiveFrom.py +++ b/paddle_billing/Entities/Subscriptions/SubscriptionResumeEffectiveFrom.py @@ -1,5 +1,5 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionResumeEffectiveFrom(PaddleStrEnum): - Immediately = 'immediately' +class SubscriptionResumeEffectiveFrom(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Immediately: "SubscriptionResumeEffectiveFrom" = 'immediately' diff --git a/paddle_billing/Entities/Subscriptions/SubscriptionScheduledChangeAction.py b/paddle_billing/Entities/Subscriptions/SubscriptionScheduledChangeAction.py index b24d8150..576e62e2 100644 --- a/paddle_billing/Entities/Subscriptions/SubscriptionScheduledChangeAction.py +++ b/paddle_billing/Entities/Subscriptions/SubscriptionScheduledChangeAction.py @@ -1,7 +1,7 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionScheduledChangeAction(PaddleStrEnum): - Cancel = 'cancel' - Pause = 'pause' - Resume = 'resume' +class SubscriptionScheduledChangeAction(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Cancel: "SubscriptionScheduledChangeAction" = 'cancel' + Pause: "SubscriptionScheduledChangeAction" = 'pause' + Resume: "SubscriptionScheduledChangeAction" = 'resume' diff --git a/paddle_billing/Entities/Subscriptions/SubscriptionStatus.py b/paddle_billing/Entities/Subscriptions/SubscriptionStatus.py index 929566fe..c54e0046 100644 --- a/paddle_billing/Entities/Subscriptions/SubscriptionStatus.py +++ b/paddle_billing/Entities/Subscriptions/SubscriptionStatus.py @@ -1,10 +1,10 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionStatus(PaddleStrEnum): - Active = 'active' - Canceled = 'canceled' - PastDue = 'past_due' - Paused = 'paused' - Trialing = 'trialing' - Inactive = 'inactive' +class SubscriptionStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Active: "SubscriptionStatus" = 'active' + Canceled: "SubscriptionStatus" = 'canceled' + PastDue: "SubscriptionStatus" = 'past_due' + Paused: "SubscriptionStatus" = 'paused' + Trialing: "SubscriptionStatus" = 'trialing' + Inactive: "SubscriptionStatus" = 'inactive' diff --git a/paddle_billing/Entities/Transactions/TransactionCardType.py b/paddle_billing/Entities/Transactions/TransactionCardType.py index fce08e45..039bf339 100644 --- a/paddle_billing/Entities/Transactions/TransactionCardType.py +++ b/paddle_billing/Entities/Transactions/TransactionCardType.py @@ -1,14 +1,14 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class TransactionCardType(PaddleStrEnum): - AmericanExpress = 'american_express' - DinersClub = 'diners_club' - Discover = 'discover' - Jcb = 'jcb' - Mada = 'mada' - Maestro = 'maestro' - Mastercard = 'mastercard' - UnionPay = 'union_pay' - Unknown = 'unknown' - Visa = 'visa' +class TransactionCardType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + AmericanExpress: "TransactionCardType" = 'american_express' + DinersClub: "TransactionCardType" = 'diners_club' + Discover: "TransactionCardType" = 'discover' + Jcb: "TransactionCardType" = 'jcb' + Mada: "TransactionCardType" = 'mada' + Maestro: "TransactionCardType" = 'maestro' + Mastercard: "TransactionCardType" = 'mastercard' + UnionPay: "TransactionCardType" = 'union_pay' + Unknown: "TransactionCardType" = 'unknown' + Visa: "TransactionCardType" = 'visa' diff --git a/paddle_billing/Environment.py b/paddle_billing/Environment.py index a4d523af..faf4d28f 100644 --- a/paddle_billing/Environment.py +++ b/paddle_billing/Environment.py @@ -1,9 +1,9 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Environment(PaddleStrEnum): - PRODUCTION = 'production' - SANDBOX = 'sandbox' +class Environment(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + PRODUCTION: "Environment" = 'production' + SANDBOX: "Environment" = 'sandbox' @property diff --git a/paddle_billing/Notifications/Entities/Discounts/DiscountStatus.py b/paddle_billing/Notifications/Entities/Discounts/DiscountStatus.py index 110b3774..768a2f60 100644 --- a/paddle_billing/Notifications/Entities/Discounts/DiscountStatus.py +++ b/paddle_billing/Notifications/Entities/Discounts/DiscountStatus.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class DiscountStatus(PaddleStrEnum): - Active = 'active' - Archived = 'archived' - Expired = 'expired' - Used = 'used' +class DiscountStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Active: "DiscountStatus" = 'active' + Archived: "DiscountStatus" = 'archived' + Expired: "DiscountStatus" = 'expired' + Used: "DiscountStatus" = 'used' diff --git a/paddle_billing/Notifications/Entities/Discounts/DiscountType.py b/paddle_billing/Notifications/Entities/Discounts/DiscountType.py index e257f38e..8be856f1 100644 --- a/paddle_billing/Notifications/Entities/Discounts/DiscountType.py +++ b/paddle_billing/Notifications/Entities/Discounts/DiscountType.py @@ -1,7 +1,7 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class DiscountType(PaddleStrEnum): - Flat = 'flat' - FlatPerSeat = 'flat_per_seat' - Percentage = 'percentage' +class DiscountType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Flat: "DiscountType" = 'flat' + FlatPerSeat: "DiscountType" = 'flat_per_seat' + Percentage: "DiscountType" = 'percentage' diff --git a/paddle_billing/Notifications/Entities/Payouts/PayoutStatus.py b/paddle_billing/Notifications/Entities/Payouts/PayoutStatus.py index 42630cbf..a35a2f31 100644 --- a/paddle_billing/Notifications/Entities/Payouts/PayoutStatus.py +++ b/paddle_billing/Notifications/Entities/Payouts/PayoutStatus.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class PayoutStatus(PaddleStrEnum): - Unpaid = 'unpaid' - Paid = 'paid' +class PayoutStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Unpaid: "PayoutStatus" = 'unpaid' + Paid: "PayoutStatus" = 'paid' diff --git a/paddle_billing/Notifications/Entities/Reports/ReportFilterName.py b/paddle_billing/Notifications/Entities/Reports/ReportFilterName.py index 9d8df22b..6c0b2f80 100644 --- a/paddle_billing/Notifications/Entities/Reports/ReportFilterName.py +++ b/paddle_billing/Notifications/Entities/Reports/ReportFilterName.py @@ -1,17 +1,17 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class ReportFilterName(PaddleStrEnum): - Action = 'action' - CollectionMode = 'collection_mode' - CurrencyCode = 'currency_code' - Origin = 'origin' - PriceStatus = 'price_status' - PriceType = 'price_type' - PriceUpdatedAt = 'price_updated_at' - ProductStatus = 'product_status' - ProductType = 'product_type' - ProductUpdatedAt = 'product_updated_at' - Status = 'status' - Type = 'type' - UpdatedAt = 'updated_at' +class ReportFilterName(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Action: "ReportFilterName" = 'action' + CollectionMode: "ReportFilterName" = 'collection_mode' + CurrencyCode: "ReportFilterName" = 'currency_code' + Origin: "ReportFilterName" = 'origin' + PriceStatus: "ReportFilterName" = 'price_status' + PriceType: "ReportFilterName" = 'price_type' + PriceUpdatedAt: "ReportFilterName" = 'price_updated_at' + ProductStatus: "ReportFilterName" = 'product_status' + ProductType: "ReportFilterName" = 'product_type' + ProductUpdatedAt: "ReportFilterName" = 'product_updated_at' + Status: "ReportFilterName" = 'status' + Type: "ReportFilterName" = 'type' + UpdatedAt: "ReportFilterName" = 'updated_at' diff --git a/paddle_billing/Notifications/Entities/Reports/ReportFilterOperator.py b/paddle_billing/Notifications/Entities/Reports/ReportFilterOperator.py index 829b5d5f..41c74af7 100644 --- a/paddle_billing/Notifications/Entities/Reports/ReportFilterOperator.py +++ b/paddle_billing/Notifications/Entities/Reports/ReportFilterOperator.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class ReportFilterOperator(PaddleStrEnum): - Lt = 'lt' - Gte = 'gte' +class ReportFilterOperator(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Lt: "ReportFilterOperator" = 'lt' + Gte: "ReportFilterOperator" = 'gte' diff --git a/paddle_billing/Notifications/Entities/Reports/ReportStatus.py b/paddle_billing/Notifications/Entities/Reports/ReportStatus.py index 60640919..27dde70a 100644 --- a/paddle_billing/Notifications/Entities/Reports/ReportStatus.py +++ b/paddle_billing/Notifications/Entities/Reports/ReportStatus.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class ReportStatus(PaddleStrEnum): - Pending = 'pending' - Ready = 'ready' - Failed = 'failed' - Expired = 'expired' +class ReportStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Pending: "ReportStatus" = 'pending' + Ready: "ReportStatus" = 'ready' + Failed: "ReportStatus" = 'failed' + Expired: "ReportStatus" = 'expired' diff --git a/paddle_billing/Notifications/Entities/Reports/ReportType.py b/paddle_billing/Notifications/Entities/Reports/ReportType.py index b5758907..d78ab93f 100644 --- a/paddle_billing/Notifications/Entities/Reports/ReportType.py +++ b/paddle_billing/Notifications/Entities/Reports/ReportType.py @@ -1,10 +1,10 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class ReportType(PaddleStrEnum): - Adjustments = 'adjustments' - AdjustmentLineItems = 'adjustment_line_items' - Discounts = 'discounts' - ProductsPrices = 'products_prices' - Transactions = 'transactions' - TransactionLineItems = 'transaction_line_items' +class ReportType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Adjustments: "ReportType" = 'adjustments' + AdjustmentLineItems: "ReportType" = 'adjustment_line_items' + Discounts: "ReportType" = 'discounts' + ProductsPrices: "ReportType" = 'products_prices' + Transactions: "ReportType" = 'transactions' + TransactionLineItems: "ReportType" = 'transaction_line_items' diff --git a/paddle_billing/Notifications/Entities/Shared/Action.py b/paddle_billing/Notifications/Entities/Shared/Action.py index d502529d..d0739dcc 100644 --- a/paddle_billing/Notifications/Entities/Shared/Action.py +++ b/paddle_billing/Notifications/Entities/Shared/Action.py @@ -1,10 +1,10 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Action(PaddleStrEnum): - Credit = 'credit' - CreditReverse = 'credit_reverse' - Refund = 'refund' - Chargeback = 'chargeback' - ChargebackReverse = 'chargeback_reverse' - ChargebackWarning = 'chargeback_warning' +class Action(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Credit: "Action" = 'credit' + CreditReverse: "Action" = 'credit_reverse' + Refund: "Action" = 'refund' + Chargeback: "Action" = 'chargeback' + ChargebackReverse: "Action" = 'chargeback_reverse' + ChargebackWarning: "Action" = 'chargeback_warning' diff --git a/paddle_billing/Notifications/Entities/Shared/AdjustmentStatus.py b/paddle_billing/Notifications/Entities/Shared/AdjustmentStatus.py index 0d0868c7..8ffb0bd3 100644 --- a/paddle_billing/Notifications/Entities/Shared/AdjustmentStatus.py +++ b/paddle_billing/Notifications/Entities/Shared/AdjustmentStatus.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class AdjustmentStatus(PaddleStrEnum): - PendingApproval = 'pending_approval' - Approved = 'approved' - Rejected = 'rejected' - Reversed = 'reversed' +class AdjustmentStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + PendingApproval: "AdjustmentStatus" = 'pending_approval' + Approved: "AdjustmentStatus" = 'approved' + Rejected: "AdjustmentStatus" = 'rejected' + Reversed: "AdjustmentStatus" = 'reversed' diff --git a/paddle_billing/Notifications/Entities/Shared/AdjustmentType.py b/paddle_billing/Notifications/Entities/Shared/AdjustmentType.py index a8f7d5b2..f3a3f4ce 100644 --- a/paddle_billing/Notifications/Entities/Shared/AdjustmentType.py +++ b/paddle_billing/Notifications/Entities/Shared/AdjustmentType.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class AdjustmentType(PaddleStrEnum): - Full = 'full' - Partial = 'partial' - Tax = 'tax' - Proration = 'proration' +class AdjustmentType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Full: "AdjustmentType" = 'full' + Partial: "AdjustmentType" = 'partial' + Tax: "AdjustmentType" = 'tax' + Proration: "AdjustmentType" = 'proration' diff --git a/paddle_billing/Notifications/Entities/Shared/AvailablePaymentMethods.py b/paddle_billing/Notifications/Entities/Shared/AvailablePaymentMethods.py index 965d548a..a06aec6e 100644 --- a/paddle_billing/Notifications/Entities/Shared/AvailablePaymentMethods.py +++ b/paddle_billing/Notifications/Entities/Shared/AvailablePaymentMethods.py @@ -1,11 +1,11 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class AvailablePaymentMethods(PaddleStrEnum): - Alipay = 'alipay' - ApplePay = 'apple_pay' - Bancontact = 'bancontact' - Card = 'card' - GooglePay = 'google_pay' - Ideal = 'ideal' - Paypal = 'paypal' +class AvailablePaymentMethods(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Alipay: "AvailablePaymentMethods" = 'alipay' + ApplePay: "AvailablePaymentMethods" = 'apple_pay' + Bancontact: "AvailablePaymentMethods" = 'bancontact' + Card: "AvailablePaymentMethods" = 'card' + GooglePay: "AvailablePaymentMethods" = 'google_pay' + Ideal: "AvailablePaymentMethods" = 'ideal' + Paypal: "AvailablePaymentMethods" = 'paypal' diff --git a/paddle_billing/Notifications/Entities/Shared/CatalogType.py b/paddle_billing/Notifications/Entities/Shared/CatalogType.py index 57171d58..6d1260d3 100644 --- a/paddle_billing/Notifications/Entities/Shared/CatalogType.py +++ b/paddle_billing/Notifications/Entities/Shared/CatalogType.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CatalogType(PaddleStrEnum): - Standard = 'standard' - Custom = 'custom' +class CatalogType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Standard: "CatalogType" = 'standard' + Custom: "CatalogType" = 'custom' diff --git a/paddle_billing/Notifications/Entities/Shared/CollectionMode.py b/paddle_billing/Notifications/Entities/Shared/CollectionMode.py index dbdc3fdd..ca8eb823 100644 --- a/paddle_billing/Notifications/Entities/Shared/CollectionMode.py +++ b/paddle_billing/Notifications/Entities/Shared/CollectionMode.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CollectionMode(PaddleStrEnum): - Automatic = 'automatic' - Manual = 'manual' +class CollectionMode(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Automatic: "CollectionMode" = 'automatic' + Manual: "CollectionMode" = 'manual' diff --git a/paddle_billing/Notifications/Entities/Shared/CountryCode.py b/paddle_billing/Notifications/Entities/Shared/CountryCode.py index f65ea9a9..ec1d0179 100644 --- a/paddle_billing/Notifications/Entities/Shared/CountryCode.py +++ b/paddle_billing/Notifications/Entities/Shared/CountryCode.py @@ -1,233 +1,233 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CountryCode(PaddleStrEnum): - AD = 'AD' - AE = 'AE' - AG = 'AG' - AI = 'AI' - AL = 'AL' - AM = 'AM' - AO = 'AO' - AR = 'AR' - AS = 'AS' - AT = 'AT' - AU = 'AU' - AW = 'AW' - AX = 'AX' - AZ = 'AZ' - BA = 'BA' - BB = 'BB' - BD = 'BD' - BE = 'BE' - BF = 'BF' - BG = 'BG' - BH = 'BH' - BI = 'BI' - BJ = 'BJ' - BL = 'BL' - BM = 'BM' - BN = 'BN' - BO = 'BO' - BQ = 'BQ' - BR = 'BR' - BS = 'BS' - BT = 'BT' - BV = 'BV' - BW = 'BW' - BZ = 'BZ' - CA = 'CA' - CC = 'CC' - CG = 'CG' - CH = 'CH' - CI = 'CI' - CK = 'CK' - CL = 'CL' - CM = 'CM' - CN = 'CN' - CO = 'CO' - CR = 'CR' - CV = 'CV' - CW = 'CW' - CX = 'CX' - CY = 'CY' - CZ = 'CZ' - DE = 'DE' - DJ = 'DJ' - DK = 'DK' - DM = 'DM' - DO = 'DO' - DZ = 'DZ' - EC = 'EC' - EE = 'EE' - EG = 'EG' - EH = 'EH' - ER = 'ER' - ES = 'ES' - ET = 'ET' - FI = 'FI' - FJ = 'FJ' - FK = 'FK' - FM = 'FM' - FO = 'FO' - FR = 'FR' - GA = 'GA' - GB = 'GB' - GD = 'GD' - GE = 'GE' - GF = 'GF' - GG = 'GG' - GH = 'GH' - GI = 'GI' - GL = 'GL' - GM = 'GM' - GN = 'GN' - GP = 'GP' - GQ = 'GQ' - GR = 'GR' - GS = 'GS' - GT = 'GT' - GU = 'GU' - GW = 'GW' - GY = 'GY' - HK = 'HK' - HM = 'HM' - HN = 'HN' - HR = 'HR' - HU = 'HU' - ID = 'ID' - IE = 'IE' - IL = 'IL' - IM = 'IM' - IN = 'IN' - IO = 'IO' - IQ = 'IQ' - IS = 'IS' - IT = 'IT' - JE = 'JE' - JM = 'JM' - JO = 'JO' - JP = 'JP' - KE = 'KE' - KG = 'KG' - KH = 'KH' - KI = 'KI' - KM = 'KM' - KN = 'KN' - KR = 'KR' - KW = 'KW' - KY = 'KY' - KZ = 'KZ' - LA = 'LA' - LB = 'LB' - LC = 'LC' - LI = 'LI' - LK = 'LK' - LR = 'LR' - LS = 'LS' - LT = 'LT' - LU = 'LU' - LV = 'LV' - MA = 'MA' - MC = 'MC' - MD = 'MD' - ME = 'ME' - MF = 'MF' - MG = 'MG' - MH = 'MH' - MK = 'MK' - MN = 'MN' - MO = 'MO' - MP = 'MP' - MQ = 'MQ' - MR = 'MR' - MS = 'MS' - MT = 'MT' - MU = 'MU' - MV = 'MV' - MW = 'MW' - MX = 'MX' - MY = 'MY' - MZ = 'MZ' - NA = 'NA' - NC = 'NC' - NE = 'NE' - NF = 'NF' - NG = 'NG' - NL = 'NL' - NO = 'NO' - NP = 'NP' - NR = 'NR' - NU = 'NU' - NZ = 'NZ' - OM = 'OM' - PA = 'PA' - PE = 'PE' - PF = 'PF' - PG = 'PG' - PH = 'PH' - PK = 'PK' - PL = 'PL' - PM = 'PM' - PN = 'PN' - PR = 'PR' - PS = 'PS' - PT = 'PT' - PW = 'PW' - PY = 'PY' - QA = 'QA' - RE = 'RE' - RO = 'RO' - RS = 'RS' - RW = 'RW' - SA = 'SA' - SB = 'SB' - SC = 'SC' - SE = 'SE' - SG = 'SG' - SH = 'SH' - SI = 'SI' - SJ = 'SJ' - SK = 'SK' - SL = 'SL' - SM = 'SM' - SN = 'SN' - SR = 'SR' - ST = 'ST' - SV = 'SV' - SX = 'SX' - SZ = 'SZ' - TC = 'TC' - TD = 'TD' - TF = 'TF' - TG = 'TG' - TH = 'TH' - TJ = 'TJ' - TK = 'TK' - TL = 'TL' - TM = 'TM' - TN = 'TN' - TO = 'TO' - TR = 'TR' - TT = 'TT' - TV = 'TV' - TW = 'TW' - TZ = 'TZ' - UA = 'UA' - UG = 'UG' - UM = 'UM' - US = 'US' - UY = 'UY' - UZ = 'UZ' - VA = 'VA' - VC = 'VC' - VG = 'VG' - VI = 'VI' - VN = 'VN' - VU = 'VU' - WF = 'WF' - WS = 'WS' - XK = 'XK' - YT = 'YT' - ZA = 'ZA' - ZM = 'ZM' +class CountryCode(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + AD: "CountryCode" = 'AD' + AE: "CountryCode" = 'AE' + AG: "CountryCode" = 'AG' + AI: "CountryCode" = 'AI' + AL: "CountryCode" = 'AL' + AM: "CountryCode" = 'AM' + AO: "CountryCode" = 'AO' + AR: "CountryCode" = 'AR' + AS: "CountryCode" = 'AS' + AT: "CountryCode" = 'AT' + AU: "CountryCode" = 'AU' + AW: "CountryCode" = 'AW' + AX: "CountryCode" = 'AX' + AZ: "CountryCode" = 'AZ' + BA: "CountryCode" = 'BA' + BB: "CountryCode" = 'BB' + BD: "CountryCode" = 'BD' + BE: "CountryCode" = 'BE' + BF: "CountryCode" = 'BF' + BG: "CountryCode" = 'BG' + BH: "CountryCode" = 'BH' + BI: "CountryCode" = 'BI' + BJ: "CountryCode" = 'BJ' + BL: "CountryCode" = 'BL' + BM: "CountryCode" = 'BM' + BN: "CountryCode" = 'BN' + BO: "CountryCode" = 'BO' + BQ: "CountryCode" = 'BQ' + BR: "CountryCode" = 'BR' + BS: "CountryCode" = 'BS' + BT: "CountryCode" = 'BT' + BV: "CountryCode" = 'BV' + BW: "CountryCode" = 'BW' + BZ: "CountryCode" = 'BZ' + CA: "CountryCode" = 'CA' + CC: "CountryCode" = 'CC' + CG: "CountryCode" = 'CG' + CH: "CountryCode" = 'CH' + CI: "CountryCode" = 'CI' + CK: "CountryCode" = 'CK' + CL: "CountryCode" = 'CL' + CM: "CountryCode" = 'CM' + CN: "CountryCode" = 'CN' + CO: "CountryCode" = 'CO' + CR: "CountryCode" = 'CR' + CV: "CountryCode" = 'CV' + CW: "CountryCode" = 'CW' + CX: "CountryCode" = 'CX' + CY: "CountryCode" = 'CY' + CZ: "CountryCode" = 'CZ' + DE: "CountryCode" = 'DE' + DJ: "CountryCode" = 'DJ' + DK: "CountryCode" = 'DK' + DM: "CountryCode" = 'DM' + DO: "CountryCode" = 'DO' + DZ: "CountryCode" = 'DZ' + EC: "CountryCode" = 'EC' + EE: "CountryCode" = 'EE' + EG: "CountryCode" = 'EG' + EH: "CountryCode" = 'EH' + ER: "CountryCode" = 'ER' + ES: "CountryCode" = 'ES' + ET: "CountryCode" = 'ET' + FI: "CountryCode" = 'FI' + FJ: "CountryCode" = 'FJ' + FK: "CountryCode" = 'FK' + FM: "CountryCode" = 'FM' + FO: "CountryCode" = 'FO' + FR: "CountryCode" = 'FR' + GA: "CountryCode" = 'GA' + GB: "CountryCode" = 'GB' + GD: "CountryCode" = 'GD' + GE: "CountryCode" = 'GE' + GF: "CountryCode" = 'GF' + GG: "CountryCode" = 'GG' + GH: "CountryCode" = 'GH' + GI: "CountryCode" = 'GI' + GL: "CountryCode" = 'GL' + GM: "CountryCode" = 'GM' + GN: "CountryCode" = 'GN' + GP: "CountryCode" = 'GP' + GQ: "CountryCode" = 'GQ' + GR: "CountryCode" = 'GR' + GS: "CountryCode" = 'GS' + GT: "CountryCode" = 'GT' + GU: "CountryCode" = 'GU' + GW: "CountryCode" = 'GW' + GY: "CountryCode" = 'GY' + HK: "CountryCode" = 'HK' + HM: "CountryCode" = 'HM' + HN: "CountryCode" = 'HN' + HR: "CountryCode" = 'HR' + HU: "CountryCode" = 'HU' + ID: "CountryCode" = 'ID' + IE: "CountryCode" = 'IE' + IL: "CountryCode" = 'IL' + IM: "CountryCode" = 'IM' + IN: "CountryCode" = 'IN' + IO: "CountryCode" = 'IO' + IQ: "CountryCode" = 'IQ' + IS: "CountryCode" = 'IS' + IT: "CountryCode" = 'IT' + JE: "CountryCode" = 'JE' + JM: "CountryCode" = 'JM' + JO: "CountryCode" = 'JO' + JP: "CountryCode" = 'JP' + KE: "CountryCode" = 'KE' + KG: "CountryCode" = 'KG' + KH: "CountryCode" = 'KH' + KI: "CountryCode" = 'KI' + KM: "CountryCode" = 'KM' + KN: "CountryCode" = 'KN' + KR: "CountryCode" = 'KR' + KW: "CountryCode" = 'KW' + KY: "CountryCode" = 'KY' + KZ: "CountryCode" = 'KZ' + LA: "CountryCode" = 'LA' + LB: "CountryCode" = 'LB' + LC: "CountryCode" = 'LC' + LI: "CountryCode" = 'LI' + LK: "CountryCode" = 'LK' + LR: "CountryCode" = 'LR' + LS: "CountryCode" = 'LS' + LT: "CountryCode" = 'LT' + LU: "CountryCode" = 'LU' + LV: "CountryCode" = 'LV' + MA: "CountryCode" = 'MA' + MC: "CountryCode" = 'MC' + MD: "CountryCode" = 'MD' + ME: "CountryCode" = 'ME' + MF: "CountryCode" = 'MF' + MG: "CountryCode" = 'MG' + MH: "CountryCode" = 'MH' + MK: "CountryCode" = 'MK' + MN: "CountryCode" = 'MN' + MO: "CountryCode" = 'MO' + MP: "CountryCode" = 'MP' + MQ: "CountryCode" = 'MQ' + MR: "CountryCode" = 'MR' + MS: "CountryCode" = 'MS' + MT: "CountryCode" = 'MT' + MU: "CountryCode" = 'MU' + MV: "CountryCode" = 'MV' + MW: "CountryCode" = 'MW' + MX: "CountryCode" = 'MX' + MY: "CountryCode" = 'MY' + MZ: "CountryCode" = 'MZ' + NA: "CountryCode" = 'NA' + NC: "CountryCode" = 'NC' + NE: "CountryCode" = 'NE' + NF: "CountryCode" = 'NF' + NG: "CountryCode" = 'NG' + NL: "CountryCode" = 'NL' + NO: "CountryCode" = 'NO' + NP: "CountryCode" = 'NP' + NR: "CountryCode" = 'NR' + NU: "CountryCode" = 'NU' + NZ: "CountryCode" = 'NZ' + OM: "CountryCode" = 'OM' + PA: "CountryCode" = 'PA' + PE: "CountryCode" = 'PE' + PF: "CountryCode" = 'PF' + PG: "CountryCode" = 'PG' + PH: "CountryCode" = 'PH' + PK: "CountryCode" = 'PK' + PL: "CountryCode" = 'PL' + PM: "CountryCode" = 'PM' + PN: "CountryCode" = 'PN' + PR: "CountryCode" = 'PR' + PS: "CountryCode" = 'PS' + PT: "CountryCode" = 'PT' + PW: "CountryCode" = 'PW' + PY: "CountryCode" = 'PY' + QA: "CountryCode" = 'QA' + RE: "CountryCode" = 'RE' + RO: "CountryCode" = 'RO' + RS: "CountryCode" = 'RS' + RW: "CountryCode" = 'RW' + SA: "CountryCode" = 'SA' + SB: "CountryCode" = 'SB' + SC: "CountryCode" = 'SC' + SE: "CountryCode" = 'SE' + SG: "CountryCode" = 'SG' + SH: "CountryCode" = 'SH' + SI: "CountryCode" = 'SI' + SJ: "CountryCode" = 'SJ' + SK: "CountryCode" = 'SK' + SL: "CountryCode" = 'SL' + SM: "CountryCode" = 'SM' + SN: "CountryCode" = 'SN' + SR: "CountryCode" = 'SR' + ST: "CountryCode" = 'ST' + SV: "CountryCode" = 'SV' + SX: "CountryCode" = 'SX' + SZ: "CountryCode" = 'SZ' + TC: "CountryCode" = 'TC' + TD: "CountryCode" = 'TD' + TF: "CountryCode" = 'TF' + TG: "CountryCode" = 'TG' + TH: "CountryCode" = 'TH' + TJ: "CountryCode" = 'TJ' + TK: "CountryCode" = 'TK' + TL: "CountryCode" = 'TL' + TM: "CountryCode" = 'TM' + TN: "CountryCode" = 'TN' + TO: "CountryCode" = 'TO' + TR: "CountryCode" = 'TR' + TT: "CountryCode" = 'TT' + TV: "CountryCode" = 'TV' + TW: "CountryCode" = 'TW' + TZ: "CountryCode" = 'TZ' + UA: "CountryCode" = 'UA' + UG: "CountryCode" = 'UG' + UM: "CountryCode" = 'UM' + US: "CountryCode" = 'US' + UY: "CountryCode" = 'UY' + UZ: "CountryCode" = 'UZ' + VA: "CountryCode" = 'VA' + VC: "CountryCode" = 'VC' + VG: "CountryCode" = 'VG' + VI: "CountryCode" = 'VI' + VN: "CountryCode" = 'VN' + VU: "CountryCode" = 'VU' + WF: "CountryCode" = 'WF' + WS: "CountryCode" = 'WS' + XK: "CountryCode" = 'XK' + YT: "CountryCode" = 'YT' + ZA: "CountryCode" = 'ZA' + ZM: "CountryCode" = 'ZM' diff --git a/paddle_billing/Notifications/Entities/Shared/CurrencyCode.py b/paddle_billing/Notifications/Entities/Shared/CurrencyCode.py index 4a47e960..93baaa7f 100644 --- a/paddle_billing/Notifications/Entities/Shared/CurrencyCode.py +++ b/paddle_billing/Notifications/Entities/Shared/CurrencyCode.py @@ -1,34 +1,34 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CurrencyCode(PaddleStrEnum): - USD = 'USD' - EUR = 'EUR' - GBP = 'GBP' - JPY = 'JPY' - AUD = 'AUD' - CAD = 'CAD' - CHF = 'CHF' - HKD = 'HKD' - SGD = 'SGD' - SEK = 'SEK' - ARS = 'ARS' - BRL = 'BRL' - CNY = 'CNY' - COP = 'COP' - CZK = 'CZK' - DKK = 'DKK' - HUF = 'HUF' - ILS = 'ILS' - INR = 'INR' - KRW = 'KRW' - MXN = 'MXN' - NOK = 'NOK' - NZD = 'NZD' - PLN = 'PLN' - RUB = 'RUB' - THB = 'THB' - TRY = 'TRY' - TWD = 'TWD' - UAH = 'UAH' - ZAR = 'ZAR' +class CurrencyCode(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + USD: "CurrencyCode" = 'USD' + EUR: "CurrencyCode" = 'EUR' + GBP: "CurrencyCode" = 'GBP' + JPY: "CurrencyCode" = 'JPY' + AUD: "CurrencyCode" = 'AUD' + CAD: "CurrencyCode" = 'CAD' + CHF: "CurrencyCode" = 'CHF' + HKD: "CurrencyCode" = 'HKD' + SGD: "CurrencyCode" = 'SGD' + SEK: "CurrencyCode" = 'SEK' + ARS: "CurrencyCode" = 'ARS' + BRL: "CurrencyCode" = 'BRL' + CNY: "CurrencyCode" = 'CNY' + COP: "CurrencyCode" = 'COP' + CZK: "CurrencyCode" = 'CZK' + DKK: "CurrencyCode" = 'DKK' + HUF: "CurrencyCode" = 'HUF' + ILS: "CurrencyCode" = 'ILS' + INR: "CurrencyCode" = 'INR' + KRW: "CurrencyCode" = 'KRW' + MXN: "CurrencyCode" = 'MXN' + NOK: "CurrencyCode" = 'NOK' + NZD: "CurrencyCode" = 'NZD' + PLN: "CurrencyCode" = 'PLN' + RUB: "CurrencyCode" = 'RUB' + THB: "CurrencyCode" = 'THB' + TRY: "CurrencyCode" = 'TRY' + TWD: "CurrencyCode" = 'TWD' + UAH: "CurrencyCode" = 'UAH' + ZAR: "CurrencyCode" = 'ZAR' diff --git a/paddle_billing/Notifications/Entities/Shared/CurrencyCodeAdjustments.py b/paddle_billing/Notifications/Entities/Shared/CurrencyCodeAdjustments.py index 9b214b75..c5b6e3fb 100644 --- a/paddle_billing/Notifications/Entities/Shared/CurrencyCodeAdjustments.py +++ b/paddle_billing/Notifications/Entities/Shared/CurrencyCodeAdjustments.py @@ -1,7 +1,7 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CurrencyCodeAdjustments(PaddleStrEnum): - EUR = 'EUR' - GBP = 'GBP' - USD = 'USD' +class CurrencyCodeAdjustments(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + EUR: "CurrencyCodeAdjustments" = 'EUR' + GBP: "CurrencyCodeAdjustments" = 'GBP' + USD: "CurrencyCodeAdjustments" = 'USD' diff --git a/paddle_billing/Notifications/Entities/Shared/CurrencyCodePayouts.py b/paddle_billing/Notifications/Entities/Shared/CurrencyCodePayouts.py index 688935f1..40eb2284 100644 --- a/paddle_billing/Notifications/Entities/Shared/CurrencyCodePayouts.py +++ b/paddle_billing/Notifications/Entities/Shared/CurrencyCodePayouts.py @@ -1,17 +1,17 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class CurrencyCodePayouts(PaddleStrEnum): - AUD = 'AUD' - CAD = 'CAD' - CHF = 'CHF' - CNY = 'CNY' - CZK = 'CZK' - DKK = 'DKK' - EUR = 'EUR' - GBP = 'GBP' - HUF = 'HUF' - PLN = 'PLN' - SEK = 'SEK' - USD = 'USD' - ZAR = 'ZAR' +class CurrencyCodePayouts(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + AUD: "CurrencyCodePayouts" = 'AUD' + CAD: "CurrencyCodePayouts" = 'CAD' + CHF: "CurrencyCodePayouts" = 'CHF' + CNY: "CurrencyCodePayouts" = 'CNY' + CZK: "CurrencyCodePayouts" = 'CZK' + DKK: "CurrencyCodePayouts" = 'DKK' + EUR: "CurrencyCodePayouts" = 'EUR' + GBP: "CurrencyCodePayouts" = 'GBP' + HUF: "CurrencyCodePayouts" = 'HUF' + PLN: "CurrencyCodePayouts" = 'PLN' + SEK: "CurrencyCodePayouts" = 'SEK' + USD: "CurrencyCodePayouts" = 'USD' + ZAR: "CurrencyCodePayouts" = 'ZAR' diff --git a/paddle_billing/Notifications/Entities/Shared/ErrorCode.py b/paddle_billing/Notifications/Entities/Shared/ErrorCode.py index d77effeb..df517cb1 100644 --- a/paddle_billing/Notifications/Entities/Shared/ErrorCode.py +++ b/paddle_billing/Notifications/Entities/Shared/ErrorCode.py @@ -1,21 +1,21 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class ErrorCode(PaddleStrEnum): - AlreadyCanceled = 'already_canceled' - AlreadyRefunded = 'already_refunded' - AuthenticationFailed = 'authentication_failed' - BlockedCard = 'blocked_card' - Canceled = 'canceled' - Declined = 'declined' - ExpiredCard = 'expired_card' - Fraud = 'fraud' - InvalidAmount = 'invalid_amount' - InvalidPaymentDetails = 'invalid_payment_details' - IssuerUnavailable = 'issuer_unavailable' - NotEnoughBalance = 'not_enough_balance' - PspError = 'psp_error' - RedactedPaymentMethod = 'redacted_payment_method' - SystemError = 'system_error' - TransactionNotPermitted = 'transaction_not_permitted' - Unknown = 'unknown' +class ErrorCode(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + AlreadyCanceled: "ErrorCode" = 'already_canceled' + AlreadyRefunded: "ErrorCode" = 'already_refunded' + AuthenticationFailed: "ErrorCode" = 'authentication_failed' + BlockedCard: "ErrorCode" = 'blocked_card' + Canceled: "ErrorCode" = 'canceled' + Declined: "ErrorCode" = 'declined' + ExpiredCard: "ErrorCode" = 'expired_card' + Fraud: "ErrorCode" = 'fraud' + InvalidAmount: "ErrorCode" = 'invalid_amount' + InvalidPaymentDetails: "ErrorCode" = 'invalid_payment_details' + IssuerUnavailable: "ErrorCode" = 'issuer_unavailable' + NotEnoughBalance: "ErrorCode" = 'not_enough_balance' + PspError: "ErrorCode" = 'psp_error' + RedactedPaymentMethod: "ErrorCode" = 'redacted_payment_method' + SystemError: "ErrorCode" = 'system_error' + TransactionNotPermitted: "ErrorCode" = 'transaction_not_permitted' + Unknown: "ErrorCode" = 'unknown' diff --git a/paddle_billing/Notifications/Entities/Shared/Interval.py b/paddle_billing/Notifications/Entities/Shared/Interval.py index 5c82cf61..4d874f5d 100644 --- a/paddle_billing/Notifications/Entities/Shared/Interval.py +++ b/paddle_billing/Notifications/Entities/Shared/Interval.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Interval(PaddleStrEnum): - Day = 'day' - Week = 'week' - Month = 'month' - Year = 'year' +class Interval(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Day: "Interval" = 'day' + Week: "Interval" = 'week' + Month: "Interval" = 'month' + Year: "Interval" = 'year' diff --git a/paddle_billing/Notifications/Entities/Shared/PaymentAttemptStatus.py b/paddle_billing/Notifications/Entities/Shared/PaymentAttemptStatus.py index e2fd66e5..84f0d05e 100644 --- a/paddle_billing/Notifications/Entities/Shared/PaymentAttemptStatus.py +++ b/paddle_billing/Notifications/Entities/Shared/PaymentAttemptStatus.py @@ -1,13 +1,13 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class PaymentAttemptStatus(PaddleStrEnum): - Authorized = 'authorized' - AuthorizedFlagged = 'authorized_flagged' - Canceled = 'canceled' - Captured = 'captured' - Error = 'error' - ActionRequired = 'action_required' - PendingNoActionRequired = 'pending_no_action_required' - Created = 'created' - Unknown = 'unknown' +class PaymentAttemptStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Authorized: "PaymentAttemptStatus" = 'authorized' + AuthorizedFlagged: "PaymentAttemptStatus" = 'authorized_flagged' + Canceled: "PaymentAttemptStatus" = 'canceled' + Captured: "PaymentAttemptStatus" = 'captured' + Error: "PaymentAttemptStatus" = 'error' + ActionRequired: "PaymentAttemptStatus" = 'action_required' + PendingNoActionRequired: "PaymentAttemptStatus" = 'pending_no_action_required' + Created: "PaymentAttemptStatus" = 'created' + Unknown: "PaymentAttemptStatus" = 'unknown' diff --git a/paddle_billing/Notifications/Entities/Shared/PaymentMethodType.py b/paddle_billing/Notifications/Entities/Shared/PaymentMethodType.py index 6ad172dc..fa298d60 100644 --- a/paddle_billing/Notifications/Entities/Shared/PaymentMethodType.py +++ b/paddle_billing/Notifications/Entities/Shared/PaymentMethodType.py @@ -1,15 +1,15 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class PaymentMethodType(PaddleStrEnum): - Alipay = 'alipay' - ApplePay = 'apple_pay' - Bancontact = 'bancontact' - Card = 'card' - GooglePay = 'google_pay' - Ideal = 'ideal' - Offline = 'offline' - Paypal = 'paypal' - Unknown = 'unknown' - WireTransfer = 'wire_transfer' - Visa = 'visa' +class PaymentMethodType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Alipay: "PaymentMethodType" = 'alipay' + ApplePay: "PaymentMethodType" = 'apple_pay' + Bancontact: "PaymentMethodType" = 'bancontact' + Card: "PaymentMethodType" = 'card' + GooglePay: "PaymentMethodType" = 'google_pay' + Ideal: "PaymentMethodType" = 'ideal' + Offline: "PaymentMethodType" = 'offline' + Paypal: "PaymentMethodType" = 'paypal' + Unknown: "PaymentMethodType" = 'unknown' + WireTransfer: "PaymentMethodType" = 'wire_transfer' + Visa: "PaymentMethodType" = 'visa' diff --git a/paddle_billing/Notifications/Entities/Shared/Status.py b/paddle_billing/Notifications/Entities/Shared/Status.py index 732622d3..4ad0dba6 100644 --- a/paddle_billing/Notifications/Entities/Shared/Status.py +++ b/paddle_billing/Notifications/Entities/Shared/Status.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Status(PaddleStrEnum): - Active = 'active' - Archived = 'archived' +class Status(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Active: "Status" = 'active' + Archived: "Status" = 'archived' diff --git a/paddle_billing/Notifications/Entities/Shared/TaxCategory.py b/paddle_billing/Notifications/Entities/Shared/TaxCategory.py index 1c90c8f0..0663aae5 100644 --- a/paddle_billing/Notifications/Entities/Shared/TaxCategory.py +++ b/paddle_billing/Notifications/Entities/Shared/TaxCategory.py @@ -1,13 +1,13 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class TaxCategory(PaddleStrEnum): - DigitalGoods = 'digital-goods' - Ebooks = 'ebooks' - ImplementationServices = 'implementation-services' - ProfessionalServices = 'professional-services' - Saas = 'saas' - SoftwareProgrammingServices = 'software-programming-services' - Standard = 'standard' - TrainingServices = 'training-services' - WebsiteHosting = 'website-hosting' +class TaxCategory(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + DigitalGoods: "TaxCategory" = 'digital-goods' + Ebooks: "TaxCategory" = 'ebooks' + ImplementationServices: "TaxCategory" = 'implementation-services' + ProfessionalServices: "TaxCategory" = 'professional-services' + Saas: "TaxCategory" = 'saas' + SoftwareProgrammingServices: "TaxCategory" = 'software-programming-services' + Standard: "TaxCategory" = 'standard' + TrainingServices: "TaxCategory" = 'training-services' + WebsiteHosting: "TaxCategory" = 'website-hosting' diff --git a/paddle_billing/Notifications/Entities/Shared/TaxMode.py b/paddle_billing/Notifications/Entities/Shared/TaxMode.py index e0605c2c..b7b54616 100644 --- a/paddle_billing/Notifications/Entities/Shared/TaxMode.py +++ b/paddle_billing/Notifications/Entities/Shared/TaxMode.py @@ -1,7 +1,7 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class TaxMode(PaddleStrEnum): - AccountSetting = 'account_setting' - External = 'external' - Internal = 'internal' +class TaxMode(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + AccountSetting: "TaxMode" = 'account_setting' + External: "TaxMode" = 'external' + Internal: "TaxMode" = 'internal' diff --git a/paddle_billing/Notifications/Entities/Shared/TransactionOrigin.py b/paddle_billing/Notifications/Entities/Shared/TransactionOrigin.py index 3026283a..46baa3ec 100644 --- a/paddle_billing/Notifications/Entities/Shared/TransactionOrigin.py +++ b/paddle_billing/Notifications/Entities/Shared/TransactionOrigin.py @@ -1,10 +1,10 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class TransactionOrigin(PaddleStrEnum): - Api = 'api' - SubscriptionCharge = 'subscription_charge' - SubscriptionPaymentMethodChange = 'subscription_payment_method_change' - SubscriptionRecurring = 'subscription_recurring' - SubscriptionUpdate = 'subscription_update' - Web = 'web' +class TransactionOrigin(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Api: "TransactionOrigin" = 'api' + SubscriptionCharge: "TransactionOrigin" = 'subscription_charge' + SubscriptionPaymentMethodChange: "TransactionOrigin" = 'subscription_payment_method_change' + SubscriptionRecurring: "TransactionOrigin" = 'subscription_recurring' + SubscriptionUpdate: "TransactionOrigin" = 'subscription_update' + Web: "TransactionOrigin" = 'web' diff --git a/paddle_billing/Notifications/Entities/Shared/TransactionStatus.py b/paddle_billing/Notifications/Entities/Shared/TransactionStatus.py index e8209391..d2e40378 100644 --- a/paddle_billing/Notifications/Entities/Shared/TransactionStatus.py +++ b/paddle_billing/Notifications/Entities/Shared/TransactionStatus.py @@ -1,11 +1,11 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class TransactionStatus(PaddleStrEnum): - Draft = 'draft' - Ready = 'ready' - Billed = 'billed' - Paid = 'paid' - Completed = 'completed' - Canceled = 'canceled' - PastDue = 'past_due' +class TransactionStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Draft: "TransactionStatus" = 'draft' + Ready: "TransactionStatus" = 'ready' + Billed: "TransactionStatus" = 'billed' + Paid: "TransactionStatus" = 'paid' + Completed: "TransactionStatus" = 'completed' + Canceled: "TransactionStatus" = 'canceled' + PastDue: "TransactionStatus" = 'past_due' diff --git a/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionEffectiveFrom.py b/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionEffectiveFrom.py index 7d8a2441..88c9f3ca 100644 --- a/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionEffectiveFrom.py +++ b/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionEffectiveFrom.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionEffectiveFrom(PaddleStrEnum): - NextBillingPeriod = 'next_billing_period' - Immediately = 'immediately' +class SubscriptionEffectiveFrom(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + NextBillingPeriod: "SubscriptionEffectiveFrom" = 'next_billing_period' + Immediately: "SubscriptionEffectiveFrom" = 'immediately' diff --git a/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionItemStatus.py b/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionItemStatus.py index d2b36d5c..de920a8c 100644 --- a/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionItemStatus.py +++ b/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionItemStatus.py @@ -1,7 +1,7 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionItemStatus(PaddleStrEnum): - Active = 'active' - Inactive = 'inactive' - Trialing = 'trialing' +class SubscriptionItemStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Active: "SubscriptionItemStatus" = 'active' + Inactive: "SubscriptionItemStatus" = 'inactive' + Trialing: "SubscriptionItemStatus" = 'trialing' diff --git a/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionOnPaymentFailure.py b/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionOnPaymentFailure.py index 75260adf..af2daed6 100644 --- a/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionOnPaymentFailure.py +++ b/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionOnPaymentFailure.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionOnPaymentFailure(PaddleStrEnum): - PreventChange = 'prevent_change' - ApplyChange = 'apply_change' +class SubscriptionOnPaymentFailure(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + PreventChange: "SubscriptionOnPaymentFailure" = 'prevent_change' + ApplyChange: "SubscriptionOnPaymentFailure" = 'apply_change' diff --git a/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionScheduledChangeAction.py b/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionScheduledChangeAction.py index b24d8150..576e62e2 100644 --- a/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionScheduledChangeAction.py +++ b/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionScheduledChangeAction.py @@ -1,7 +1,7 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionScheduledChangeAction(PaddleStrEnum): - Cancel = 'cancel' - Pause = 'pause' - Resume = 'resume' +class SubscriptionScheduledChangeAction(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Cancel: "SubscriptionScheduledChangeAction" = 'cancel' + Pause: "SubscriptionScheduledChangeAction" = 'pause' + Resume: "SubscriptionScheduledChangeAction" = 'resume' diff --git a/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionStatus.py b/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionStatus.py index 929566fe..c54e0046 100644 --- a/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionStatus.py +++ b/paddle_billing/Notifications/Entities/Subscriptions/SubscriptionStatus.py @@ -1,10 +1,10 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class SubscriptionStatus(PaddleStrEnum): - Active = 'active' - Canceled = 'canceled' - PastDue = 'past_due' - Paused = 'paused' - Trialing = 'trialing' - Inactive = 'inactive' +class SubscriptionStatus(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Active: "SubscriptionStatus" = 'active' + Canceled: "SubscriptionStatus" = 'canceled' + PastDue: "SubscriptionStatus" = 'past_due' + Paused: "SubscriptionStatus" = 'paused' + Trialing: "SubscriptionStatus" = 'trialing' + Inactive: "SubscriptionStatus" = 'inactive' diff --git a/paddle_billing/Notifications/Entities/Transactions/TransactionCardType.py b/paddle_billing/Notifications/Entities/Transactions/TransactionCardType.py index fce08e45..039bf339 100644 --- a/paddle_billing/Notifications/Entities/Transactions/TransactionCardType.py +++ b/paddle_billing/Notifications/Entities/Transactions/TransactionCardType.py @@ -1,14 +1,14 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class TransactionCardType(PaddleStrEnum): - AmericanExpress = 'american_express' - DinersClub = 'diners_club' - Discover = 'discover' - Jcb = 'jcb' - Mada = 'mada' - Maestro = 'maestro' - Mastercard = 'mastercard' - UnionPay = 'union_pay' - Unknown = 'unknown' - Visa = 'visa' +class TransactionCardType(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + AmericanExpress: "TransactionCardType" = 'american_express' + DinersClub: "TransactionCardType" = 'diners_club' + Discover: "TransactionCardType" = 'discover' + Jcb: "TransactionCardType" = 'jcb' + Mada: "TransactionCardType" = 'mada' + Maestro: "TransactionCardType" = 'maestro' + Mastercard: "TransactionCardType" = 'mastercard' + UnionPay: "TransactionCardType" = 'union_pay' + Unknown: "TransactionCardType" = 'unknown' + Visa: "TransactionCardType" = 'visa' diff --git a/paddle_billing/Options.py b/paddle_billing/Options.py index 2e04b2f0..ace7f2b5 100644 --- a/paddle_billing/Options.py +++ b/paddle_billing/Options.py @@ -1,10 +1,10 @@ from __future__ import annotations -from dataclasses import dataclass +from dataclasses import dataclass, field from paddle_billing.Environment import Environment @dataclass class Options: - environment: Environment = Environment.PRODUCTION + environment: Environment = field(default_factory=lambda: Environment.PRODUCTION) retries: int = 1 diff --git a/paddle_billing/PaddleStrEnum.py b/paddle_billing/PaddleStrEnum.py index a78e8aa0..e6b6e147 100644 --- a/paddle_billing/PaddleStrEnum.py +++ b/paddle_billing/PaddleStrEnum.py @@ -1,9 +1,3 @@ -from enum import EnumMeta, StrEnum - -from paddle_billing.Undefined import Undefined - - -# Copied from enum.py because IDE complains when calling protected class super()._is_dunder def _is_dunder(name): """ Returns True if a __dunder__ name, False otherwise. @@ -16,29 +10,94 @@ def _is_dunder(name): ) +class PaddleStrEnumMeta(type): + def __new__( + cls, + name, + bases, + attrs + ): + # Store the original attrs to ensure we have all the class attributes + original_attrs = dict(attrs) -class PaddleStrEnumMeta(EnumMeta): - """ - Returns Undefined() by default when a property doesn't exist - This provides some flexibility for the SDK to handle Paddle adding new properties to their APIspec - """ + # Create the new class with the original attributes + new_class = super().__new__(cls, name, bases, attrs) + + # Create instances for all enum members + for key, value in original_attrs.items(): + if _is_dunder(key) or not isinstance(value, str): + continue + # Set enum member as instance of the class + setattr(new_class, key, new_class(value)) + + return new_class def __getattr__(cls, name): if _is_dunder(name): raise AttributeError(name) + return cls(str(name).lower()) + + +class PaddleStrEnum: + value = None + name = None + + _members = None + _iter_index = 0 + + _unknown_name = 'Undefined' + + def __init__(self, value) -> None: + members = self.members() try: - return super().__getattr__(name) - except AttributeError: - return Undefined() + search = list(members.values()).index(value) + self.value = value + self.name = list(members.keys())[search] + except ValueError: + self.value = value + self.name = self._unknown_name + def __iter__(self) -> "PaddleStrEnum": + self._iter_index = 0 + return self + def __next__(self) -> tuple: + members = self.members() -class PaddleStrEnum(StrEnum, metaclass=PaddleStrEnumMeta): - """ - Subclass of StrEnum but uses PaddleStrEnumMeta metaclass to set Undefined() value to undefined enum keys - """ + if self._iter_index >= len(members): + raise StopIteration + + const_name = list(members.keys())[self._iter_index] + const_value = members[const_name] + self._iter_index += 1 + + return const_name, const_value + + def __repr__(self) -> str: + return f"<{self.__class__.__name__}.{self.name}: {self.value}>" + + def __str__(self) -> str: + return self.value + + def __eq__(self, other) -> bool: + if isinstance(other, str): + return self.value == other + + if isinstance(other, PaddleStrEnum): + return self.value == other.value and self.name == other.name + + return False @classmethod - def is_known(cls) -> bool: - """Not yet implemented""" + def members(cls) -> dict: + if not cls._members: + members = dict(filter(lambda item: not item[0].startswith('__'), cls.__dict__.items())) + cls._members = dict(zip(members.keys(), members.values())) + return cls._members + + def is_known(self): + return not self.name == self._unknown_name + + def to_json(self): + return str(self) diff --git a/paddle_billing/Resources/Prices/Operations/List/Includes.py b/paddle_billing/Resources/Prices/Operations/List/Includes.py index c12ea584..993952e6 100644 --- a/paddle_billing/Resources/Prices/Operations/List/Includes.py +++ b/paddle_billing/Resources/Prices/Operations/List/Includes.py @@ -1,5 +1,5 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Includes(PaddleStrEnum): - Product = 'product' +class Includes(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Product: "Includes" = 'product' diff --git a/paddle_billing/Resources/Products/Operations/List/Includes.py b/paddle_billing/Resources/Products/Operations/List/Includes.py index f291b6f4..3c871630 100644 --- a/paddle_billing/Resources/Products/Operations/List/Includes.py +++ b/paddle_billing/Resources/Products/Operations/List/Includes.py @@ -1,5 +1,5 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Includes(PaddleStrEnum): - Prices = 'prices' +class Includes(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Prices: "Includes" = 'prices' diff --git a/paddle_billing/Resources/Shared/Operations/List/Comparator.py b/paddle_billing/Resources/Shared/Operations/List/Comparator.py index a698f5db..69413ec5 100644 --- a/paddle_billing/Resources/Shared/Operations/List/Comparator.py +++ b/paddle_billing/Resources/Shared/Operations/List/Comparator.py @@ -1,8 +1,8 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Comparator(PaddleStrEnum): - LT = 'LT' - LTE = 'LTE' - GT = 'GT' - GTE = 'GTE' +class Comparator(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + LT: "Comparator" = 'LT' + LTE: "Comparator" = 'LTE' + GT: "Comparator" = 'GT' + GTE: "Comparator" = 'GTE' diff --git a/paddle_billing/Resources/Subscriptions/Operations/Get/Includes.py b/paddle_billing/Resources/Subscriptions/Operations/Get/Includes.py index 22626804..c4f61aa8 100644 --- a/paddle_billing/Resources/Subscriptions/Operations/Get/Includes.py +++ b/paddle_billing/Resources/Subscriptions/Operations/Get/Includes.py @@ -1,6 +1,6 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Includes(PaddleStrEnum): - NextTransaction = 'next_transaction' - RecurringTransactionDetails = 'recurring_transaction_details' +class Includes(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + NextTransaction: "Includes" = 'next_transaction' + RecurringTransactionDetails: "Includes" = 'recurring_transaction_details' diff --git a/paddle_billing/Resources/Transactions/Operations/List/Includes.py b/paddle_billing/Resources/Transactions/Operations/List/Includes.py index a78ef2c0..5e09eb0f 100644 --- a/paddle_billing/Resources/Transactions/Operations/List/Includes.py +++ b/paddle_billing/Resources/Transactions/Operations/List/Includes.py @@ -1,11 +1,11 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Includes(PaddleStrEnum): - Address = 'address' - Adjustment = 'adjustment' - AdjustmentsTotals = 'adjustments_totals' - AvailablePaymentMethods = 'available_payment_methods' - Business = 'business' - Customer = 'customer' - Discount = 'discount' +class Includes(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Address: "Includes" = 'address' + Adjustment: "Includes" = 'adjustment' + AdjustmentsTotals: "Includes" = 'adjustments_totals' + AvailablePaymentMethods: "Includes" = 'available_payment_methods' + Business: "Includes" = 'business' + Customer: "Includes" = 'customer' + Discount: "Includes" = 'discount' diff --git a/paddle_billing/Resources/Transactions/Operations/List/Origin.py b/paddle_billing/Resources/Transactions/Operations/List/Origin.py index 4a6f0de0..8db8e9d9 100644 --- a/paddle_billing/Resources/Transactions/Operations/List/Origin.py +++ b/paddle_billing/Resources/Transactions/Operations/List/Origin.py @@ -1,10 +1,10 @@ -from paddle_billing.PaddleStrEnum import PaddleStrEnum +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta -class Origin(PaddleStrEnum): - Api = 'api' - SubscriptionCharge = 'subscription_charge' - SubscriptionPaymentMethodChange = 'subscription_payment_method_change' - SubscriptionRecurring = 'subscription_recurring' - SubscriptionUpdate = 'subscription_update' - Web = 'web' +class Origin(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + Api: "Origin" = 'api' + SubscriptionCharge: "Origin" = 'subscription_charge' + SubscriptionPaymentMethodChange: "Origin" = 'subscription_payment_method_change' + SubscriptionRecurring: "Origin" = 'subscription_recurring' + SubscriptionUpdate: "Origin" = 'subscription_update' + Web: "Origin" = 'web' diff --git a/tests/Unit/PaddleStrEnum/test_PaddleStrEnum.py b/tests/Unit/PaddleStrEnum/test_PaddleStrEnum.py index 91077f9e..dc3e4335 100644 --- a/tests/Unit/PaddleStrEnum/test_PaddleStrEnum.py +++ b/tests/Unit/PaddleStrEnum/test_PaddleStrEnum.py @@ -1,37 +1,33 @@ from dataclasses import asdict, dataclass, is_dataclass -from paddle_billing.PaddleStrEnum import PaddleStrEnum -from paddle_billing.Undefined import Undefined - +from paddle_billing.PaddleStrEnum import PaddleStrEnum, PaddleStrEnumMeta def test_paddle_str_enum_works_as_expected(): - class TestCountryCodesEnum(PaddleStrEnum): - CA = 'canada' - US = 'usa' - - - assert isinstance(TestCountryCodesEnum.CA, PaddleStrEnum) - assert isinstance(TestCountryCodesEnum.US, PaddleStrEnum) + class TestCountryCodesEnum(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + CA: "TestCountryCodesEnum" = 'canada' + US: "TestCountryCodesEnum" = 'usa' + + assert isinstance(TestCountryCodesEnum.CA, TestCountryCodesEnum) + assert isinstance(TestCountryCodesEnum.US, TestCountryCodesEnum) + assert isinstance(TestCountryCodesEnum('canada'), TestCountryCodesEnum) + assert isinstance(TestCountryCodesEnum('usa'), TestCountryCodesEnum) assert TestCountryCodesEnum.CA == 'canada' assert TestCountryCodesEnum.US == 'usa' assert TestCountryCodesEnum('canada') == 'canada' assert TestCountryCodesEnum('usa') == 'usa' - - # Test for non-existent enum name - assert isinstance(TestCountryCodesEnum.FAKE, Undefined) - + assert TestCountryCodesEnum.CA.name == 'CA' + assert TestCountryCodesEnum('canada').name == 'CA' def test_dataclass_asdict_returns_expected_paddle_str_enum_value(): - class TestCountryCodesEnum(PaddleStrEnum): - CA = 'canada' - US = 'usa' - + class TestCountryCodesEnum(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + CA: "TestCountryCodesEnum" = 'canada' + US: "TestCountryCodesEnum" = 'usa' @dataclass class TestDataclass: - country_code: TestCountryCodesEnum | Undefined = Undefined() + country_code: TestCountryCodesEnum = None def get_parameters(self) -> dict: return asdict(self) @@ -49,4 +45,27 @@ def get_parameters(self) -> dict: assert is_dataclass(test_dataclass) assert isinstance(test_dataclass.get_parameters(), dict) assert test_dataclass.get_parameters().get('country_code', None) is not None - assert type(test_dataclass.get_parameters().get('country_code', None)) == Undefined + assert isinstance(test_dataclass.get_parameters().get('country_code', None), TestCountryCodesEnum) + assert test_dataclass.get_parameters().get('country_code', TestCountryCodesEnum.CA).is_known() == False + + +def test_paddle_str_enum_gracefully_handles_missing_values(): + class TestCountryCodesEnum(PaddleStrEnum, metaclass=PaddleStrEnumMeta): + CA: "TestCountryCodesEnum" = 'canada' + US: "TestCountryCodesEnum" = 'usa' + + assert isinstance(TestCountryCodesEnum.FR, TestCountryCodesEnum) + assert isinstance(TestCountryCodesEnum('france'), TestCountryCodesEnum) + + # Via constructor + assert TestCountryCodesEnum('france') == 'france' + assert TestCountryCodesEnum('france').value == 'france' + assert TestCountryCodesEnum('france').name == 'Undefined' + assert not TestCountryCodesEnum('france').is_known() + + # Via missing attr + assert TestCountryCodesEnum.France == 'france' + assert TestCountryCodesEnum.France.value == 'france' + assert TestCountryCodesEnum.France.name == 'Undefined' + assert not TestCountryCodesEnum.France.is_known() +