From 5cf215bf930299f41df76533e34d9e842da57696 Mon Sep 17 00:00:00 2001 From: cb-nithins Date: Thu, 4 Jan 2024 16:26:01 +0000 Subject: [PATCH] Releasing v2.34.0. Please check the changelog for the updates. --- CHANGELOG.md | 55 ++++++++++++++++++++++++ LICENSE | 2 +- chargebee/models/__init__.py | 1 + chargebee/models/credit_note.py | 2 +- chargebee/models/credit_note_estimate.py | 2 +- chargebee/models/customer.py | 2 +- chargebee/models/entitlement.py | 17 ++++++++ chargebee/models/quote.py | 2 +- chargebee/models/quote_line_group.py | 2 +- chargebee/models/subscription.py | 2 +- chargebee/models/transaction.py | 12 ++++-- chargebee/result.py | 7 ++- chargebee/version.py | 2 +- 13 files changed, 95 insertions(+), 13 deletions(-) create mode 100644 chargebee/models/entitlement.py diff --git a/CHANGELOG.md b/CHANGELOG.md index a3a9eca..d221053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,58 @@ +### v2.34.0 (2024-01-04) +* * * + +#### New resources: +* Entitlements has been added. + +#### New attributes: +* date_to, date_from, prorated_taxable_amount has been added to quote_line_group. +* date_to, date_from, prorated_taxable_amount has been added to quote. +* date_to, date_from, prorated_taxable_amount has been added to credit_note_estimate. +* date_to, date_from, prorated_taxable_amount has been added to credit_note. +* date_to, date_from, prorated_taxable_amount has been added to invoice_estimate. +* date_to, date_from, prorated_taxable_amount has been added to order. +* date_to, date_from, prorated_taxable_amount has been added to invoice. +* active_id has been added to customers. +* active_id has been added to subscriptions. +* reference_id has been made optional for payment_sources/create_using_permanent_token +* payment_method_token, customer_profile_token, network_transaction_id, mandate_id, skip_retrieval, card, billing_address has been added to payment_sources. +* custom_payment_method_id has been added to transactions. +* custom_payment_method_name has been added to transactions. +* error_detail has been added to transactions. + + +#### New Enum values: +* CMR_FALABELLA, TARJETA_NARANJA, NATIVA, CENCOSUD, CABAL, ARGENCARD, ELO, HIPERCARD, CARNET, RUPAY, MAESTRO has been added to Card#CardTypeEnum +* Transferred has been added to Subscription#StatusEnum. +* Transferred has been added to SubscriptionEstimate#StatusEnum. +* proration_type has been added to Subscription#UpdateForItemsRequest. +* proration_type has been added to ItemPrice. +* payment_initiator has been added to Invoice. +* AutomatedBankTransfer has been added to PaymentMethodEnum. +* UsAutomatedBankTransfer, GbAutomatedBankTransfer, EuAutomatedBankTransfer, JpAutomatedBankTransfer, MxAutomatedBankTransfer has been added to VirtualBankAccount#SchemeEnum. +* CustomerBusinessEntityChanged, SubscriptionBusinessEntityChanged has been added to EventTypeEnum. +* Dlocal has been added to GatewayEnum. +* UsAutomatedBankTransfer, UkAutomatedBankTransfer, EuAutomatedBankTransfer, JpAutomatedBankTransfer, MxAutomatedBankTransfer, Custom has been added to OfflinePaymentMethodEnum. +* AutomatedBankTransfer has been added to PaymentMethodEnum. +* AutomatedBankTransfer has been added to PaymentMethodTypeEnum. + +#### New Input parameters: +* custom_payment_method_name has been added to Transactions#RecordRefundRequest. +* proration_type has been added to Subscription#UpdateForItemsRequest. +* payment_method_token, customer_profile_token, network_transaction_id, mandate_id, skip_retrieval, card, billing_address has been added to PaymentSource#CreateUsingPermanentTokenRequest. +* date_to, date_from, prorated_taxable_amount has been added to QuoteLineGroup#LineItemTax. +* date_to, date_from, prorated_taxable_amount has been added to Quote#LineItemTax. +* date_to, date_from, prorated_taxable_amount has been added to CreditNoteEstimate#LineItemTax. +* date_to, date_from, prorated_taxable_amount has been added to CreditNote#LineItemTax. +* date_to, date_from, prorated_taxable_amount has been added to InvoiceEstimate#LineItemTax. +* date_to, date_from, prorated_taxable_amount has been added to Order#LineItemTax. +* date_to, date_from, prorated_taxable_amount has been added to Invoice#LineItemTax. +* active_id has been added to Customer. +* active_id has been added to Subscription. +* subscription_items[proration_type] has been added to Estimate#UpdateSubscriptionForItemsRequest. +* transaction[custom_payment_method_id] has been added to Customer#RecordExcessPaymentRequest. +* transaction[custom_payment_method_id] has been added to CreditNote#RecordRefundRequest. + * * * ### v2.33.0 (2023-11-30) diff --git a/LICENSE b/LICENSE index 0182c81..f22d7e3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License -Copyright (c) 2011-2023 ChargeBee, Inc. +Copyright (c) 2011-2024 ChargeBee, Inc. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/chargebee/models/__init__.py b/chargebee/models/__init__.py index 019812e..d919975 100644 --- a/chargebee/models/__init__.py +++ b/chargebee/models/__init__.py @@ -15,6 +15,7 @@ from chargebee.models.differential_price import DifferentialPrice from chargebee.models.discount import Discount from chargebee.models.download import Download +from chargebee.models.entitlement import Entitlement from chargebee.models.entitlement_override import EntitlementOverride from chargebee.models.estimate import Estimate from chargebee.models.event import Event diff --git a/chargebee/models/credit_note.py b/chargebee/models/credit_note.py index 0da96ae..f11c542 100644 --- a/chargebee/models/credit_note.py +++ b/chargebee/models/credit_note.py @@ -23,7 +23,7 @@ class Tax(Model): fields = ["name", "amount", "description"] pass class LineItemTax(Model): - fields = ["line_item_id", "tax_name", "tax_rate", "is_partial_tax_applied", "is_non_compliance_tax", "taxable_amount", "tax_amount", "tax_juris_type", "tax_juris_name", "tax_juris_code", "tax_amount_in_local_currency", "local_currency_code"] + fields = ["line_item_id", "tax_name", "tax_rate", "date_to", "date_from", "prorated_taxable_amount", "is_partial_tax_applied", "is_non_compliance_tax", "taxable_amount", "tax_amount", "tax_juris_type", "tax_juris_name", "tax_juris_code", "tax_amount_in_local_currency", "local_currency_code"] pass class LinkedRefund(Model): fields = ["txn_id", "applied_amount", "applied_at", "txn_status", "txn_date", "txn_amount", "refund_reason_code"] diff --git a/chargebee/models/credit_note_estimate.py b/chargebee/models/credit_note_estimate.py index 4df20bb..7319e90 100644 --- a/chargebee/models/credit_note_estimate.py +++ b/chargebee/models/credit_note_estimate.py @@ -14,7 +14,7 @@ class Tax(Model): fields = ["name", "amount", "description"] pass class LineItemTax(Model): - fields = ["line_item_id", "tax_name", "tax_rate", "is_partial_tax_applied", "is_non_compliance_tax", "taxable_amount", "tax_amount", "tax_juris_type", "tax_juris_name", "tax_juris_code", "tax_amount_in_local_currency", "local_currency_code"] + fields = ["line_item_id", "tax_name", "tax_rate", "date_to", "date_from", "prorated_taxable_amount", "is_partial_tax_applied", "is_non_compliance_tax", "taxable_amount", "tax_amount", "tax_juris_type", "tax_juris_name", "tax_juris_code", "tax_amount_in_local_currency", "local_currency_code"] pass class LineItemDiscount(Model): fields = ["line_item_id", "discount_type", "coupon_id", "entity_id", "discount_amount"] diff --git a/chargebee/models/customer.py b/chargebee/models/customer.py index 46184f2..71a2f33 100644 --- a/chargebee/models/customer.py +++ b/chargebee/models/customer.py @@ -37,7 +37,7 @@ class ChildAccountAccess(Model): "allow_direct_debit", "is_location_valid", "created_at", "created_from_ip", "exemption_details", \ "taxability", "entity_code", "exempt_number", "resource_version", "updated_at", "locale", "billing_date", \ "billing_month", "billing_date_mode", "billing_day_of_week", "billing_day_of_week_mode", "pii_cleared", \ - "auto_close_invoices", "channel", "card_status", "fraud_flag", "primary_payment_source_id", \ + "auto_close_invoices", "channel", "active_id", "card_status", "fraud_flag", "primary_payment_source_id", \ "backup_payment_source_id", "billing_address", "referral_urls", "contacts", "payment_method", \ "invoice_notes", "business_entity_id", "preferred_currency_code", "promotional_credits", "unbilled_charges", \ "refundable_credits", "excess_payments", "balances", "entity_identifiers", "is_einvoice_enabled", \ diff --git a/chargebee/models/entitlement.py b/chargebee/models/entitlement.py new file mode 100644 index 0000000..1bb0aec --- /dev/null +++ b/chargebee/models/entitlement.py @@ -0,0 +1,17 @@ +import json +from chargebee.model import Model +from chargebee import request +from chargebee import APIError + +class Entitlement(Model): + + fields = ["id", "entity_id", "entity_type", "feature_id", "feature_name", "value", "name"] + + + @staticmethod + def list(params=None, env=None, headers=None): + return request.send_list_request('get', request.uri_path("entitlements"), params, env, headers) + + @staticmethod + def create(params, env=None, headers=None): + return request.send('post', request.uri_path("entitlements"), params, env, headers) diff --git a/chargebee/models/quote.py b/chargebee/models/quote.py index 228a8e8..3c8f556 100644 --- a/chargebee/models/quote.py +++ b/chargebee/models/quote.py @@ -17,7 +17,7 @@ class Tax(Model): fields = ["name", "amount", "description"] pass class LineItemTax(Model): - fields = ["line_item_id", "tax_name", "tax_rate", "is_partial_tax_applied", "is_non_compliance_tax", "taxable_amount", "tax_amount", "tax_juris_type", "tax_juris_name", "tax_juris_code", "tax_amount_in_local_currency", "local_currency_code"] + fields = ["line_item_id", "tax_name", "tax_rate", "date_to", "date_from", "prorated_taxable_amount", "is_partial_tax_applied", "is_non_compliance_tax", "taxable_amount", "tax_amount", "tax_juris_type", "tax_juris_name", "tax_juris_code", "tax_amount_in_local_currency", "local_currency_code"] pass class LineItemTier(Model): fields = ["line_item_id", "starting_unit", "ending_unit", "quantity_used", "unit_amount", "starting_unit_in_decimal", "ending_unit_in_decimal", "quantity_used_in_decimal", "unit_amount_in_decimal"] diff --git a/chargebee/models/quote_line_group.py b/chargebee/models/quote_line_group.py index 9df242e..2c3dd5a 100644 --- a/chargebee/models/quote_line_group.py +++ b/chargebee/models/quote_line_group.py @@ -17,7 +17,7 @@ class Tax(Model): fields = ["name", "amount", "description"] pass class LineItemTax(Model): - fields = ["line_item_id", "tax_name", "tax_rate", "is_partial_tax_applied", "is_non_compliance_tax", "taxable_amount", "tax_amount", "tax_juris_type", "tax_juris_name", "tax_juris_code", "tax_amount_in_local_currency", "local_currency_code"] + fields = ["line_item_id", "tax_name", "tax_rate", "date_to", "date_from", "prorated_taxable_amount", "is_partial_tax_applied", "is_non_compliance_tax", "taxable_amount", "tax_amount", "tax_juris_type", "tax_juris_name", "tax_juris_code", "tax_amount_in_local_currency", "local_currency_code"] pass fields = ["version", "id", "sub_total", "total", "credits_applied", "amount_paid", "amount_due", \ diff --git a/chargebee/models/subscription.py b/chargebee/models/subscription.py index d13031a..48ea063 100644 --- a/chargebee/models/subscription.py +++ b/chargebee/models/subscription.py @@ -47,7 +47,7 @@ class Discount(Model): "cancelled_at", "cancel_reason", "affiliate_token", "created_from_ip", "resource_version", "updated_at", \ "has_scheduled_advance_invoices", "has_scheduled_changes", "payment_source_id", "plan_free_quantity_in_decimal", \ "plan_amount_in_decimal", "cancel_schedule_created_at", "offline_payment_method", "channel", \ - "net_term_days", "subscription_items", "item_tiers", "charged_items", "due_invoices_count", \ + "net_term_days", "active_id", "subscription_items", "item_tiers", "charged_items", "due_invoices_count", \ "due_since", "total_dues", "mrr", "exchange_rate", "base_currency_code", "addons", "event_based_addons", \ "charged_event_based_addons", "coupon", "coupons", "shipping_address", "referral_info", "invoice_notes", \ "meta_data", "metadata", "deleted", "changes_scheduled_at", "contract_term", "cancel_reason_code", \ diff --git a/chargebee/models/transaction.py b/chargebee/models/transaction.py index cf79c74..3582ed0 100644 --- a/chargebee/models/transaction.py +++ b/chargebee/models/transaction.py @@ -16,15 +16,19 @@ class LinkedRefund(Model): class LinkedPayment(Model): fields = ["id", "status", "amount", "date"] pass + class GatewayErrorDetail(Model): + fields = ["request_id", "error_category", "error_code", "error_message", "decline_code", "decline_message", "network_error_code", "error_field", "recommendation_code"] + pass fields = ["id", "customer_id", "subscription_id", "gateway_account_id", "payment_source_id", \ "payment_method", "reference_number", "gateway", "type", "date", "settled_at", "exchange_rate", \ "currency_code", "amount", "id_at_gateway", "status", "fraud_flag", "initiator_type", "three_d_secure", \ "authorization_reason", "error_code", "error_text", "voided_at", "resource_version", "updated_at", \ - "fraud_reason", "amount_unused", "masked_card_number", "reference_transaction_id", "refunded_txn_id", \ - "reference_authorization_id", "amount_capturable", "reversal_transaction_id", "linked_invoices", \ - "linked_credit_notes", "linked_refunds", "linked_payments", "deleted", "iin", "last4", "merchant_reference_id", \ - "business_entity_id", "payment_method_details"] + "fraud_reason", "custom_payment_method_id", "amount_unused", "masked_card_number", "reference_transaction_id", \ + "refunded_txn_id", "reference_authorization_id", "amount_capturable", "reversal_transaction_id", \ + "linked_invoices", "linked_credit_notes", "linked_refunds", "linked_payments", "deleted", "iin", \ + "last4", "merchant_reference_id", "business_entity_id", "payment_method_details", "error_detail", \ + "custom_payment_method_name"] @staticmethod diff --git a/chargebee/result.py b/chargebee/result.py index 81dd071..246524c 100644 --- a/chargebee/result.py +++ b/chargebee/result.py @@ -135,7 +135,7 @@ def gift(self): @property def transaction(self): transaction = self._get('transaction', Transaction, - {'linked_invoices' : Transaction.LinkedInvoice, 'linked_credit_notes' : Transaction.LinkedCreditNote, 'linked_refunds' : Transaction.LinkedRefund, 'linked_payments' : Transaction.LinkedPayment}); + {'linked_invoices' : Transaction.LinkedInvoice, 'linked_credit_notes' : Transaction.LinkedCreditNote, 'linked_refunds' : Transaction.LinkedRefund, 'linked_payments' : Transaction.LinkedPayment, 'gateway_error_detail' : Transaction.GatewayErrorDetail}); return transaction; @property @@ -331,6 +331,11 @@ def item_entitlement(self): item_entitlement = self._get('item_entitlement', ItemEntitlement); return item_entitlement; + @property + def entitlement(self): + entitlement = self._get('entitlement', Entitlement); + return entitlement; + @property def in_app_subscription(self): in_app_subscription = self._get('in_app_subscription', InAppSubscription); diff --git a/chargebee/version.py b/chargebee/version.py index e2ec55b..19cf08a 100644 --- a/chargebee/version.py +++ b/chargebee/version.py @@ -1 +1 @@ -VERSION = '2.33.0' +VERSION = '2.34.0'