diff --git a/CHANGELOG.md b/CHANGELOG.md index 93af2272..25ca82b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,85 @@ +### v4.24.0 (2026-07-21) +* * * +### New Resources: +- [`AsyncResponse`](https://apidocs.chargebee.com/docs/api/async_responses) has been added. +- [`AsyncResponseList`](https://apidocs.chargebee.com/docs/api/async_response_lists) has been added. +- [`ColumnDefinition`](https://apidocs.chargebee.com/docs/api/column_definitions) has been added. +- [`Meter`](https://apidocs.chargebee.com/docs/api/meters) has been added. +- [`MeteredFeature`](https://apidocs.chargebee.com/docs/api/metered_features) has been added. + + +### New Attributes: +- [`currency_code`](https://apidocs.chargebee.com/docs/api/alerts/alert-object#currency_code) has been added to [`Alert`](https://apidocs.chargebee.com/docs/api/alerts). +- [`threshold`](https://apidocs.chargebee.com/docs/api/alerts/alert-object#threshold) has been added to [`Alert`](https://apidocs.chargebee.com/docs/api/alerts). +- [`filter_conditions`](https://apidocs.chargebee.com/docs/api/alerts/alert-object#filter_conditions) has been added to [`Alert`](https://apidocs.chargebee.com/docs/api/alerts). +- [`exchange_rates`](https://apidocs.chargebee.com/docs/api/credit_notes/credit-note-object#exchange_rates) has been added to [`CreditNote`](https://apidocs.chargebee.com/docs/api/credit_notes). +- [`metered`](https://apidocs.chargebee.com/docs/api/features/feature-object#metered) has been added to [`Feature`](https://apidocs.chargebee.com/docs/api/features). +- [`exchange_rates`](https://apidocs.chargebee.com/docs/api/invoices/invoice-object#exchange_rates) has been added to [`Invoice`](https://apidocs.chargebee.com/docs/api/invoices). +- [`payment_intent_metadata`](https://apidocs.chargebee.com/docs/api/payment_intents/payment-intent-object#payment_intent_metadata) has been added to [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). + + +### New Parameters: +- [`metered`](https://apidocs.chargebee.com/docs/api/features/list-features#metered) has been added as query parameter to [`list_features`](https://apidocs.chargebee.com/docs/api/features/list-features) in [`Feature`](https://apidocs.chargebee.com/docs/api/features). +- [`decommissioned`](https://apidocs.chargebee.com/docs/api/subscriptions/list-subscriptions#decommissioned) has been added as query parameter to [`list_subscriptions`](https://apidocs.chargebee.com/docs/api/subscriptions/list-subscriptions) in [`Subscription`](https://apidocs.chargebee.com/docs/api/subscriptions). +- [`currency_code`](https://apidocs.chargebee.com/docs/api/alerts/create-an-alert#currency_code) has been added as request body parameter to [`create_an_alert`](https://apidocs.chargebee.com/docs/api/alerts/create-an-alert) in [`Alert`](https://apidocs.chargebee.com/docs/api/alerts). +- [`line_items.proration_mode`](https://apidocs.chargebee.com/docs/api/credit_notes/import-credit-note#line_items_proration_mode) has been added as request body parameter to [`import_credit_note`](https://apidocs.chargebee.com/docs/api/credit_notes/import-credit-note) in [`CreditNote`](https://apidocs.chargebee.com/docs/api/credit_notes). +- [`item_prices.description`](https://apidocs.chargebee.com/docs/api/estimates/create-invoice-for-items-estimate#item_prices_description) has been added as request body parameter to [`create_invoice_for_items_estimate`](https://apidocs.chargebee.com/docs/api/estimates/create-invoice-for-items-estimate) in [`Estimate`](https://apidocs.chargebee.com/docs/api/estimates). +- [`item_prices.entity_description`](https://apidocs.chargebee.com/docs/api/estimates/create-invoice-for-items-estimate#item_prices_entity_description) has been added as request body parameter to [`create_invoice_for_items_estimate`](https://apidocs.chargebee.com/docs/api/estimates/create-invoice-for-items-estimate) in [`Estimate`](https://apidocs.chargebee.com/docs/api/estimates). +- [`charges.entity_description`](https://apidocs.chargebee.com/docs/api/estimates/create-invoice-for-items-estimate#charges_entity_description) has been added as request body parameter to [`create_invoice_for_items_estimate`](https://apidocs.chargebee.com/docs/api/estimates/create-invoice-for-items-estimate) in [`Estimate`](https://apidocs.chargebee.com/docs/api/estimates). +- [`subscription.decommissioned`](https://apidocs.chargebee.com/docs/api/exports/export-subscriptions#subscription_decommissioned) has been added as request body parameter to [`export_subscriptions`](https://apidocs.chargebee.com/docs/api/exports/export-subscriptions) in [`Export`](https://apidocs.chargebee.com/docs/api/exports). +- [`item_prices.description`](https://apidocs.chargebee.com/docs/api/invoices/create-invoice-for-items-and-one-time-charges#item_prices_description) has been added as request body parameter to [`create_invoice_for_items_and_one-time_charges`](https://apidocs.chargebee.com/docs/api/invoices/create-invoice-for-items-and-one-time-charges) in [`Invoice`](https://apidocs.chargebee.com/docs/api/invoices). +- [`item_prices.entity_description`](https://apidocs.chargebee.com/docs/api/invoices/create-invoice-for-items-and-one-time-charges#item_prices_entity_description) has been added as request body parameter to [`create_invoice_for_items_and_one-time_charges`](https://apidocs.chargebee.com/docs/api/invoices/create-invoice-for-items-and-one-time-charges) in [`Invoice`](https://apidocs.chargebee.com/docs/api/invoices). +- [`charges.entity_description`](https://apidocs.chargebee.com/docs/api/invoices/create-invoice-for-items-and-one-time-charges#charges_entity_description) has been added as request body parameter to [`create_invoice_for_items_and_one-time_charges`](https://apidocs.chargebee.com/docs/api/invoices/create-invoice-for-items-and-one-time-charges) in [`Invoice`](https://apidocs.chargebee.com/docs/api/invoices). +- [`create_pending_invoice`](https://apidocs.chargebee.com/docs/api/invoices/create-invoice-for-items-and-one-time-charges#create_pending_invoice) has been added as request body parameter to [`create_invoice_for_items_and_one-time_charges`](https://apidocs.chargebee.com/docs/api/invoices/create-invoice-for-items-and-one-time-charges) in [`Invoice`](https://apidocs.chargebee.com/docs/api/invoices). +- [`line_items.proration_mode`](https://apidocs.chargebee.com/docs/api/invoices/import-invoice#line_items_proration_mode) has been added as request body parameter to [`import_invoice`](https://apidocs.chargebee.com/docs/api/invoices/import-invoice) in [`Invoice`](https://apidocs.chargebee.com/docs/api/invoices). +- [`paid_at`](https://apidocs.chargebee.com/docs/api/invoices/import-invoice#paid_at) has been added as request body parameter to [`import_invoice`](https://apidocs.chargebee.com/docs/api/invoices/import-invoice) in [`Invoice`](https://apidocs.chargebee.com/docs/api/invoices). +- [`discounts_to_add.quantity`](https://apidocs.chargebee.com/docs/api/ramps/create-a-ramp#discounts_to_add_quantity) has been added as request body parameter to [`create_a_ramp`](https://apidocs.chargebee.com/docs/api/ramps/create-a-ramp) in [`Ramp`](https://apidocs.chargebee.com/docs/api/ramps). +- [`discounts_to_add.quantity`](https://apidocs.chargebee.com/docs/api/ramps/update-a-subscription-ramp#discounts_to_add_quantity) has been added as request body parameter to [`update_a_subscription_ramp`](https://apidocs.chargebee.com/docs/api/ramps/update-a-subscription-ramp) in [`Ramp`](https://apidocs.chargebee.com/docs/api/ramps). +- [`customer.email`](https://apidocs.chargebee.com/docs/api/recorded_purchases/record-a-purchase#customer_email) has been added as request body parameter to [`record_a_purchase`](https://apidocs.chargebee.com/docs/api/recorded_purchases/record-a-purchase) in [`RecordedPurchase`](https://apidocs.chargebee.com/docs/api/recorded_purchases). +- [`customer.first_name`](https://apidocs.chargebee.com/docs/api/recorded_purchases/record-a-purchase#customer_first_name) has been added as request body parameter to [`record_a_purchase`](https://apidocs.chargebee.com/docs/api/recorded_purchases/record-a-purchase) in [`RecordedPurchase`](https://apidocs.chargebee.com/docs/api/recorded_purchases). +- [`customer.last_name`](https://apidocs.chargebee.com/docs/api/recorded_purchases/record-a-purchase#customer_last_name) has been added as request body parameter to [`record_a_purchase`](https://apidocs.chargebee.com/docs/api/recorded_purchases/record-a-purchase) in [`RecordedPurchase`](https://apidocs.chargebee.com/docs/api/recorded_purchases). + + +### Parameter Updates: +- [`metered_feature_id`](https://apidocs.chargebee.com/docs/api/alerts/create-an-alert#metered_feature_id) has been changed from required to optional in [`create_an_alert`](https://apidocs.chargebee.com/docs/api/alerts/create-an-alert) of [`Alert`](https://apidocs.chargebee.com/docs/api/alerts). + + +### New Events: +- [`payment_source_business_entity_changed`](https://apidocs.chargebee.com/docs/api/events/webhook/payment_source_business_entity_changed) has been added. + + +### Deleted Attributes: +- `start_balance` has been removed from [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). +- `end_balance` has been removed from [`LedgerOperation`](https://apidocs.chargebee.com/docs/api/ledger_operations). + + +### New Enums: +- `real_time_payments` has been added as a new value enum `DunningType`. +- `payment_source_business_entity_changed` has been added as a new value enum `EventType`. +- `paynow`, `bizum`, and `promptpay` have been added as new values enum `PaymentMethod`. +- `paynow`, `bizum`, and `promptpay` have been added as new values enum `PaymentMethodType`. +- `active`, `archived`, and `deleted` have been added as new values enum `Status`. +- `zero_rated`, `region_non_taxable`, `product_exempt`, `high_value_physical_goods`, `zero_value_item`, and `tax_not_configured_external_provider` have been added as new values enum `TaxOverrideReason`. +- `paynow`, `bizum`, `promptpay`, `simple`, `compound`, and `spend_exceeded` have been added as new values enum `Type`. +- `success` and `failed` have been added as new values to enum attribute [`status`](https://apidocs.chargebee.com/docs/api/async_responses/async-response-object#status) in [`AsyncResponse`](https://apidocs.chargebee.com/docs/api/async_responses). +- `number` and `string` have been added as new values to enum attribute [`data_type`](https://apidocs.chargebee.com/docs/api/column_definitions/column-definition-object#data_type) in [`ColumnDefinition`](https://apidocs.chargebee.com/docs/api/column_definitions). +- `simple` and `compound` have been added as new values to enum attribute [`type`](https://apidocs.chargebee.com/docs/api/meters/meter-object#type) in [`Meter`](https://apidocs.chargebee.com/docs/api/meters). +- `active`, `archived`, and `deleted` have been added as new values to enum attribute [`status`](https://apidocs.chargebee.com/docs/api/meters/meter-object#status) in [`Meter`](https://apidocs.chargebee.com/docs/api/meters). +- `paynow`, `bizum`, and `promptpay` have been added as new values to enum attribute [`payment_method_type`](https://apidocs.chargebee.com/docs/api/payment_intents/payment-intent-object#payment_method_type) in [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). +- `paynow`, `bizum`, and `promptpay` have been added as new values to enum attribute [`active_payment_attempt.payment_method_type`](https://apidocs.chargebee.com/docs/api/payment_intents/payment-intent-object#active_payment_attempt_payment_method_type) in [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). +- `cb_js`, `components_fields`, `checkout_v3`, `paynow_v3`, `portal_v3`, `gift_v3`, `checkout_v4`, `payment_component`, `pc_inapp_v4`, and `pc_fpc_v4` have been added as new values to enum attribute [`payment_intent_metadata.source`](https://apidocs.chargebee.com/docs/api/payment_intents/payment-intent-object#payment_intent_metadata_source) in [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). +- `adjusted_term`, `service_period_revision`, `delta`, and `reset` have been added as new values to enum request body parameter `line_items.proration_mode` in [`import_credit_note`](https://apidocs.chargebee.com/docs/api/credit_notes/import-credit-note) of [`CreditNote`](https://apidocs.chargebee.com/docs/api/credit_notes). +- `true` and `false` have been added as new values to enum query parameter `metered.is` in [`list_features`](https://apidocs.chargebee.com/docs/api/features/list-features) of [`Feature`](https://apidocs.chargebee.com/docs/api/features). +- `adjusted_term`, `service_period_revision`, `delta`, and `reset` have been added as new values to enum request body parameter `line_items.proration_mode` in [`import_invoice`](https://apidocs.chargebee.com/docs/api/invoices/import-invoice) of [`Invoice`](https://apidocs.chargebee.com/docs/api/invoices). +- `updated_at`, `name`, `created_at`, and `id` have been added as new values to enum query parameter `sort_by.asc` in [`list_all_available_meters`](https://apidocs.chargebee.com/docs/api/meters/list-all-available-meters) of [`Meter`](https://apidocs.chargebee.com/docs/api/meters). +- `updated_at`, `name`, `created_at`, and `id` have been added as new values to enum query parameter `sort_by.desc` in [`list_all_available_meters`](https://apidocs.chargebee.com/docs/api/meters/list-all-available-meters) of [`Meter`](https://apidocs.chargebee.com/docs/api/meters). +- `number` and `string` have been added as new values to enum request body parameter `column_definitions.data_type` in [`create_a_metered_feature`](https://apidocs.chargebee.com/docs/api/metered_features/create-a-metered-feature) of [`MeteredFeature`](https://apidocs.chargebee.com/docs/api/metered_features). +- `paynow`, `bizum`, and `promptpay` have been added as new values to enum request body parameter `payment_method_type` in [`update_a_payment_intent`](https://apidocs.chargebee.com/docs/api/payment_intents/update-a-payment-intent) of [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). +- `paynow`, `bizum`, and `promptpay` have been added as new values to enum request body parameter `payment_method_type` in [`create_a_payment_intent`](https://apidocs.chargebee.com/docs/api/payment_intents/create-a-payment-intent) of [`PaymentIntent`](https://apidocs.chargebee.com/docs/api/payment_intents). +- `true` and `false` have been added as new values to enum query parameter `decommissioned.is` in [`list_subscriptions`](https://apidocs.chargebee.com/docs/api/subscriptions/list-subscriptions) of [`Subscription`](https://apidocs.chargebee.com/docs/api/subscriptions). + + + ### v4.23.0 (2026-06-30) * * * diff --git a/VERSION b/VERSION index 58fe3522..252fdf2c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -4.23.0 +4.24.0 diff --git a/src/Actions/AlertActions.php b/src/Actions/AlertActions.php index f04c437d..290e1e06 100644 --- a/src/Actions/AlertActions.php +++ b/src/Actions/AlertActions.php @@ -240,6 +240,7 @@ public function all(array $params = [], array $headers = []): ListAlertResponse * name?: string, * description?: string, * metered_feature_id?: string, + * currency_code?: string, * subscription_id?: string, * meta?: string, * } $params Description of the parameters diff --git a/src/Actions/Contracts/AlertActionsInterface.php b/src/Actions/Contracts/AlertActionsInterface.php index 6a0bcc00..31a21b44 100644 --- a/src/Actions/Contracts/AlertActionsInterface.php +++ b/src/Actions/Contracts/AlertActionsInterface.php @@ -132,6 +132,7 @@ public function all(array $params = [], array $headers = []): ListAlertResponse; * name?: string, * description?: string, * metered_feature_id?: string, + * currency_code?: string, * subscription_id?: string, * meta?: string, * } $params Description of the parameters diff --git a/src/Actions/Contracts/CreditNoteActionsInterface.php b/src/Actions/Contracts/CreditNoteActionsInterface.php index ab58b330..672a641e 100644 --- a/src/Actions/Contracts/CreditNoteActionsInterface.php +++ b/src/Actions/Contracts/CreditNoteActionsInterface.php @@ -91,6 +91,7 @@ public function recordRefund(string $id, array $params, array $headers = []): Re * tax9_amount?: int, * tax10_name?: string, * tax10_amount?: int, + * proration_mode?: string, * }>, * line_item_tiers?: array, * item_tiers?: array, * notes_to_remove?: array $headers diff --git a/src/Actions/Contracts/InvoiceActionsInterface.php b/src/Actions/Contracts/InvoiceActionsInterface.php index 5e1f46f7..d0324008 100644 --- a/src/Actions/Contracts/InvoiceActionsInterface.php +++ b/src/Actions/Contracts/InvoiceActionsInterface.php @@ -802,6 +802,8 @@ public function createForChargeItem(array $params, array $headers = []): CreateF * unit_price_in_decimal?: string, * date_from?: int, * date_to?: int, + * description?: string, + * entity_description?: string, * }>, * item_tiers?: array, * charges?: array, * payment_reference_numbers?: array $headers diff --git a/src/Actions/Contracts/ItemActionsInterface.php b/src/Actions/Contracts/ItemActionsInterface.php index be97d2d7..f150d119 100644 --- a/src/Actions/Contracts/ItemActionsInterface.php +++ b/src/Actions/Contracts/ItemActionsInterface.php @@ -96,8 +96,8 @@ * not_in?: mixed, * }, * business_entity_id?: array{ - * is?: mixed, * is_present?: mixed, + * is?: mixed, * }, * include_site_level_resources?: array{ * is?: mixed, diff --git a/src/Actions/Contracts/ItemFamilyActionsInterface.php b/src/Actions/Contracts/ItemFamilyActionsInterface.php index 281a920c..56bb02c2 100644 --- a/src/Actions/Contracts/ItemFamilyActionsInterface.php +++ b/src/Actions/Contracts/ItemFamilyActionsInterface.php @@ -53,8 +53,8 @@ public function delete(string $id, array $headers = []): DeleteItemFamilyRespons * between?: mixed, * }, * business_entity_id?: array{ - * is?: mixed, * is_present?: mixed, + * is?: mixed, * }, * include_site_level_resources?: array{ * is?: mixed, diff --git a/src/Actions/Contracts/ItemPriceActionsInterface.php b/src/Actions/Contracts/ItemPriceActionsInterface.php index 747fd076..80e86b7d 100644 --- a/src/Actions/Contracts/ItemPriceActionsInterface.php +++ b/src/Actions/Contracts/ItemPriceActionsInterface.php @@ -248,8 +248,8 @@ public function findApplicableItems(string $id, array $params = [], array $heade * between?: mixed, * }, * business_entity_id?: array{ - * is?: mixed, * is_present?: mixed, + * is?: mixed, * }, * include_site_level_resources?: array{ * is?: mixed, diff --git a/src/Actions/Contracts/MeterActionsInterface.php b/src/Actions/Contracts/MeterActionsInterface.php new file mode 100644 index 00000000..7c0fdfdc --- /dev/null +++ b/src/Actions/Contracts/MeterActionsInterface.php @@ -0,0 +1,40 @@ + $headers + * @return ListMeterResponse + * @throws PaymentException + * @throws OperationFailedException + * @throws APIError + * @throws InvalidRequestException + * @throws Exception + */ + public function all(array $params = [], array $headers = []): ListMeterResponse; + +} +?> \ No newline at end of file diff --git a/src/Actions/Contracts/MeteredFeatureActionsInterface.php b/src/Actions/Contracts/MeteredFeatureActionsInterface.php new file mode 100644 index 00000000..b2c67c98 --- /dev/null +++ b/src/Actions/Contracts/MeteredFeatureActionsInterface.php @@ -0,0 +1,83 @@ + $headers + * @return ReactivateMeteredFeatureResponse + * @throws PaymentException + * @throws OperationFailedException + * @throws APIError + * @throws InvalidRequestException + * @throws Exception + */ + public function reactivate(string $id, array $headers = []): ReactivateMeteredFeatureResponse; + + /** + * @see https://apidocs.chargebee.com/docs/api/metered_features/delete-a-metered-feature?lang=php-v4 + * + * @param string $id + * @param array $headers + * @return DeleteMeteredFeatureResponse + * @throws PaymentException + * @throws OperationFailedException + * @throws APIError + * @throws InvalidRequestException + * @throws Exception + */ + public function delete(string $id, array $headers = []): DeleteMeteredFeatureResponse; + + /** + * @see https://apidocs.chargebee.com/docs/api/metered_features/create-a-metered-feature?lang=php-v4 + * @param array{ + * column_definitions?: array, + * name?: string, + * description?: string, + * feature_unit?: string, + * query?: string, + * } $params Description of the parameters + * + * @param array $headers + * @return CreateMeteredFeatureResponse + * @throws PaymentException + * @throws OperationFailedException + * @throws APIError + * @throws InvalidRequestException + * @throws Exception + */ + public function create(array $params, array $headers = []): CreateMeteredFeatureResponse; + + /** + * @see https://apidocs.chargebee.com/docs/api/metered_features/archive-a-metered-feature?lang=php-v4 + * + * @param string $id + * @param array $headers + * @return ArchiveMeteredFeatureResponse + * @throws PaymentException + * @throws OperationFailedException + * @throws APIError + * @throws InvalidRequestException + * @throws Exception + */ + public function archive(string $id, array $headers = []): ArchiveMeteredFeatureResponse; + +} +?> \ No newline at end of file diff --git a/src/Actions/Contracts/PriceVariantActionsInterface.php b/src/Actions/Contracts/PriceVariantActionsInterface.php index b28c0e11..61a2947f 100644 --- a/src/Actions/Contracts/PriceVariantActionsInterface.php +++ b/src/Actions/Contracts/PriceVariantActionsInterface.php @@ -67,8 +67,8 @@ public function delete(string $id, array $headers = []): DeletePriceVariantRespo * between?: mixed, * }, * business_entity_id?: array{ - * is?: mixed, * is_present?: mixed, + * is?: mixed, * }, * include_site_level_resources?: array{ * is?: mixed, diff --git a/src/Actions/Contracts/RampActionsInterface.php b/src/Actions/Contracts/RampActionsInterface.php index c8a18bba..1df8df1c 100644 --- a/src/Actions/Contracts/RampActionsInterface.php +++ b/src/Actions/Contracts/RampActionsInterface.php @@ -81,6 +81,7 @@ public function retrieve(string $id, array $headers = []): RetrieveRampResponse; * duration_type?: string, * percentage?: float, * amount?: int, + * quantity?: int, * period?: int, * period_unit?: string, * included_in_mrr?: bool, @@ -197,6 +198,7 @@ public function all(array $params, array $headers = []): ListRampResponse; * duration_type?: string, * percentage?: float, * amount?: int, + * quantity?: int, * period?: int, * period_unit?: string, * included_in_mrr?: bool, diff --git a/src/Actions/Contracts/RecordedPurchaseActionsInterface.php b/src/Actions/Contracts/RecordedPurchaseActionsInterface.php index a8242d3d..67a4f982 100644 --- a/src/Actions/Contracts/RecordedPurchaseActionsInterface.php +++ b/src/Actions/Contracts/RecordedPurchaseActionsInterface.php @@ -31,6 +31,9 @@ public function retrieve(string $id, array $headers = []): RetrieveRecordedPurch * @param array{ * customer?: array{ * id?: string, + * email?: string, + * first_name?: string, + * last_name?: string, * }, * apple_app_store?: array{ * transaction_id?: string, diff --git a/src/Actions/Contracts/SubscriptionActionsInterface.php b/src/Actions/Contracts/SubscriptionActionsInterface.php index 5b3a0090..5975c2b0 100644 --- a/src/Actions/Contracts/SubscriptionActionsInterface.php +++ b/src/Actions/Contracts/SubscriptionActionsInterface.php @@ -481,6 +481,9 @@ public function regenerateInvoice(string $id, array $params = [], array $headers * in?: mixed, * not_in?: mixed, * }, + * decommissioned?: array{ + * is?: mixed, + * }, * } $params Description of the parameters * * @param array $headers diff --git a/src/Actions/CreditNoteActions.php b/src/Actions/CreditNoteActions.php index 319c9635..d7be5867 100644 --- a/src/Actions/CreditNoteActions.php +++ b/src/Actions/CreditNoteActions.php @@ -124,6 +124,7 @@ public function recordRefund(string $id, array $params, array $headers = []): Re * tax9_amount?: int, * tax10_name?: string, * tax10_amount?: int, + * proration_mode?: string, * }>, * line_item_tiers?: array, * item_tiers?: array, * notes_to_remove?: array $headers diff --git a/src/Actions/InvoiceActions.php b/src/Actions/InvoiceActions.php index 73250948..52146297 100644 --- a/src/Actions/InvoiceActions.php +++ b/src/Actions/InvoiceActions.php @@ -1192,6 +1192,8 @@ public function createForChargeItem(array $params, array $headers = []): CreateF * unit_price_in_decimal?: string, * date_from?: int, * date_to?: int, + * description?: string, + * entity_description?: string, * }>, * item_tiers?: array, * charges?: array, * payment_reference_numbers?: array $headers diff --git a/src/Actions/ItemActions.php b/src/Actions/ItemActions.php index 2e459e5a..9a2821db 100644 --- a/src/Actions/ItemActions.php +++ b/src/Actions/ItemActions.php @@ -109,8 +109,8 @@ public function __construct(HttpClientFactory $httpClientFactory, Environment $e * not_in?: mixed, * }, * business_entity_id?: array{ - * is?: mixed, * is_present?: mixed, + * is?: mixed, * }, * include_site_level_resources?: array{ * is?: mixed, diff --git a/src/Actions/ItemFamilyActions.php b/src/Actions/ItemFamilyActions.php index b2f019e0..7619d591 100644 --- a/src/Actions/ItemFamilyActions.php +++ b/src/Actions/ItemFamilyActions.php @@ -85,8 +85,8 @@ public function delete(string $id, array $headers = []): DeleteItemFamilyRespons * between?: mixed, * }, * business_entity_id?: array{ - * is?: mixed, * is_present?: mixed, + * is?: mixed, * }, * include_site_level_resources?: array{ * is?: mixed, diff --git a/src/Actions/ItemPriceActions.php b/src/Actions/ItemPriceActions.php index f563f943..0195f4c2 100644 --- a/src/Actions/ItemPriceActions.php +++ b/src/Actions/ItemPriceActions.php @@ -357,8 +357,8 @@ public function findApplicableItems(string $id, array $params = [], array $heade * between?: mixed, * }, * business_entity_id?: array{ - * is?: mixed, * is_present?: mixed, + * is?: mixed, * }, * include_site_level_resources?: array{ * is?: mixed, diff --git a/src/Actions/MeterActions.php b/src/Actions/MeterActions.php new file mode 100644 index 00000000..5bd549c4 --- /dev/null +++ b/src/Actions/MeterActions.php @@ -0,0 +1,72 @@ +httpClientFactory = $httpClientFactory; + $this->env = $env; + } + + /** + * @see https://apidocs.chargebee.com/docs/api/meters/list-all-available-meters?lang=php-v4 + * @param array{ + * limit?: int, + * offset?: string, + * name?: array{ + * is?: mixed, + * starts_with?: mixed, + * }, + * sort_by?: array{ + * asc?: string, + * desc?: string, + * }, + * } $params Description of the parameters + * + * @param array $headers + * @return ListMeterResponse + * @throws PaymentException + * @throws OperationFailedException + * @throws APIError + * @throws InvalidRequestException + * @throws Exception + */ + public function all(array $params = [], array $headers = []): ListMeterResponse + { + $jsonKeys = [ + ]; + $payload = ChargebeePayload::builder() + ->withEnvironment($this->env) + ->withHttpMethod("get") + ->withUriPaths(["meters"]) + ->withParamEncoder(new ListParamEncoder()) + ->withSubDomain(null) + ->withJsonKeys($jsonKeys) + ->withHeaders($headers) + ->withParams($params) + ->withTelemetryResource("meter") + ->withTelemetryOperation("list") + ->build(); + $apiRequester = new APIRequester($this->httpClientFactory, $this->env); + $respObject = $apiRequester->makeRequest($payload); + return ListMeterResponse::from($respObject->data, $respObject->headers); + } + +} +?> \ No newline at end of file diff --git a/src/Actions/MeteredFeatureActions.php b/src/Actions/MeteredFeatureActions.php new file mode 100644 index 00000000..0df05445 --- /dev/null +++ b/src/Actions/MeteredFeatureActions.php @@ -0,0 +1,172 @@ +httpClientFactory = $httpClientFactory; + $this->env = $env; + } + + /** + * @see https://apidocs.chargebee.com/docs/api/metered_features/reactivate-a-metered-feature?lang=php-v4 + * + * @param string $id + * @param array $headers + * @return ReactivateMeteredFeatureResponse + * @throws PaymentException + * @throws OperationFailedException + * @throws APIError + * @throws InvalidRequestException + * @throws Exception + */ + public function reactivate(string $id, array $headers = []): ReactivateMeteredFeatureResponse + { + $jsonKeys = [ + ]; + $payload = ChargebeePayload::builder() + ->withEnvironment($this->env) + ->withHttpMethod("post") + ->withUriPaths(["metered_features",$id,"reactivate_command"]) + ->withParamEncoder( new URLFormEncoder()) + ->withSubDomain(null) + ->withJsonKeys($jsonKeys) + ->withHeaders($headers) + ->withIdempotent(true) + ->withTelemetryResource("meteredFeature") + ->withTelemetryOperation("reactivate") + ->build(); + $apiRequester = new APIRequester($this->httpClientFactory, $this->env); + $respObject = $apiRequester->makeRequest($payload); + return ReactivateMeteredFeatureResponse::from($respObject->data, $respObject->headers); + } + + /** + * @see https://apidocs.chargebee.com/docs/api/metered_features/delete-a-metered-feature?lang=php-v4 + * + * @param string $id + * @param array $headers + * @return DeleteMeteredFeatureResponse + * @throws PaymentException + * @throws OperationFailedException + * @throws APIError + * @throws InvalidRequestException + * @throws Exception + */ + public function delete(string $id, array $headers = []): DeleteMeteredFeatureResponse + { + $jsonKeys = [ + ]; + $payload = ChargebeePayload::builder() + ->withEnvironment($this->env) + ->withHttpMethod("post") + ->withUriPaths(["metered_features",$id,"delete"]) + ->withParamEncoder( new URLFormEncoder()) + ->withSubDomain(null) + ->withJsonKeys($jsonKeys) + ->withHeaders($headers) + ->withIdempotent(true) + ->withTelemetryResource("meteredFeature") + ->withTelemetryOperation("delete") + ->build(); + $apiRequester = new APIRequester($this->httpClientFactory, $this->env); + $respObject = $apiRequester->makeRequest($payload); + return DeleteMeteredFeatureResponse::from($respObject->data, $respObject->headers); + } + + /** + * @see https://apidocs.chargebee.com/docs/api/metered_features/create-a-metered-feature?lang=php-v4 + * @param array{ + * column_definitions?: array, + * name?: string, + * description?: string, + * feature_unit?: string, + * query?: string, + * } $params Description of the parameters + * + * @param array $headers + * @return CreateMeteredFeatureResponse + * @throws PaymentException + * @throws OperationFailedException + * @throws APIError + * @throws InvalidRequestException + * @throws Exception + */ + public function create(array $params, array $headers = []): CreateMeteredFeatureResponse + { + $jsonKeys = [ + ]; + $payload = ChargebeePayload::builder() + ->withEnvironment($this->env) + ->withHttpMethod("post") + ->withUriPaths(["metered_features"]) + ->withParamEncoder( new URLFormEncoder()) + ->withSubDomain(null) + ->withJsonKeys($jsonKeys) + ->withHeaders($headers) + ->withParams($params) + ->withIdempotent(true) + ->withTelemetryResource("meteredFeature") + ->withTelemetryOperation("create") + ->build(); + $apiRequester = new APIRequester($this->httpClientFactory, $this->env); + $respObject = $apiRequester->makeRequest($payload); + return CreateMeteredFeatureResponse::from($respObject->data, $respObject->headers); + } + + /** + * @see https://apidocs.chargebee.com/docs/api/metered_features/archive-a-metered-feature?lang=php-v4 + * + * @param string $id + * @param array $headers + * @return ArchiveMeteredFeatureResponse + * @throws PaymentException + * @throws OperationFailedException + * @throws APIError + * @throws InvalidRequestException + * @throws Exception + */ + public function archive(string $id, array $headers = []): ArchiveMeteredFeatureResponse + { + $jsonKeys = [ + ]; + $payload = ChargebeePayload::builder() + ->withEnvironment($this->env) + ->withHttpMethod("post") + ->withUriPaths(["metered_features",$id,"archive_command"]) + ->withParamEncoder( new URLFormEncoder()) + ->withSubDomain(null) + ->withJsonKeys($jsonKeys) + ->withHeaders($headers) + ->withIdempotent(true) + ->withTelemetryResource("meteredFeature") + ->withTelemetryOperation("archive") + ->build(); + $apiRequester = new APIRequester($this->httpClientFactory, $this->env); + $respObject = $apiRequester->makeRequest($payload); + return ArchiveMeteredFeatureResponse::from($respObject->data, $respObject->headers); + } + +} +?> \ No newline at end of file diff --git a/src/Actions/PriceVariantActions.php b/src/Actions/PriceVariantActions.php index b3715575..c89292c8 100644 --- a/src/Actions/PriceVariantActions.php +++ b/src/Actions/PriceVariantActions.php @@ -99,8 +99,8 @@ public function delete(string $id, array $headers = []): DeletePriceVariantRespo * between?: mixed, * }, * business_entity_id?: array{ - * is?: mixed, * is_present?: mixed, + * is?: mixed, * }, * include_site_level_resources?: array{ * is?: mixed, diff --git a/src/Actions/RampActions.php b/src/Actions/RampActions.php index e11c1e66..897af978 100644 --- a/src/Actions/RampActions.php +++ b/src/Actions/RampActions.php @@ -112,6 +112,7 @@ public function retrieve(string $id, array $headers = []): RetrieveRampResponse * duration_type?: string, * percentage?: float, * amount?: int, + * quantity?: int, * period?: int, * period_unit?: string, * included_in_mrr?: bool, @@ -267,6 +268,7 @@ public function all(array $params, array $headers = []): ListRampResponse * duration_type?: string, * percentage?: float, * amount?: int, + * quantity?: int, * period?: int, * period_unit?: string, * included_in_mrr?: bool, diff --git a/src/Actions/RecordedPurchaseActions.php b/src/Actions/RecordedPurchaseActions.php index 78ad9798..b0246bc4 100644 --- a/src/Actions/RecordedPurchaseActions.php +++ b/src/Actions/RecordedPurchaseActions.php @@ -61,6 +61,9 @@ public function retrieve(string $id, array $headers = []): RetrieveRecordedPurch * @param array{ * customer?: array{ * id?: string, + * email?: string, + * first_name?: string, + * last_name?: string, * }, * apple_app_store?: array{ * transaction_id?: string, diff --git a/src/Actions/SubscriptionActions.php b/src/Actions/SubscriptionActions.php index db67ce75..79a8a51e 100644 --- a/src/Actions/SubscriptionActions.php +++ b/src/Actions/SubscriptionActions.php @@ -617,6 +617,9 @@ public function regenerateInvoice(string $id, array $params = [], array $headers * in?: mixed, * not_in?: mixed, * }, + * decommissioned?: array{ + * is?: mixed, + * }, * } $params Description of the parameters * * @param array $headers diff --git a/src/ChargebeeClient.php b/src/ChargebeeClient.php index 43b8c940..20a42700 100644 --- a/src/ChargebeeClient.php +++ b/src/ChargebeeClient.php @@ -68,6 +68,10 @@ use Chargebee\Actions\LedgerAccountBalanceActions; use Chargebee\Actions\Contracts\LedgerOperationActionsInterface; use Chargebee\Actions\LedgerOperationActions; +use Chargebee\Actions\Contracts\MeterActionsInterface; +use Chargebee\Actions\MeterActions; +use Chargebee\Actions\Contracts\MeteredFeatureActionsInterface; +use Chargebee\Actions\MeteredFeatureActions; use Chargebee\Actions\Contracts\NonSubscriptionActionsInterface; use Chargebee\Actions\NonSubscriptionActions; use Chargebee\Actions\Contracts\OfferEventActionsInterface; @@ -357,6 +361,14 @@ public function ledgerOperation() :LedgerOperationActionsInterface { return new LedgerOperationActions($this->httpClientFactory, $this->env); } + public function meter() :MeterActionsInterface { + return new MeterActions($this->httpClientFactory, $this->env); + } + + public function meteredFeature() :MeteredFeatureActionsInterface { + return new MeteredFeatureActions($this->httpClientFactory, $this->env); + } + public function nonSubscription() :NonSubscriptionActionsInterface { return new NonSubscriptionActions($this->httpClientFactory, $this->env); } diff --git a/src/Enums/DunningType.php b/src/Enums/DunningType.php index f7cab1bd..b06c14e2 100644 --- a/src/Enums/DunningType.php +++ b/src/Enums/DunningType.php @@ -6,6 +6,7 @@ enum DunningType : string { case AUTO_COLLECT = "auto_collect"; case OFFLINE = "offline"; case DIRECT_DEBIT = "direct_debit"; + case REAL_TIME_PAYMENTS = "real_time_payments"; case UNKNOWN = "unknown"; public static function tryFromValue(string $value): self { diff --git a/src/Enums/EnabledEvents.php b/src/Enums/EnabledEvents.php index f23eb8c6..0c036e00 100644 --- a/src/Enums/EnabledEvents.php +++ b/src/Enums/EnabledEvents.php @@ -164,6 +164,7 @@ enum EnabledEvents : string { case BUSINESS_ENTITY_DELETED = "business_entity_deleted"; case CUSTOMER_BUSINESS_ENTITY_CHANGED = "customer_business_entity_changed"; case SUBSCRIPTION_BUSINESS_ENTITY_CHANGED = "subscription_business_entity_changed"; + case PAYMENT_SOURCE_BUSINESS_ENTITY_CHANGED = "payment_source_business_entity_changed"; case PURCHASE_CREATED = "purchase_created"; case VOUCHER_CREATED = "voucher_created"; case VOUCHER_EXPIRED = "voucher_expired"; diff --git a/src/Enums/EventType.php b/src/Enums/EventType.php index 3810b899..66ae7b85 100644 --- a/src/Enums/EventType.php +++ b/src/Enums/EventType.php @@ -163,6 +163,7 @@ enum EventType : string { case BUSINESS_ENTITY_DELETED = "business_entity_deleted"; case CUSTOMER_BUSINESS_ENTITY_CHANGED = "customer_business_entity_changed"; case SUBSCRIPTION_BUSINESS_ENTITY_CHANGED = "subscription_business_entity_changed"; + case PAYMENT_SOURCE_BUSINESS_ENTITY_CHANGED = "payment_source_business_entity_changed"; case PURCHASE_CREATED = "purchase_created"; case VOUCHER_CREATED = "voucher_created"; case VOUCHER_EXPIRED = "voucher_expired"; diff --git a/src/Enums/PaymentMethod.php b/src/Enums/PaymentMethod.php index fe584209..98ce89d3 100644 --- a/src/Enums/PaymentMethod.php +++ b/src/Enums/PaymentMethod.php @@ -58,6 +58,9 @@ enum PaymentMethod : string { case PAYPAY = "paypay"; case GCASH = "gcash"; case SOUTH_KOREAN_CARDS = "south_korean_cards"; + case PAYNOW = "paynow"; + case BIZUM = "bizum"; + case PROMPTPAY = "promptpay"; /* * @depcreated */ diff --git a/src/Enums/PaymentMethodType.php b/src/Enums/PaymentMethodType.php index 92cc1356..e7faa076 100644 --- a/src/Enums/PaymentMethodType.php +++ b/src/Enums/PaymentMethodType.php @@ -50,6 +50,9 @@ enum PaymentMethodType : string { case PAYPAY = "paypay"; case GCASH = "gcash"; case SOUTH_KOREAN_CARDS = "south_korean_cards"; + case PAYNOW = "paynow"; + case BIZUM = "bizum"; + case PROMPTPAY = "promptpay"; case UNKNOWN = "unknown"; public static function tryFromValue(string $value): self { diff --git a/src/Enums/Status.php b/src/Enums/Status.php index 6ee5b977..bd7c073c 100644 --- a/src/Enums/Status.php +++ b/src/Enums/Status.php @@ -3,6 +3,9 @@ namespace Chargebee\Enums; enum Status : string { + case ACTIVE = "active"; + case ARCHIVED = "archived"; + case DELETED = "deleted"; case AVAILABLE = "available"; case EXHAUSTED = "exhausted"; case SCHEDULED = "scheduled"; diff --git a/src/Enums/TaxOverrideReason.php b/src/Enums/TaxOverrideReason.php index bd40320c..90689b23 100644 --- a/src/Enums/TaxOverrideReason.php +++ b/src/Enums/TaxOverrideReason.php @@ -3,9 +3,15 @@ namespace Chargebee\Enums; enum TaxOverrideReason : string { + case ZERO_RATED = "zero_rated"; case ID_EXEMPT = "id_exempt"; case CUSTOMER_EXEMPT = "customer_exempt"; + case REGION_NON_TAXABLE = "region_non_taxable"; + case PRODUCT_EXEMPT = "product_exempt"; case EXPORT = "export"; + case HIGH_VALUE_PHYSICAL_GOODS = "high_value_physical_goods"; + case ZERO_VALUE_ITEM = "zero_value_item"; + case TAX_NOT_CONFIGURED_EXTERNAL_PROVIDER = "tax_not_configured_external_provider"; case UNKNOWN = "unknown"; public static function tryFromValue(string $value): self { diff --git a/src/Enums/Type.php b/src/Enums/Type.php index 5b2e2683..727257c1 100644 --- a/src/Enums/Type.php +++ b/src/Enums/Type.php @@ -50,10 +50,16 @@ enum Type : string { case PAYPAY = "paypay"; case GCASH = "gcash"; case SOUTH_KOREAN_CARDS = "south_korean_cards"; + case PAYNOW = "paynow"; + case BIZUM = "bizum"; + case PROMPTPAY = "promptpay"; case FREE_TRIAL = "free_trial"; case PAY_UP_FRONT = "pay_up_front"; case PAY_AS_YOU_GO = "pay_as_you_go"; + case SIMPLE = "simple"; + case COMPOUND = "compound"; case USAGE_EXCEEDED = "usage_exceeded"; + case SPEND_EXCEEDED = "spend_exceeded"; case UNKNOWN = "unknown"; public static function tryFromValue(string $value): self { diff --git a/src/Resources/Alert/Alert.php b/src/Resources/Alert/Alert.php index 336cb848..4302a059 100644 --- a/src/Resources/Alert/Alert.php +++ b/src/Resources/Alert/Alert.php @@ -27,6 +27,12 @@ class Alert { */ public ?string $metered_feature_id; + /** + * + * @var ?string $currency_code + */ + public ?string $currency_code; + /** * * @var ?string $subscription_id @@ -51,6 +57,18 @@ class Alert { */ public ?int $updated_at; + /** + * + * @var ?array $threshold + */ + public ?array $threshold; + + /** + * + * @var ?array $filter_conditions + */ + public ?array $filter_conditions; + /** * * @var ?\Chargebee\Enums\Type $type @@ -66,7 +84,7 @@ class Alert { /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "name" , "description" , "metered_feature_id" , "subscription_id" , "meta" , "created_at" , "updated_at" ]; + protected static array $knownFields = [ "id" , "name" , "description" , "metered_feature_id" , "currency_code" , "subscription_id" , "meta" , "created_at" , "updated_at" , "threshold" , "filter_conditions" ]; /** * dynamic properties for resources @@ -79,10 +97,13 @@ private function __construct( ?string $name, ?string $description, ?string $metered_feature_id, + ?string $currency_code, ?string $subscription_id, ?string $meta, ?int $created_at, ?int $updated_at, + ?array $threshold, + ?array $filter_conditions, ?\Chargebee\Enums\Type $type, ?\Chargebee\Resources\Alert\Enums\Status $status, ) @@ -91,24 +112,38 @@ private function __construct( $this->name = $name; $this->description = $description; $this->metered_feature_id = $metered_feature_id; + $this->currency_code = $currency_code; $this->subscription_id = $subscription_id; $this->meta = $meta; $this->created_at = $created_at; - $this->updated_at = $updated_at; + $this->updated_at = $updated_at; + $this->threshold = $threshold; + $this->filter_conditions = $filter_conditions; $this->type = $type; $this->status = $status; } public static function from(array $resourceAttributes): self { + $threshold = array_map(fn (array $result): Threshold => Threshold::from( + $result + ), $resourceAttributes['threshold'] ?? []); + + $filter_conditions = array_map(fn (array $result): FilterCondition => FilterCondition::from( + $result + ), $resourceAttributes['filter_conditions'] ?? []); + $returnData = new self( $resourceAttributes['id'] ?? null, $resourceAttributes['name'] ?? null, $resourceAttributes['description'] ?? null, $resourceAttributes['metered_feature_id'] ?? null, + $resourceAttributes['currency_code'] ?? null, $resourceAttributes['subscription_id'] ?? null, $resourceAttributes['meta'] ?? null, $resourceAttributes['created_at'] ?? null, $resourceAttributes['updated_at'] ?? null, + $threshold, + $filter_conditions, isset($resourceAttributes['type']) ? \Chargebee\Enums\Type::tryFromValue($resourceAttributes['type']) : null, @@ -127,11 +162,14 @@ public function toArray(): array 'name' => $this->name, 'description' => $this->description, 'metered_feature_id' => $this->metered_feature_id, + 'currency_code' => $this->currency_code, 'subscription_id' => $this->subscription_id, 'meta' => $this->meta, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, + + 'type' => $this->type?->value, 'status' => $this->status?->value, @@ -142,6 +180,18 @@ public function toArray(): array + if($this->threshold !== []){ + $data['threshold'] = array_map( + fn (Threshold $threshold): array => $threshold->toArray(), + $this->threshold + ); + } + if($this->filter_conditions !== []){ + $data['filter_conditions'] = array_map( + fn (FilterCondition $filter_conditions): array => $filter_conditions->toArray(), + $this->filter_conditions + ); + } return $data; diff --git a/src/Resources/Alert/Enums/FilterConditionField.php b/src/Resources/Alert/Enums/FilterConditionField.php new file mode 100644 index 00000000..4f340355 --- /dev/null +++ b/src/Resources/Alert/Enums/FilterConditionField.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/src/Resources/Alert/Enums/FilterConditionOperator.php b/src/Resources/Alert/Enums/FilterConditionOperator.php new file mode 100644 index 00000000..f2f8e3b7 --- /dev/null +++ b/src/Resources/Alert/Enums/FilterConditionOperator.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/src/Resources/Alert/FilterCondition.php b/src/Resources/Alert/FilterCondition.php new file mode 100644 index 00000000..51e569f9 --- /dev/null +++ b/src/Resources/Alert/FilterCondition.php @@ -0,0 +1,76 @@ + $knownFields + */ + protected static array $knownFields = [ "field" , "operator" , "value" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?string $field, + ?string $operator, + ?string $value, + ) + { + $this->field = $field; + $this->operator = $operator; + $this->value = $value; + } + + public static function from(array $resourceAttributes): self + { + $returnData = new self( $resourceAttributes['field'] ?? null, + $resourceAttributes['operator'] ?? null, + $resourceAttributes['value'] ?? null, + + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter(['field' => $this->field, + 'operator' => $this->operator, + 'value' => $this->value, + + ], function ($value) { + return $value !== null; + }); + + + + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/Alert/Threshold.php b/src/Resources/Alert/Threshold.php new file mode 100644 index 00000000..314e8b8d --- /dev/null +++ b/src/Resources/Alert/Threshold.php @@ -0,0 +1,66 @@ + $knownFields + */ + protected static array $knownFields = [ "mode" , "value" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?string $mode, + ?float $value, + ) + { + $this->mode = $mode; + $this->value = $value; + } + + public static function from(array $resourceAttributes): self + { + $returnData = new self( $resourceAttributes['mode'] ?? null, + $resourceAttributes['value'] ?? null, + + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter(['mode' => $this->mode, + 'value' => $this->value, + + ], function ($value) { + return $value !== null; + }); + + + + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/AsyncResponse/AsyncResponse.php b/src/Resources/AsyncResponse/AsyncResponse.php new file mode 100644 index 00000000..87057786 --- /dev/null +++ b/src/Resources/AsyncResponse/AsyncResponse.php @@ -0,0 +1,124 @@ + $knownFields + */ + protected static array $knownFields = [ "api_version" , "created_at" , "completed_at" , "request" , "error_detail" , "result" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?string $api_version, + ?int $created_at, + ?int $completed_at, + ?RequestAsyncApi $request, + ?Error $error_detail, + mixed $result, + ?\Chargebee\Resources\AsyncResponse\Enums\Status $status, + ) + { + $this->api_version = $api_version; + $this->created_at = $created_at; + $this->completed_at = $completed_at; + $this->request = $request; + $this->error_detail = $error_detail; + $this->result = $result; + $this->status = $status; + } + + public static function from(array $resourceAttributes): self + { + $returnData = new self( $resourceAttributes['api_version'] ?? null, + $resourceAttributes['created_at'] ?? null, + $resourceAttributes['completed_at'] ?? null, + isset($resourceAttributes['request']) ? RequestAsyncApi::from($resourceAttributes['request']) : null, + isset($resourceAttributes['error_detail']) ? Error::from($resourceAttributes['error_detail']) : null, + $resourceAttributes['result'] ?? null, + + + isset($resourceAttributes['status']) ? \Chargebee\Resources\AsyncResponse\Enums\Status::tryFromValue($resourceAttributes['status']) : null, + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter(['api_version' => $this->api_version, + 'created_at' => $this->created_at, + 'completed_at' => $this->completed_at, + + + 'result' => $this->result, + + 'status' => $this->status?->value, + + ], function ($value) { + return $value !== null; + }); + + + if($this->request instanceof RequestAsyncApi){ + $data['request'] = $this->request->toArray(); + } + if($this->error_detail instanceof Error){ + $data['error_detail'] = $this->error_detail->toArray(); + } + + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/AsyncResponse/Enums/Status.php b/src/Resources/AsyncResponse/Enums/Status.php new file mode 100644 index 00000000..f3a3c2a3 --- /dev/null +++ b/src/Resources/AsyncResponse/Enums/Status.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/src/Resources/AsyncResponse/Error.php b/src/Resources/AsyncResponse/Error.php new file mode 100644 index 00000000..b24d5fc6 --- /dev/null +++ b/src/Resources/AsyncResponse/Error.php @@ -0,0 +1,106 @@ + $knownFields + */ + protected static array $knownFields = [ "message" , "type" , "api_error_code" , "error_code" , "error_msg" , "http_status_code" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?string $message, + ?string $type, + ?string $api_error_code, + ?string $error_code, + ?string $error_msg, + ?string $http_status_code, + ) + { + $this->message = $message; + $this->type = $type; + $this->api_error_code = $api_error_code; + $this->error_code = $error_code; + $this->error_msg = $error_msg; + $this->http_status_code = $http_status_code; + } + + public static function from(array $resourceAttributes): self + { + $returnData = new self( $resourceAttributes['message'] ?? null, + $resourceAttributes['type'] ?? null, + $resourceAttributes['api_error_code'] ?? null, + $resourceAttributes['error_code'] ?? null, + $resourceAttributes['error_msg'] ?? null, + $resourceAttributes['http_status_code'] ?? null, + + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter(['message' => $this->message, + 'type' => $this->type, + 'api_error_code' => $this->api_error_code, + 'error_code' => $this->error_code, + 'error_msg' => $this->error_msg, + 'http_status_code' => $this->http_status_code, + + ], function ($value) { + return $value !== null; + }); + + + + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/AsyncResponse/RequestAsyncApi.php b/src/Resources/AsyncResponse/RequestAsyncApi.php new file mode 100644 index 00000000..6e6b607b --- /dev/null +++ b/src/Resources/AsyncResponse/RequestAsyncApi.php @@ -0,0 +1,106 @@ + $knownFields + */ + protected static array $knownFields = [ "id" , "resource" , "operation_type" , "method" , "uri" , "idempotency_key" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?string $id, + ?string $resource, + ?string $operation_type, + ?string $method, + ?string $uri, + ?string $idempotency_key, + ) + { + $this->id = $id; + $this->resource = $resource; + $this->operation_type = $operation_type; + $this->method = $method; + $this->uri = $uri; + $this->idempotency_key = $idempotency_key; + } + + public static function from(array $resourceAttributes): self + { + $returnData = new self( $resourceAttributes['id'] ?? null, + $resourceAttributes['resource'] ?? null, + $resourceAttributes['operation_type'] ?? null, + $resourceAttributes['method'] ?? null, + $resourceAttributes['uri'] ?? null, + $resourceAttributes['idempotency_key'] ?? null, + + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter(['id' => $this->id, + 'resource' => $this->resource, + 'operation_type' => $this->operation_type, + 'method' => $this->method, + 'uri' => $this->uri, + 'idempotency_key' => $this->idempotency_key, + + ], function ($value) { + return $value !== null; + }); + + + + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/AsyncResponseList/AsyncResponseList.php b/src/Resources/AsyncResponseList/AsyncResponseList.php new file mode 100644 index 00000000..8c6006bd --- /dev/null +++ b/src/Resources/AsyncResponseList/AsyncResponseList.php @@ -0,0 +1,66 @@ + $list + */ + public ?array $list; + + /** + * @var array $knownFields + */ + protected static array $knownFields = [ "list" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?array $list, + ) + { + $this->list = $list; + } + + public static function from(array $resourceAttributes): self + { + $list = array_map(fn (array $result): \Chargebee\Resources\AsyncResponse\AsyncResponse => \Chargebee\Resources\AsyncResponse\AsyncResponse::from( + $result + ), $resourceAttributes['list'] ?? []); + + $returnData = new self( $list, + + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter([ + + ], function ($value) { + return $value !== null; + }); + + + + if($this->list !== []){ + $data['list'] = array_map( + fn (\Chargebee\Resources\AsyncResponse\AsyncResponse $list): array => $list->toArray(), + $this->list + ); + } + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/AsyncResponseList/Enums/AsyncResponseStatus.php b/src/Resources/AsyncResponseList/Enums/AsyncResponseStatus.php new file mode 100644 index 00000000..ebedefd3 --- /dev/null +++ b/src/Resources/AsyncResponseList/Enums/AsyncResponseStatus.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/src/Resources/ColumnDefinition/ColumnDefinition.php b/src/Resources/ColumnDefinition/ColumnDefinition.php new file mode 100644 index 00000000..7aa90d83 --- /dev/null +++ b/src/Resources/ColumnDefinition/ColumnDefinition.php @@ -0,0 +1,68 @@ + $knownFields + */ + protected static array $knownFields = [ "column_name" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?string $column_name, + ?\Chargebee\Resources\ColumnDefinition\Enums\DataType $data_type, + ) + { + $this->column_name = $column_name; + $this->data_type = $data_type; + } + + public static function from(array $resourceAttributes): self + { + $returnData = new self( $resourceAttributes['column_name'] ?? null, + + + isset($resourceAttributes['data_type']) ? \Chargebee\Resources\ColumnDefinition\Enums\DataType::tryFromValue($resourceAttributes['data_type']) : null, + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter(['column_name' => $this->column_name, + + 'data_type' => $this->data_type?->value, + + ], function ($value) { + return $value !== null; + }); + + + + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/ColumnDefinition/Enums/DataType.php b/src/Resources/ColumnDefinition/Enums/DataType.php new file mode 100644 index 00000000..3f7135fc --- /dev/null +++ b/src/Resources/ColumnDefinition/Enums/DataType.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/src/Resources/Content/Content.php b/src/Resources/Content/Content.php index a365acbf..20e51457 100644 --- a/src/Resources/Content/Content.php +++ b/src/Resources/Content/Content.php @@ -6,6 +6,8 @@ use Chargebee\Resources\AdvanceInvoiceSchedule\AdvanceInvoiceSchedule; use Chargebee\Resources\Alert\Alert; use Chargebee\Resources\AlertStatus\AlertStatus; +use Chargebee\Resources\AsyncResponse\AsyncResponse; +use Chargebee\Resources\AsyncResponseList\AsyncResponseList; use Chargebee\Resources\AttachedItem\AttachedItem; use Chargebee\Resources\Attribute\Attribute; use Chargebee\Resources\BillingConfiguration\BillingConfiguration; @@ -13,6 +15,7 @@ use Chargebee\Resources\BusinessEntity\BusinessEntity; use Chargebee\Resources\BusinessEntityTransfer\BusinessEntityTransfer; use Chargebee\Resources\Card\Card; +use Chargebee\Resources\ColumnDefinition\ColumnDefinition; use Chargebee\Resources\Comment\Comment; use Chargebee\Resources\Configuration\Configuration; use Chargebee\Resources\Contact\Contact; @@ -56,6 +59,8 @@ use Chargebee\Resources\LedgerAccountBalance\LedgerAccountBalance; use Chargebee\Resources\LedgerOperation\LedgerOperation; use Chargebee\Resources\Metadata\Metadata; +use Chargebee\Resources\Meter\Meter; +use Chargebee\Resources\MeteredFeature\MeteredFeature; use Chargebee\Resources\NonSubscription\NonSubscription; use Chargebee\Resources\OfferEvent\OfferEvent; use Chargebee\Resources\OfferFulfillment\OfferFulfillment; @@ -143,6 +148,18 @@ class Content { */ public ?AlertStatus $alertstatus; + /** + * + * @var ?AsyncResponse $asyncresponse + */ + public ?AsyncResponse $asyncresponse; + + /** + * + * @var ?AsyncResponseList $asyncresponselist + */ + public ?AsyncResponseList $asyncresponselist; + /** * * @var ?AttachedItem $attacheditem @@ -185,6 +202,12 @@ class Content { */ public ?Card $card; + /** + * + * @var ?ColumnDefinition $columndefinition + */ + public ?ColumnDefinition $columndefinition; + /** * * @var ?Comment $comment @@ -443,6 +466,18 @@ class Content { */ public ?Metadata $metadata; + /** + * + * @var ?Meter $meter + */ + public ?Meter $meter; + + /** + * + * @var ?MeteredFeature $meteredfeature + */ + public ?MeteredFeature $meteredfeature; + /** * * @var ?NonSubscription $nonsubscription @@ -776,7 +811,7 @@ class Content { /** * @var array $knownFields */ - protected static array $knownFields = [ "addon" , "address" , "advance_invoice_schedule" , "alert" , "alert_status" , "attached_item" , "attribute" , "billing_configuration" , "brand" , "business_entity" , "business_entity_transfer" , "card" , "comment" , "configuration" , "contact" , "contract_term" , "coupon" , "coupon_code" , "coupon_set" , "cpq_quote_signature" , "credit_note" , "credit_note_estimate" , "currency" , "customer" , "customer_entitlement" , "differential_price" , "discount" , "download" , "einvoice" , "entitlement" , "entitlement_override" , "estimate" , "event" , "export" , "feature" , "filter_condition" , "gateway_error_detail" , "gift" , "grant_block" , "hierarchy" , "hosted_page" , "impacted_customer" , "impacted_item" , "impacted_item_price" , "impacted_subscription" , "in_app_subscription" , "invoice" , "invoice_estimate" , "item" , "item_entitlement" , "item_family" , "item_price" , "ledger_account_balance" , "ledger_operation" , "metadata" , "non_subscription" , "offer_event" , "offer_fulfillment" , "omnichannel_one_time_order" , "omnichannel_one_time_order_item" , "omnichannel_subscription" , "omnichannel_subscription_item" , "omnichannel_subscription_item_offer" , "omnichannel_subscription_item_scheduled_change" , "omnichannel_transaction" , "order" , "payment_intent" , "payment_reference_number" , "payment_schedule" , "payment_schedule_estimate" , "payment_schedule_scheme" , "payment_source" , "payment_voucher" , "personalized_offer" , "plan" , "portal_session" , "price_variant" , "pricing_page_session" , "promotional_credit" , "promotional_grant" , "purchase" , "quote" , "quote_line_group" , "quoted_charge" , "quoted_delta_ramp" , "quoted_ramp" , "quoted_subscription" , "ramp" , "recorded_purchase" , "resource_migration" , "rule" , "site_migration_detail" , "subscription" , "subscription_entitlement" , "subscription_entitlements_created_detail" , "subscription_entitlements_updated_detail" , "subscription_estimate" , "tax_withheld" , "third_party_payment_method" , "time_machine" , "token" , "transaction" , "unbilled_charge" , "usage" , "usage_charge" , "usage_event" , "usage_file" , "usage_summary" , "virtual_bank_account" , "webhook_endpoint" ]; + protected static array $knownFields = [ "addon" , "address" , "advance_invoice_schedule" , "alert" , "alert_status" , "async_response" , "async_response_list" , "attached_item" , "attribute" , "billing_configuration" , "brand" , "business_entity" , "business_entity_transfer" , "card" , "column_definition" , "comment" , "configuration" , "contact" , "contract_term" , "coupon" , "coupon_code" , "coupon_set" , "cpq_quote_signature" , "credit_note" , "credit_note_estimate" , "currency" , "customer" , "customer_entitlement" , "differential_price" , "discount" , "download" , "einvoice" , "entitlement" , "entitlement_override" , "estimate" , "event" , "export" , "feature" , "filter_condition" , "gateway_error_detail" , "gift" , "grant_block" , "hierarchy" , "hosted_page" , "impacted_customer" , "impacted_item" , "impacted_item_price" , "impacted_subscription" , "in_app_subscription" , "invoice" , "invoice_estimate" , "item" , "item_entitlement" , "item_family" , "item_price" , "ledger_account_balance" , "ledger_operation" , "metadata" , "meter" , "metered_feature" , "non_subscription" , "offer_event" , "offer_fulfillment" , "omnichannel_one_time_order" , "omnichannel_one_time_order_item" , "omnichannel_subscription" , "omnichannel_subscription_item" , "omnichannel_subscription_item_offer" , "omnichannel_subscription_item_scheduled_change" , "omnichannel_transaction" , "order" , "payment_intent" , "payment_reference_number" , "payment_schedule" , "payment_schedule_estimate" , "payment_schedule_scheme" , "payment_source" , "payment_voucher" , "personalized_offer" , "plan" , "portal_session" , "price_variant" , "pricing_page_session" , "promotional_credit" , "promotional_grant" , "purchase" , "quote" , "quote_line_group" , "quoted_charge" , "quoted_delta_ramp" , "quoted_ramp" , "quoted_subscription" , "ramp" , "recorded_purchase" , "resource_migration" , "rule" , "site_migration_detail" , "subscription" , "subscription_entitlement" , "subscription_entitlements_created_detail" , "subscription_entitlements_updated_detail" , "subscription_estimate" , "tax_withheld" , "third_party_payment_method" , "time_machine" , "token" , "transaction" , "unbilled_charge" , "usage" , "usage_charge" , "usage_event" , "usage_file" , "usage_summary" , "virtual_bank_account" , "webhook_endpoint" ]; /** * dynamic properties for resources @@ -790,6 +825,8 @@ private function __construct( ?AdvanceInvoiceSchedule $advanceinvoiceschedule, ?Alert $alert, ?AlertStatus $alertstatus, + ?AsyncResponse $asyncresponse, + ?AsyncResponseList $asyncresponselist, ?AttachedItem $attacheditem, ?Attribute $attribute, ?BillingConfiguration $billingconfiguration, @@ -797,6 +834,7 @@ private function __construct( ?BusinessEntity $businessentity, ?BusinessEntityTransfer $businessentitytransfer, ?Card $card, + ?ColumnDefinition $columndefinition, ?Comment $comment, ?Configuration $configuration, ?Contact $contact, @@ -840,6 +878,8 @@ private function __construct( ?LedgerAccountBalance $ledgeraccountbalance, ?LedgerOperation $ledgeroperation, ?Metadata $metadata, + ?Meter $meter, + ?MeteredFeature $meteredfeature, ?NonSubscription $nonsubscription, ?OfferEvent $offerevent, ?OfferFulfillment $offerfulfillment, @@ -902,6 +942,8 @@ private function __construct( $this->advanceinvoiceschedule = $advanceinvoiceschedule; $this->alert = $alert; $this->alertstatus = $alertstatus; + $this->asyncresponse = $asyncresponse; + $this->asyncresponselist = $asyncresponselist; $this->attacheditem = $attacheditem; $this->attribute = $attribute; $this->billingconfiguration = $billingconfiguration; @@ -909,6 +951,7 @@ private function __construct( $this->businessentity = $businessentity; $this->businessentitytransfer = $businessentitytransfer; $this->card = $card; + $this->columndefinition = $columndefinition; $this->comment = $comment; $this->configuration = $configuration; $this->contact = $contact; @@ -952,6 +995,8 @@ private function __construct( $this->ledgeraccountbalance = $ledgeraccountbalance; $this->ledgeroperation = $ledgeroperation; $this->metadata = $metadata; + $this->meter = $meter; + $this->meteredfeature = $meteredfeature; $this->nonsubscription = $nonsubscription; $this->offerevent = $offerevent; $this->offerfulfillment = $offerfulfillment; @@ -1016,6 +1061,8 @@ public static function from(array $resourceAttributes): self isset($resourceAttributes['advance_invoice_schedule']) ? AdvanceInvoiceSchedule::from($resourceAttributes['advance_invoice_schedule']) : null, isset($resourceAttributes['alert']) ? Alert::from($resourceAttributes['alert']) : null, isset($resourceAttributes['alert_status']) ? AlertStatus::from($resourceAttributes['alert_status']) : null, + isset($resourceAttributes['async_response']) ? AsyncResponse::from($resourceAttributes['async_response']) : null, + isset($resourceAttributes['async_response_list']) ? AsyncResponseList::from($resourceAttributes['async_response_list']) : null, isset($resourceAttributes['attached_item']) ? AttachedItem::from($resourceAttributes['attached_item']) : null, isset($resourceAttributes['attribute']) ? Attribute::from($resourceAttributes['attribute']) : null, isset($resourceAttributes['billing_configuration']) ? BillingConfiguration::from($resourceAttributes['billing_configuration']) : null, @@ -1023,6 +1070,7 @@ public static function from(array $resourceAttributes): self isset($resourceAttributes['business_entity']) ? BusinessEntity::from($resourceAttributes['business_entity']) : null, isset($resourceAttributes['business_entity_transfer']) ? BusinessEntityTransfer::from($resourceAttributes['business_entity_transfer']) : null, isset($resourceAttributes['card']) ? Card::from($resourceAttributes['card']) : null, + isset($resourceAttributes['column_definition']) ? ColumnDefinition::from($resourceAttributes['column_definition']) : null, isset($resourceAttributes['comment']) ? Comment::from($resourceAttributes['comment']) : null, isset($resourceAttributes['configuration']) ? Configuration::from($resourceAttributes['configuration']) : null, isset($resourceAttributes['contact']) ? Contact::from($resourceAttributes['contact']) : null, @@ -1066,6 +1114,8 @@ public static function from(array $resourceAttributes): self isset($resourceAttributes['ledger_account_balance']) ? LedgerAccountBalance::from($resourceAttributes['ledger_account_balance']) : null, isset($resourceAttributes['ledger_operation']) ? LedgerOperation::from($resourceAttributes['ledger_operation']) : null, isset($resourceAttributes['metadata']) ? Metadata::from($resourceAttributes['metadata']) : null, + isset($resourceAttributes['meter']) ? Meter::from($resourceAttributes['meter']) : null, + isset($resourceAttributes['metered_feature']) ? MeteredFeature::from($resourceAttributes['metered_feature']) : null, isset($resourceAttributes['non_subscription']) ? NonSubscription::from($resourceAttributes['non_subscription']) : null, isset($resourceAttributes['offer_event']) ? OfferEvent::from($resourceAttributes['offer_event']) : null, isset($resourceAttributes['offer_fulfillment']) ? OfferFulfillment::from($resourceAttributes['offer_fulfillment']) : null, @@ -1236,6 +1286,11 @@ public function toArray(): array + + + + + @@ -1262,6 +1317,12 @@ public function toArray(): array if($this->alertstatus instanceof AlertStatus){ $data['alert_status'] = $this->alertstatus->toArray(); } + if($this->asyncresponse instanceof AsyncResponse){ + $data['async_response'] = $this->asyncresponse->toArray(); + } + if($this->asyncresponselist instanceof AsyncResponseList){ + $data['async_response_list'] = $this->asyncresponselist->toArray(); + } if($this->attacheditem instanceof AttachedItem){ $data['attached_item'] = $this->attacheditem->toArray(); } @@ -1283,6 +1344,9 @@ public function toArray(): array if($this->card instanceof Card){ $data['card'] = $this->card->toArray(); } + if($this->columndefinition instanceof ColumnDefinition){ + $data['column_definition'] = $this->columndefinition->toArray(); + } if($this->comment instanceof Comment){ $data['comment'] = $this->comment->toArray(); } @@ -1412,6 +1476,12 @@ public function toArray(): array if($this->metadata instanceof Metadata){ $data['metadata'] = $this->metadata->toArray(); } + if($this->meter instanceof Meter){ + $data['meter'] = $this->meter->toArray(); + } + if($this->meteredfeature instanceof MeteredFeature){ + $data['metered_feature'] = $this->meteredfeature->toArray(); + } if($this->nonsubscription instanceof NonSubscription){ $data['non_subscription'] = $this->nonsubscription->toArray(); } diff --git a/src/Resources/CreditNote/CreditNote.php b/src/Resources/CreditNote/CreditNote.php index 0f6545e6..e38b5cd2 100644 --- a/src/Resources/CreditNote/CreditNote.php +++ b/src/Resources/CreditNote/CreditNote.php @@ -226,6 +226,12 @@ class CreditNote extends SupportsCustomFields { */ public ?float $local_currency_exchange_rate; + /** + * + * @var ?array $exchange_rates + */ + public ?array $exchange_rates; + /** * * @var ?string $create_reason_code @@ -301,7 +307,7 @@ class CreditNote extends SupportsCustomFields { /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "customer_id" , "subscription_id" , "reference_invoice_id" , "vat_number" , "date" , "currency_code" , "total" , "amount_allocated" , "amount_refunded" , "amount_available" , "refunded_at" , "voided_at" , "generated_at" , "resource_version" , "updated_at" , "line_items_next_offset" , "sub_total" , "sub_total_in_local_currency" , "total_in_local_currency" , "local_currency_code" , "round_off_amount" , "fractional_correction" , "notes" , "line_items" , "line_item_tiers" , "line_item_discounts" , "line_item_taxes" , "line_item_addresses" , "discounts" , "taxes" , "tax_origin" , "linked_refunds" , "allocations" , "deleted" , "tax_category" , "local_currency_exchange_rate" , "create_reason_code" , "vat_number_prefix" , "business_entity_id" , "shipping_address" , "billing_address" , "einvoice" , "site_details_at_creation" ]; + protected static array $knownFields = [ "id" , "customer_id" , "subscription_id" , "reference_invoice_id" , "vat_number" , "date" , "currency_code" , "total" , "amount_allocated" , "amount_refunded" , "amount_available" , "refunded_at" , "voided_at" , "generated_at" , "resource_version" , "updated_at" , "line_items_next_offset" , "sub_total" , "sub_total_in_local_currency" , "total_in_local_currency" , "local_currency_code" , "round_off_amount" , "fractional_correction" , "notes" , "line_items" , "line_item_tiers" , "line_item_discounts" , "line_item_taxes" , "line_item_addresses" , "discounts" , "taxes" , "tax_origin" , "linked_refunds" , "allocations" , "deleted" , "tax_category" , "local_currency_exchange_rate" , "exchange_rates" , "create_reason_code" , "vat_number_prefix" , "business_entity_id" , "shipping_address" , "billing_address" , "einvoice" , "site_details_at_creation" ]; /** * dynamic properties for resources @@ -347,6 +353,7 @@ private function __construct( ?bool $deleted, ?string $tax_category, ?float $local_currency_exchange_rate, + ?array $exchange_rates, ?string $create_reason_code, ?string $vat_number_prefix, ?string $business_entity_id, @@ -398,6 +405,7 @@ private function __construct( $this->deleted = $deleted; $this->tax_category = $tax_category; $this->local_currency_exchange_rate = $local_currency_exchange_rate; + $this->exchange_rates = $exchange_rates; $this->create_reason_code = $create_reason_code; $this->vat_number_prefix = $vat_number_prefix; $this->business_entity_id = $business_entity_id; @@ -450,6 +458,10 @@ public static function from(array $resourceAttributes): self $result ), $resourceAttributes['allocations'] ?? []); + $exchange_rates = array_map(fn (array $result): ExchangeRate => ExchangeRate::from( + $result + ), $resourceAttributes['exchange_rates'] ?? []); + $returnData = new self( $resourceAttributes['id'] ?? null, $resourceAttributes['customer_id'] ?? null, $resourceAttributes['subscription_id'] ?? null, @@ -487,6 +499,7 @@ public static function from(array $resourceAttributes): self $resourceAttributes['deleted'] ?? null, $resourceAttributes['tax_category'] ?? null, $resourceAttributes['local_currency_exchange_rate'] ?? null, + $exchange_rates, $resourceAttributes['create_reason_code'] ?? null, $resourceAttributes['vat_number_prefix'] ?? null, $resourceAttributes['business_entity_id'] ?? null, @@ -555,6 +568,7 @@ public function toArray(): array 'deleted' => $this->deleted, 'tax_category' => $this->tax_category, 'local_currency_exchange_rate' => $this->local_currency_exchange_rate, + 'create_reason_code' => $this->create_reason_code, 'vat_number_prefix' => $this->vat_number_prefix, 'business_entity_id' => $this->business_entity_id, @@ -648,6 +662,12 @@ public function toArray(): array $this->allocations ); } + if($this->exchange_rates !== []){ + $data['exchange_rates'] = array_map( + fn (ExchangeRate $exchange_rates): array => $exchange_rates->toArray(), + $this->exchange_rates + ); + } foreach($this->_data as $keys => $value){ if (!in_array($keys, $this::$knownFields)) { diff --git a/src/Resources/CreditNote/Enums/LineItemProrationMode.php b/src/Resources/CreditNote/Enums/LineItemProrationMode.php new file mode 100644 index 00000000..bf17e781 --- /dev/null +++ b/src/Resources/CreditNote/Enums/LineItemProrationMode.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/src/Resources/CreditNote/ExchangeRate.php b/src/Resources/CreditNote/ExchangeRate.php new file mode 100644 index 00000000..a3b51808 --- /dev/null +++ b/src/Resources/CreditNote/ExchangeRate.php @@ -0,0 +1,66 @@ + $knownFields + */ + protected static array $knownFields = [ "currency_code" , "rate" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?string $currency_code, + ?float $rate, + ) + { + $this->currency_code = $currency_code; + $this->rate = $rate; + } + + public static function from(array $resourceAttributes): self + { + $returnData = new self( $resourceAttributes['currency_code'] ?? null, + $resourceAttributes['rate'] ?? null, + + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter(['currency_code' => $this->currency_code, + 'rate' => $this->rate, + + ], function ($value) { + return $value !== null; + }); + + + + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/CreditNote/LineItem.php b/src/Resources/CreditNote/LineItem.php index 8c5819ad..32cd714c 100644 --- a/src/Resources/CreditNote/LineItem.php +++ b/src/Resources/CreditNote/LineItem.php @@ -153,10 +153,16 @@ class LineItem { */ public ?string $customer_id; + /** + * + * @var ?string $proration_mode + */ + public ?string $proration_mode; + /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" ]; + protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" , "proration_mode" ]; /** * dynamic properties for resources @@ -190,6 +196,7 @@ private function __construct( ?string $tax_exempt_reason, ?string $entity_id, ?string $customer_id, + ?string $proration_mode, ) { $this->id = $id; @@ -216,7 +223,8 @@ private function __construct( $this->entity_type = $entity_type; $this->tax_exempt_reason = $tax_exempt_reason; $this->entity_id = $entity_id; - $this->customer_id = $customer_id; + $this->customer_id = $customer_id; + $this->proration_mode = $proration_mode; } public static function from(array $resourceAttributes): self @@ -246,6 +254,7 @@ public static function from(array $resourceAttributes): self $resourceAttributes['tax_exempt_reason'] ?? null, $resourceAttributes['entity_id'] ?? null, $resourceAttributes['customer_id'] ?? null, + $resourceAttributes['proration_mode'] ?? null, ); @@ -281,6 +290,7 @@ public function toArray(): array 'tax_exempt_reason' => $this->tax_exempt_reason, 'entity_id' => $this->entity_id, 'customer_id' => $this->customer_id, + 'proration_mode' => $this->proration_mode, ], function ($value) { return $value !== null; diff --git a/src/Resources/CreditNoteEstimate/Enums/LineItemProrationMode.php b/src/Resources/CreditNoteEstimate/Enums/LineItemProrationMode.php new file mode 100644 index 00000000..7fdb49b8 --- /dev/null +++ b/src/Resources/CreditNoteEstimate/Enums/LineItemProrationMode.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/src/Resources/CreditNoteEstimate/LineItem.php b/src/Resources/CreditNoteEstimate/LineItem.php index cb23f483..42b1dc80 100644 --- a/src/Resources/CreditNoteEstimate/LineItem.php +++ b/src/Resources/CreditNoteEstimate/LineItem.php @@ -153,10 +153,16 @@ class LineItem { */ public ?string $customer_id; + /** + * + * @var ?string $proration_mode + */ + public ?string $proration_mode; + /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" ]; + protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" , "proration_mode" ]; /** * dynamic properties for resources @@ -190,6 +196,7 @@ private function __construct( ?string $tax_exempt_reason, ?string $entity_id, ?string $customer_id, + ?string $proration_mode, ) { $this->id = $id; @@ -216,7 +223,8 @@ private function __construct( $this->entity_type = $entity_type; $this->tax_exempt_reason = $tax_exempt_reason; $this->entity_id = $entity_id; - $this->customer_id = $customer_id; + $this->customer_id = $customer_id; + $this->proration_mode = $proration_mode; } public static function from(array $resourceAttributes): self @@ -246,6 +254,7 @@ public static function from(array $resourceAttributes): self $resourceAttributes['tax_exempt_reason'] ?? null, $resourceAttributes['entity_id'] ?? null, $resourceAttributes['customer_id'] ?? null, + $resourceAttributes['proration_mode'] ?? null, ); @@ -281,6 +290,7 @@ public function toArray(): array 'tax_exempt_reason' => $this->tax_exempt_reason, 'entity_id' => $this->entity_id, 'customer_id' => $this->customer_id, + 'proration_mode' => $this->proration_mode, ], function ($value) { return $value !== null; diff --git a/src/Resources/Feature/Feature.php b/src/Resources/Feature/Feature.php index 179fbbd7..8fc80101 100644 --- a/src/Resources/Feature/Feature.php +++ b/src/Resources/Feature/Feature.php @@ -46,6 +46,12 @@ class Feature extends SupportsCustomFields { */ public ?int $created_at; + /** + * + * @var ?bool $metered + */ + public ?bool $metered; + /** * * @var ?array $levels @@ -67,7 +73,7 @@ class Feature extends SupportsCustomFields { /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "name" , "description" , "unit" , "resource_version" , "updated_at" , "created_at" , "levels" ]; + protected static array $knownFields = [ "id" , "name" , "description" , "unit" , "resource_version" , "updated_at" , "created_at" , "metered" , "levels" ]; /** * dynamic properties for resources @@ -83,6 +89,7 @@ private function __construct( ?int $resource_version, ?int $updated_at, ?int $created_at, + ?bool $metered, ?array $levels, ?\Chargebee\Resources\Feature\Enums\Status $status, ?\Chargebee\Resources\Feature\Enums\Type $type, @@ -95,6 +102,7 @@ private function __construct( $this->resource_version = $resource_version; $this->updated_at = $updated_at; $this->created_at = $created_at; + $this->metered = $metered; $this->levels = $levels; $this->status = $status; $this->type = $type; @@ -113,6 +121,7 @@ public static function from(array $resourceAttributes): self $resourceAttributes['resource_version'] ?? null, $resourceAttributes['updated_at'] ?? null, $resourceAttributes['created_at'] ?? null, + $resourceAttributes['metered'] ?? null, $levels, @@ -139,6 +148,7 @@ public function toArray(): array 'resource_version' => $this->resource_version, 'updated_at' => $this->updated_at, 'created_at' => $this->created_at, + 'metered' => $this->metered, 'status' => $this->status?->value, diff --git a/src/Resources/GrantBlock/GrantBlock.php b/src/Resources/GrantBlock/GrantBlock.php index 9fb5942a..e1bd8a4a 100644 --- a/src/Resources/GrantBlock/GrantBlock.php +++ b/src/Resources/GrantBlock/GrantBlock.php @@ -69,12 +69,6 @@ class GrantBlock { */ public ?string $origin_grant_block_id; - /** - * - * @var ?string $metadata - */ - public ?string $metadata; - /** * * @var ?int $created_at @@ -87,6 +81,12 @@ class GrantBlock { */ public ?string $unit_id; + /** + * + * @var mixed $metadata + */ + public mixed $metadata; + /** * * @var ?\Chargebee\Enums\Status $status @@ -114,7 +114,7 @@ class GrantBlock { /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "granted_amount" , "effective_from" , "expires_at" , "balance" , "hold_amount" , "used_amount" , "expired_amount" , "rolled_over_amount" , "voided_amount" , "origin_grant_block_id" , "metadata" , "created_at" , "unit_id" ]; + protected static array $knownFields = [ "id" , "granted_amount" , "effective_from" , "expires_at" , "balance" , "hold_amount" , "used_amount" , "expired_amount" , "rolled_over_amount" , "voided_amount" , "origin_grant_block_id" , "created_at" , "unit_id" , "metadata" ]; /** * dynamic properties for resources @@ -134,9 +134,9 @@ private function __construct( ?string $rolled_over_amount, ?string $voided_amount, ?string $origin_grant_block_id, - ?string $metadata, ?int $created_at, ?string $unit_id, + mixed $metadata, ?\Chargebee\Enums\Status $status, ?\Chargebee\Resources\GrantBlock\Enums\GrantSource $grant_source, ?\Chargebee\Resources\GrantBlock\Enums\AccountType $account_type, @@ -154,9 +154,9 @@ private function __construct( $this->rolled_over_amount = $rolled_over_amount; $this->voided_amount = $voided_amount; $this->origin_grant_block_id = $origin_grant_block_id; - $this->metadata = $metadata; $this->created_at = $created_at; - $this->unit_id = $unit_id; + $this->unit_id = $unit_id; + $this->metadata = $metadata; $this->status = $status; $this->grant_source = $grant_source; $this->account_type = $account_type; @@ -176,9 +176,9 @@ public static function from(array $resourceAttributes): self $resourceAttributes['rolled_over_amount'] ?? null, $resourceAttributes['voided_amount'] ?? null, $resourceAttributes['origin_grant_block_id'] ?? null, - $resourceAttributes['metadata'] ?? null, $resourceAttributes['created_at'] ?? null, $resourceAttributes['unit_id'] ?? null, + $resourceAttributes['metadata'] ?? null, isset($resourceAttributes['status']) ? \Chargebee\Enums\Status::tryFromValue($resourceAttributes['status']) : null, @@ -208,9 +208,9 @@ public function toArray(): array 'rolled_over_amount' => $this->rolled_over_amount, 'voided_amount' => $this->voided_amount, 'origin_grant_block_id' => $this->origin_grant_block_id, - 'metadata' => $this->metadata, 'created_at' => $this->created_at, 'unit_id' => $this->unit_id, + 'metadata' => $this->metadata, 'status' => $this->status?->value, diff --git a/src/Resources/Invoice/Enums/LineItemProrationMode.php b/src/Resources/Invoice/Enums/LineItemProrationMode.php new file mode 100644 index 00000000..a0ec6490 --- /dev/null +++ b/src/Resources/Invoice/Enums/LineItemProrationMode.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/src/Resources/Invoice/ExchangeRate.php b/src/Resources/Invoice/ExchangeRate.php new file mode 100644 index 00000000..5aab819c --- /dev/null +++ b/src/Resources/Invoice/ExchangeRate.php @@ -0,0 +1,66 @@ + $knownFields + */ + protected static array $knownFields = [ "currency_code" , "rate" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?string $currency_code, + ?float $rate, + ) + { + $this->currency_code = $currency_code; + $this->rate = $rate; + } + + public static function from(array $resourceAttributes): self + { + $returnData = new self( $resourceAttributes['currency_code'] ?? null, + $resourceAttributes['rate'] ?? null, + + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter(['currency_code' => $this->currency_code, + 'rate' => $this->rate, + + ], function ($value) { + return $value !== null; + }); + + + + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/Invoice/Invoice.php b/src/Resources/Invoice/Invoice.php index f4253db7..debe9300 100644 --- a/src/Resources/Invoice/Invoice.php +++ b/src/Resources/Invoice/Invoice.php @@ -184,6 +184,12 @@ class Invoice extends SupportsCustomFields { */ public ?string $line_items_next_offset; + /** + * + * @var ?array $exchange_rates + */ + public ?array $exchange_rates; + /** * * @var ?bool $first_invoice @@ -427,7 +433,7 @@ class Invoice extends SupportsCustomFields { /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "customer_id" , "payment_owner" , "subscription_id" , "recurring" , "date" , "due_date" , "net_term_days" , "po_number" , "vat_number" , "exchange_rate" , "local_currency_exchange_rate" , "currency_code" , "local_currency_code" , "tax" , "sub_total" , "sub_total_in_local_currency" , "total" , "total_in_local_currency" , "amount_due" , "amount_adjusted" , "amount_paid" , "paid_at" , "write_off_amount" , "credits_applied" , "next_retry_at" , "voided_at" , "resource_version" , "updated_at" , "line_items_next_offset" , "first_invoice" , "new_sales_amount" , "has_advance_charges" , "term_finalized" , "is_gifted" , "generated_at" , "expected_payment_date" , "amount_to_collect" , "round_off_amount" , "line_items" , "line_item_tiers" , "line_item_discounts" , "line_item_taxes" , "line_item_credits" , "line_item_addresses" , "discounts" , "taxes" , "tax_origin" , "linked_payments" , "reference_transactions" , "dunning_attempts" , "applied_credits" , "adjustment_credit_notes" , "issued_credit_notes" , "linked_orders" , "notes" , "shipping_address" , "billing_address" , "statement_descriptor" , "einvoice" , "void_reason_code" , "deleted" , "tax_category" , "vat_number_prefix" , "business_entity_id" , "site_details_at_creation" ]; + protected static array $knownFields = [ "id" , "customer_id" , "payment_owner" , "subscription_id" , "recurring" , "date" , "due_date" , "net_term_days" , "po_number" , "vat_number" , "exchange_rate" , "local_currency_exchange_rate" , "currency_code" , "local_currency_code" , "tax" , "sub_total" , "sub_total_in_local_currency" , "total" , "total_in_local_currency" , "amount_due" , "amount_adjusted" , "amount_paid" , "paid_at" , "write_off_amount" , "credits_applied" , "next_retry_at" , "voided_at" , "resource_version" , "updated_at" , "line_items_next_offset" , "exchange_rates" , "first_invoice" , "new_sales_amount" , "has_advance_charges" , "term_finalized" , "is_gifted" , "generated_at" , "expected_payment_date" , "amount_to_collect" , "round_off_amount" , "line_items" , "line_item_tiers" , "line_item_discounts" , "line_item_taxes" , "line_item_credits" , "line_item_addresses" , "discounts" , "taxes" , "tax_origin" , "linked_payments" , "reference_transactions" , "dunning_attempts" , "applied_credits" , "adjustment_credit_notes" , "issued_credit_notes" , "linked_orders" , "notes" , "shipping_address" , "billing_address" , "statement_descriptor" , "einvoice" , "void_reason_code" , "deleted" , "tax_category" , "vat_number_prefix" , "business_entity_id" , "site_details_at_creation" ]; /** * dynamic properties for resources @@ -466,6 +472,7 @@ private function __construct( ?int $resource_version, ?int $updated_at, ?string $line_items_next_offset, + ?array $exchange_rates, ?bool $first_invoice, ?int $new_sales_amount, ?bool $has_advance_charges, @@ -538,6 +545,7 @@ private function __construct( $this->resource_version = $resource_version; $this->updated_at = $updated_at; $this->line_items_next_offset = $line_items_next_offset; + $this->exchange_rates = $exchange_rates; $this->first_invoice = $first_invoice; $this->new_sales_amount = $new_sales_amount; $this->has_advance_charges = $has_advance_charges; @@ -582,6 +590,10 @@ private function __construct( public static function from(array $resourceAttributes): self { + $exchange_rates = array_map(fn (array $result): ExchangeRate => ExchangeRate::from( + $result + ), $resourceAttributes['exchange_rates'] ?? []); + $line_items = array_map(fn (array $result): LineItem => LineItem::from( $result ), $resourceAttributes['line_items'] ?? []); @@ -676,6 +688,7 @@ public static function from(array $resourceAttributes): self $resourceAttributes['resource_version'] ?? null, $resourceAttributes['updated_at'] ?? null, $resourceAttributes['line_items_next_offset'] ?? null, + $exchange_rates, $resourceAttributes['first_invoice'] ?? null, $resourceAttributes['new_sales_amount'] ?? null, $resourceAttributes['has_advance_charges'] ?? null, @@ -764,6 +777,7 @@ public function toArray(): array 'resource_version' => $this->resource_version, 'updated_at' => $this->updated_at, 'line_items_next_offset' => $this->line_items_next_offset, + 'first_invoice' => $this->first_invoice, 'new_sales_amount' => $this->new_sales_amount, 'has_advance_charges' => $this->has_advance_charges, @@ -833,6 +847,12 @@ public function toArray(): array $data['site_details_at_creation'] = $this->site_details_at_creation->toArray(); } + if($this->exchange_rates !== []){ + $data['exchange_rates'] = array_map( + fn (ExchangeRate $exchange_rates): array => $exchange_rates->toArray(), + $this->exchange_rates + ); + } if($this->line_items !== []){ $data['line_items'] = array_map( fn (LineItem $line_items): array => $line_items->toArray(), diff --git a/src/Resources/Invoice/LineItem.php b/src/Resources/Invoice/LineItem.php index 80d77d97..45328249 100644 --- a/src/Resources/Invoice/LineItem.php +++ b/src/Resources/Invoice/LineItem.php @@ -153,10 +153,16 @@ class LineItem { */ public ?string $customer_id; + /** + * + * @var ?string $proration_mode + */ + public ?string $proration_mode; + /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" ]; + protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" , "proration_mode" ]; /** * dynamic properties for resources @@ -190,6 +196,7 @@ private function __construct( ?string $tax_exempt_reason, ?string $entity_id, ?string $customer_id, + ?string $proration_mode, ) { $this->id = $id; @@ -216,7 +223,8 @@ private function __construct( $this->entity_type = $entity_type; $this->tax_exempt_reason = $tax_exempt_reason; $this->entity_id = $entity_id; - $this->customer_id = $customer_id; + $this->customer_id = $customer_id; + $this->proration_mode = $proration_mode; } public static function from(array $resourceAttributes): self @@ -246,6 +254,7 @@ public static function from(array $resourceAttributes): self $resourceAttributes['tax_exempt_reason'] ?? null, $resourceAttributes['entity_id'] ?? null, $resourceAttributes['customer_id'] ?? null, + $resourceAttributes['proration_mode'] ?? null, ); @@ -281,6 +290,7 @@ public function toArray(): array 'tax_exempt_reason' => $this->tax_exempt_reason, 'entity_id' => $this->entity_id, 'customer_id' => $this->customer_id, + 'proration_mode' => $this->proration_mode, ], function ($value) { return $value !== null; diff --git a/src/Resources/InvoiceEstimate/Enums/LineItemProrationMode.php b/src/Resources/InvoiceEstimate/Enums/LineItemProrationMode.php new file mode 100644 index 00000000..cd67f7ae --- /dev/null +++ b/src/Resources/InvoiceEstimate/Enums/LineItemProrationMode.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/src/Resources/InvoiceEstimate/LineItem.php b/src/Resources/InvoiceEstimate/LineItem.php index 86f3562b..e44ec27a 100644 --- a/src/Resources/InvoiceEstimate/LineItem.php +++ b/src/Resources/InvoiceEstimate/LineItem.php @@ -153,10 +153,16 @@ class LineItem { */ public ?string $customer_id; + /** + * + * @var ?string $proration_mode + */ + public ?string $proration_mode; + /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" ]; + protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" , "proration_mode" ]; /** * dynamic properties for resources @@ -190,6 +196,7 @@ private function __construct( ?string $tax_exempt_reason, ?string $entity_id, ?string $customer_id, + ?string $proration_mode, ) { $this->id = $id; @@ -216,7 +223,8 @@ private function __construct( $this->entity_type = $entity_type; $this->tax_exempt_reason = $tax_exempt_reason; $this->entity_id = $entity_id; - $this->customer_id = $customer_id; + $this->customer_id = $customer_id; + $this->proration_mode = $proration_mode; } public static function from(array $resourceAttributes): self @@ -246,6 +254,7 @@ public static function from(array $resourceAttributes): self $resourceAttributes['tax_exempt_reason'] ?? null, $resourceAttributes['entity_id'] ?? null, $resourceAttributes['customer_id'] ?? null, + $resourceAttributes['proration_mode'] ?? null, ); @@ -281,6 +290,7 @@ public function toArray(): array 'tax_exempt_reason' => $this->tax_exempt_reason, 'entity_id' => $this->entity_id, 'customer_id' => $this->customer_id, + 'proration_mode' => $this->proration_mode, ], function ($value) { return $value !== null; diff --git a/src/Resources/LedgerOperation/LedgerOperation.php b/src/Resources/LedgerOperation/LedgerOperation.php index 26fcb3b4..fe867dd4 100644 --- a/src/Resources/LedgerOperation/LedgerOperation.php +++ b/src/Resources/LedgerOperation/LedgerOperation.php @@ -15,18 +15,6 @@ class LedgerOperation { */ public ?string $amount; - /** - * - * @var ?string $start_balance - */ - public ?string $start_balance; - - /** - * - * @var ?string $end_balance - */ - public ?string $end_balance; - /** * * @var ?string $provisioned_start_balance @@ -69,12 +57,6 @@ class LedgerOperation { */ public ?int $auto_release_timestamp; - /** - * - * @var ?string $metadata - */ - public ?string $metadata; - /** * * @var ?int $created_at @@ -99,6 +81,12 @@ class LedgerOperation { */ public ?string $unit_id; + /** + * + * @var mixed $metadata + */ + public mixed $metadata; + /** * * @var ?\Chargebee\Resources\LedgerOperation\Enums\Type $type @@ -114,7 +102,7 @@ class LedgerOperation { /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "amount" , "start_balance" , "end_balance" , "provisioned_start_balance" , "provisioned_end_balance" , "overdraft_start_balance" , "overdraft_end_balance" , "parent_ledger_operation_id" , "ledger_operation_timestamp" , "auto_release_timestamp" , "metadata" , "created_at" , "modified_at" , "subscription_id" , "unit_id" ]; + protected static array $knownFields = [ "id" , "amount" , "provisioned_start_balance" , "provisioned_end_balance" , "overdraft_start_balance" , "overdraft_end_balance" , "parent_ledger_operation_id" , "ledger_operation_timestamp" , "auto_release_timestamp" , "created_at" , "modified_at" , "subscription_id" , "unit_id" , "metadata" ]; /** * dynamic properties for resources @@ -125,8 +113,6 @@ class LedgerOperation { private function __construct( ?string $id, ?string $amount, - ?string $start_balance, - ?string $end_balance, ?string $provisioned_start_balance, ?string $provisioned_end_balance, ?string $overdraft_start_balance, @@ -134,19 +120,17 @@ private function __construct( ?string $parent_ledger_operation_id, ?int $ledger_operation_timestamp, ?int $auto_release_timestamp, - ?string $metadata, ?int $created_at, ?int $modified_at, ?string $subscription_id, ?string $unit_id, + mixed $metadata, ?\Chargebee\Resources\LedgerOperation\Enums\Type $type, ?\Chargebee\Resources\LedgerOperation\Enums\UnitType $unit_type, ) { $this->id = $id; $this->amount = $amount; - $this->start_balance = $start_balance; - $this->end_balance = $end_balance; $this->provisioned_start_balance = $provisioned_start_balance; $this->provisioned_end_balance = $provisioned_end_balance; $this->overdraft_start_balance = $overdraft_start_balance; @@ -154,11 +138,11 @@ private function __construct( $this->parent_ledger_operation_id = $parent_ledger_operation_id; $this->ledger_operation_timestamp = $ledger_operation_timestamp; $this->auto_release_timestamp = $auto_release_timestamp; - $this->metadata = $metadata; $this->created_at = $created_at; $this->modified_at = $modified_at; $this->subscription_id = $subscription_id; - $this->unit_id = $unit_id; + $this->unit_id = $unit_id; + $this->metadata = $metadata; $this->type = $type; $this->unit_type = $unit_type; } @@ -167,8 +151,6 @@ public static function from(array $resourceAttributes): self { $returnData = new self( $resourceAttributes['id'] ?? null, $resourceAttributes['amount'] ?? null, - $resourceAttributes['start_balance'] ?? null, - $resourceAttributes['end_balance'] ?? null, $resourceAttributes['provisioned_start_balance'] ?? null, $resourceAttributes['provisioned_end_balance'] ?? null, $resourceAttributes['overdraft_start_balance'] ?? null, @@ -176,11 +158,11 @@ public static function from(array $resourceAttributes): self $resourceAttributes['parent_ledger_operation_id'] ?? null, $resourceAttributes['ledger_operation_timestamp'] ?? null, $resourceAttributes['auto_release_timestamp'] ?? null, - $resourceAttributes['metadata'] ?? null, $resourceAttributes['created_at'] ?? null, $resourceAttributes['modified_at'] ?? null, $resourceAttributes['subscription_id'] ?? null, $resourceAttributes['unit_id'] ?? null, + $resourceAttributes['metadata'] ?? null, isset($resourceAttributes['type']) ? \Chargebee\Resources\LedgerOperation\Enums\Type::tryFromValue($resourceAttributes['type']) : null, @@ -197,8 +179,6 @@ public function toArray(): array $data = array_filter(['id' => $this->id, 'amount' => $this->amount, - 'start_balance' => $this->start_balance, - 'end_balance' => $this->end_balance, 'provisioned_start_balance' => $this->provisioned_start_balance, 'provisioned_end_balance' => $this->provisioned_end_balance, 'overdraft_start_balance' => $this->overdraft_start_balance, @@ -206,11 +186,11 @@ public function toArray(): array 'parent_ledger_operation_id' => $this->parent_ledger_operation_id, 'ledger_operation_timestamp' => $this->ledger_operation_timestamp, 'auto_release_timestamp' => $this->auto_release_timestamp, - 'metadata' => $this->metadata, 'created_at' => $this->created_at, 'modified_at' => $this->modified_at, 'subscription_id' => $this->subscription_id, 'unit_id' => $this->unit_id, + 'metadata' => $this->metadata, 'type' => $this->type?->value, diff --git a/src/Resources/Meter/Enums/ColumnDefinitionDataType.php b/src/Resources/Meter/Enums/ColumnDefinitionDataType.php new file mode 100644 index 00000000..38cc78c0 --- /dev/null +++ b/src/Resources/Meter/Enums/ColumnDefinitionDataType.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/src/Resources/Meter/Enums/FeatureStatus.php b/src/Resources/Meter/Enums/FeatureStatus.php new file mode 100644 index 00000000..d6678b86 --- /dev/null +++ b/src/Resources/Meter/Enums/FeatureStatus.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/src/Resources/Meter/Enums/FeatureType.php b/src/Resources/Meter/Enums/FeatureType.php new file mode 100644 index 00000000..8521323b --- /dev/null +++ b/src/Resources/Meter/Enums/FeatureType.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/src/Resources/Meter/Enums/Status.php b/src/Resources/Meter/Enums/Status.php new file mode 100644 index 00000000..290b8ff5 --- /dev/null +++ b/src/Resources/Meter/Enums/Status.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/src/Resources/Meter/Enums/Type.php b/src/Resources/Meter/Enums/Type.php new file mode 100644 index 00000000..d896dd1f --- /dev/null +++ b/src/Resources/Meter/Enums/Type.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/src/Resources/Meter/Meter.php b/src/Resources/Meter/Meter.php new file mode 100644 index 00000000..64f19ffd --- /dev/null +++ b/src/Resources/Meter/Meter.php @@ -0,0 +1,170 @@ + $column_definitions + */ + public ?array $column_definitions; + + /** + * + * @var ?array<\Chargebee\Resources\Feature\Feature> $features + */ + public ?array $features; + + /** + * + * @var ?\Chargebee\Resources\Meter\Enums\Type $type + */ + public ?\Chargebee\Resources\Meter\Enums\Type $type; + + /** + * + * @var ?\Chargebee\Resources\Meter\Enums\Status $status + */ + public ?\Chargebee\Resources\Meter\Enums\Status $status; + + /** + * @var array $knownFields + */ + protected static array $knownFields = [ "id" , "name" , "description" , "query" , "created_at" , "updated_at" , "column_definitions" , "features" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?string $id, + ?string $name, + ?string $description, + ?string $query, + ?int $created_at, + ?int $updated_at, + ?array $column_definitions, + ?array $features, + ?\Chargebee\Resources\Meter\Enums\Type $type, + ?\Chargebee\Resources\Meter\Enums\Status $status, + ) + { + $this->id = $id; + $this->name = $name; + $this->description = $description; + $this->query = $query; + $this->created_at = $created_at; + $this->updated_at = $updated_at; + $this->column_definitions = $column_definitions; + $this->features = $features; + $this->type = $type; + $this->status = $status; + } + + public static function from(array $resourceAttributes): self + { + $column_definitions = array_map(fn (array $result): \Chargebee\Resources\ColumnDefinition\ColumnDefinition => \Chargebee\Resources\ColumnDefinition\ColumnDefinition::from( + $result + ), $resourceAttributes['column_definitions'] ?? []); + + $features = array_map(fn (array $result): \Chargebee\Resources\Feature\Feature => \Chargebee\Resources\Feature\Feature::from( + $result + ), $resourceAttributes['features'] ?? []); + + $returnData = new self( $resourceAttributes['id'] ?? null, + $resourceAttributes['name'] ?? null, + $resourceAttributes['description'] ?? null, + $resourceAttributes['query'] ?? null, + $resourceAttributes['created_at'] ?? null, + $resourceAttributes['updated_at'] ?? null, + $column_definitions, + $features, + + + isset($resourceAttributes['type']) ? \Chargebee\Resources\Meter\Enums\Type::tryFromValue($resourceAttributes['type']) : null, + + isset($resourceAttributes['status']) ? \Chargebee\Resources\Meter\Enums\Status::tryFromValue($resourceAttributes['status']) : null, + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter(['id' => $this->id, + 'name' => $this->name, + 'description' => $this->description, + 'query' => $this->query, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + + + + 'type' => $this->type?->value, + + 'status' => $this->status?->value, + + ], function ($value) { + return $value !== null; + }); + + + + if($this->column_definitions !== []){ + $data['column_definitions'] = array_map( + fn (\Chargebee\Resources\ColumnDefinition\ColumnDefinition $column_definitions): array => $column_definitions->toArray(), + $this->column_definitions + ); + } + if($this->features !== []){ + $data['features'] = array_map( + fn (\Chargebee\Resources\Feature\Feature $features): array => $features->toArray(), + $this->features + ); + } + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/MeteredFeature/Enums/ColumnDefinitionDataType.php b/src/Resources/MeteredFeature/Enums/ColumnDefinitionDataType.php new file mode 100644 index 00000000..7477e5e3 --- /dev/null +++ b/src/Resources/MeteredFeature/Enums/ColumnDefinitionDataType.php @@ -0,0 +1,14 @@ + \ No newline at end of file diff --git a/src/Resources/MeteredFeature/Enums/FeatureStatus.php b/src/Resources/MeteredFeature/Enums/FeatureStatus.php new file mode 100644 index 00000000..146e7ae2 --- /dev/null +++ b/src/Resources/MeteredFeature/Enums/FeatureStatus.php @@ -0,0 +1,15 @@ + \ No newline at end of file diff --git a/src/Resources/MeteredFeature/Enums/FeatureType.php b/src/Resources/MeteredFeature/Enums/FeatureType.php new file mode 100644 index 00000000..c29ebf4b --- /dev/null +++ b/src/Resources/MeteredFeature/Enums/FeatureType.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/src/Resources/MeteredFeature/MeteredFeature.php b/src/Resources/MeteredFeature/MeteredFeature.php new file mode 100644 index 00000000..56388e55 --- /dev/null +++ b/src/Resources/MeteredFeature/MeteredFeature.php @@ -0,0 +1,150 @@ + $column_definitions + */ + public ?array $column_definitions; + + /** + * + * @var ?array<\Chargebee\Resources\Feature\Feature> $features + */ + public ?array $features; + + /** + * + * @var ?\Chargebee\Enums\Type $type + */ + public ?\Chargebee\Enums\Type $type; + + /** + * + * @var ?\Chargebee\Enums\Status $status + */ + public ?\Chargebee\Enums\Status $status; + + /** + * @var array $knownFields + */ + protected static array $knownFields = [ "id" , "name" , "description" , "query" , "column_definitions" , "features" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?string $id, + ?string $name, + ?string $description, + ?string $query, + ?array $column_definitions, + ?array $features, + ?\Chargebee\Enums\Type $type, + ?\Chargebee\Enums\Status $status, + ) + { + $this->id = $id; + $this->name = $name; + $this->description = $description; + $this->query = $query; + $this->column_definitions = $column_definitions; + $this->features = $features; + $this->type = $type; + $this->status = $status; + } + + public static function from(array $resourceAttributes): self + { + $column_definitions = array_map(fn (array $result): \Chargebee\Resources\ColumnDefinition\ColumnDefinition => \Chargebee\Resources\ColumnDefinition\ColumnDefinition::from( + $result + ), $resourceAttributes['column_definitions'] ?? []); + + $features = array_map(fn (array $result): \Chargebee\Resources\Feature\Feature => \Chargebee\Resources\Feature\Feature::from( + $result + ), $resourceAttributes['features'] ?? []); + + $returnData = new self( $resourceAttributes['id'] ?? null, + $resourceAttributes['name'] ?? null, + $resourceAttributes['description'] ?? null, + $resourceAttributes['query'] ?? null, + $column_definitions, + $features, + + + isset($resourceAttributes['type']) ? \Chargebee\Enums\Type::tryFromValue($resourceAttributes['type']) : null, + + isset($resourceAttributes['status']) ? \Chargebee\Enums\Status::tryFromValue($resourceAttributes['status']) : null, + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter(['id' => $this->id, + 'name' => $this->name, + 'description' => $this->description, + 'query' => $this->query, + + + + 'type' => $this->type?->value, + + 'status' => $this->status?->value, + + ], function ($value) { + return $value !== null; + }); + + + + if($this->column_definitions !== []){ + $data['column_definitions'] = array_map( + fn (\Chargebee\Resources\ColumnDefinition\ColumnDefinition $column_definitions): array => $column_definitions->toArray(), + $this->column_definitions + ); + } + if($this->features !== []){ + $data['features'] = array_map( + fn (\Chargebee\Resources\Feature\Feature $features): array => $features->toArray(), + $this->features + ); + } + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/PaymentIntent/Enums/PaymentIntentMetadataSource.php b/src/Resources/PaymentIntent/Enums/PaymentIntentMetadataSource.php new file mode 100644 index 00000000..91f8aaaa --- /dev/null +++ b/src/Resources/PaymentIntent/Enums/PaymentIntentMetadataSource.php @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/src/Resources/PaymentIntent/Enums/PaymentMethodType.php b/src/Resources/PaymentIntent/Enums/PaymentMethodType.php index f37b796a..c0e652d5 100644 --- a/src/Resources/PaymentIntent/Enums/PaymentMethodType.php +++ b/src/Resources/PaymentIntent/Enums/PaymentMethodType.php @@ -48,6 +48,9 @@ enum PaymentMethodType : string { case PAYPAY = "paypay"; case GCASH = "gcash"; case SOUTH_KOREAN_CARDS = "south_korean_cards"; + case PAYNOW = "paynow"; + case BIZUM = "bizum"; + case PROMPTPAY = "promptpay"; case UNKNOWN = "unknown"; public static function tryFromValue(string $value): self { diff --git a/src/Resources/PaymentIntent/PaymentIntent.php b/src/Resources/PaymentIntent/PaymentIntent.php index f08ffca1..9d156eed 100644 --- a/src/Resources/PaymentIntent/PaymentIntent.php +++ b/src/Resources/PaymentIntent/PaymentIntent.php @@ -99,6 +99,12 @@ class PaymentIntent { */ public ?array $payment_attempts; + /** + * + * @var ?PaymentIntentMetadata $payment_intent_metadata + */ + public ?PaymentIntentMetadata $payment_intent_metadata; + /** * * @var ?string $business_entity_id @@ -120,7 +126,7 @@ class PaymentIntent { /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "currency_code" , "amount" , "gateway_account_id" , "expires_at" , "reference_id" , "success_url" , "failure_url" , "created_at" , "modified_at" , "resource_version" , "updated_at" , "customer_id" , "gateway" , "active_payment_attempt" , "payment_attempts" , "business_entity_id" ]; + protected static array $knownFields = [ "id" , "currency_code" , "amount" , "gateway_account_id" , "expires_at" , "reference_id" , "success_url" , "failure_url" , "created_at" , "modified_at" , "resource_version" , "updated_at" , "customer_id" , "gateway" , "active_payment_attempt" , "payment_attempts" , "payment_intent_metadata" , "business_entity_id" ]; /** * dynamic properties for resources @@ -145,6 +151,7 @@ private function __construct( ?string $gateway, ?PaymentAttempt $active_payment_attempt, ?array $payment_attempts, + ?PaymentIntentMetadata $payment_intent_metadata, ?string $business_entity_id, ?\Chargebee\Resources\PaymentIntent\Enums\Status $status, ?\Chargebee\Resources\PaymentIntent\Enums\PaymentMethodType $payment_method_type, @@ -166,6 +173,7 @@ private function __construct( $this->gateway = $gateway; $this->active_payment_attempt = $active_payment_attempt; $this->payment_attempts = $payment_attempts; + $this->payment_intent_metadata = $payment_intent_metadata; $this->business_entity_id = $business_entity_id; $this->status = $status; $this->payment_method_type = $payment_method_type; @@ -193,6 +201,7 @@ public static function from(array $resourceAttributes): self $resourceAttributes['gateway'] ?? null, isset($resourceAttributes['active_payment_attempt']) ? PaymentAttempt::from($resourceAttributes['active_payment_attempt']) : null, $payment_attempts, + isset($resourceAttributes['payment_intent_metadata']) ? PaymentIntentMetadata::from($resourceAttributes['payment_intent_metadata']) : null, $resourceAttributes['business_entity_id'] ?? null, @@ -224,6 +233,7 @@ public function toArray(): array 'gateway' => $this->gateway, + 'business_entity_id' => $this->business_entity_id, 'status' => $this->status?->value, @@ -238,6 +248,9 @@ public function toArray(): array if($this->active_payment_attempt instanceof PaymentAttempt){ $data['active_payment_attempt'] = $this->active_payment_attempt->toArray(); } + if($this->payment_intent_metadata instanceof PaymentIntentMetadata){ + $data['payment_intent_metadata'] = $this->payment_intent_metadata->toArray(); + } if($this->payment_attempts !== []){ $data['payment_attempts'] = array_map( diff --git a/src/Resources/PaymentIntent/PaymentIntentMetadata.php b/src/Resources/PaymentIntent/PaymentIntentMetadata.php new file mode 100644 index 00000000..a2bacc27 --- /dev/null +++ b/src/Resources/PaymentIntent/PaymentIntentMetadata.php @@ -0,0 +1,86 @@ + $knownFields + */ + protected static array $knownFields = [ "source" , "client_ip_address" , "user_agent" , "created_at" ]; + + /** + * dynamic properties for resources + * @var array $_data; + */ + protected $_data = []; + + private function __construct( + ?string $source, + ?string $client_ip_address, + ?string $user_agent, + ?int $created_at, + ) + { + $this->source = $source; + $this->client_ip_address = $client_ip_address; + $this->user_agent = $user_agent; + $this->created_at = $created_at; + } + + public static function from(array $resourceAttributes): self + { + $returnData = new self( $resourceAttributes['source'] ?? null, + $resourceAttributes['client_ip_address'] ?? null, + $resourceAttributes['user_agent'] ?? null, + $resourceAttributes['created_at'] ?? null, + + + ); + + return $returnData; + } + + public function toArray(): array + { + + $data = array_filter(['source' => $this->source, + 'client_ip_address' => $this->client_ip_address, + 'user_agent' => $this->user_agent, + 'created_at' => $this->created_at, + + ], function ($value) { + return $value !== null; + }); + + + + + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Resources/PromotionalGrant/PromotionalGrant.php b/src/Resources/PromotionalGrant/PromotionalGrant.php index dac65050..43d87e1c 100644 --- a/src/Resources/PromotionalGrant/PromotionalGrant.php +++ b/src/Resources/PromotionalGrant/PromotionalGrant.php @@ -29,9 +29,9 @@ class PromotionalGrant { /** * - * @var ?string $metadata + * @var mixed $metadata */ - public ?string $metadata; + public mixed $metadata; /** * @var array $knownFields @@ -49,7 +49,7 @@ private function __construct( ?string $unit_id, ?string $amount, ?int $expires_at, - ?string $metadata, + mixed $metadata, ) { $this->subscription_id = $subscription_id; diff --git a/src/Resources/Quote/Enums/LineItemProrationMode.php b/src/Resources/Quote/Enums/LineItemProrationMode.php new file mode 100644 index 00000000..7f65184e --- /dev/null +++ b/src/Resources/Quote/Enums/LineItemProrationMode.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/src/Resources/Quote/LineItem.php b/src/Resources/Quote/LineItem.php index c4ce31b7..23dc70b6 100644 --- a/src/Resources/Quote/LineItem.php +++ b/src/Resources/Quote/LineItem.php @@ -153,10 +153,16 @@ class LineItem { */ public ?string $customer_id; + /** + * + * @var ?string $proration_mode + */ + public ?string $proration_mode; + /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" ]; + protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" , "proration_mode" ]; /** * dynamic properties for resources @@ -190,6 +196,7 @@ private function __construct( ?string $tax_exempt_reason, ?string $entity_id, ?string $customer_id, + ?string $proration_mode, ) { $this->id = $id; @@ -216,7 +223,8 @@ private function __construct( $this->entity_type = $entity_type; $this->tax_exempt_reason = $tax_exempt_reason; $this->entity_id = $entity_id; - $this->customer_id = $customer_id; + $this->customer_id = $customer_id; + $this->proration_mode = $proration_mode; } public static function from(array $resourceAttributes): self @@ -246,6 +254,7 @@ public static function from(array $resourceAttributes): self $resourceAttributes['tax_exempt_reason'] ?? null, $resourceAttributes['entity_id'] ?? null, $resourceAttributes['customer_id'] ?? null, + $resourceAttributes['proration_mode'] ?? null, ); @@ -281,6 +290,7 @@ public function toArray(): array 'tax_exempt_reason' => $this->tax_exempt_reason, 'entity_id' => $this->entity_id, 'customer_id' => $this->customer_id, + 'proration_mode' => $this->proration_mode, ], function ($value) { return $value !== null; diff --git a/src/Resources/QuoteLineGroup/Enums/LineItemProrationMode.php b/src/Resources/QuoteLineGroup/Enums/LineItemProrationMode.php new file mode 100644 index 00000000..272ae7d9 --- /dev/null +++ b/src/Resources/QuoteLineGroup/Enums/LineItemProrationMode.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/src/Resources/QuoteLineGroup/LineItem.php b/src/Resources/QuoteLineGroup/LineItem.php index 8a658997..dffd52f3 100644 --- a/src/Resources/QuoteLineGroup/LineItem.php +++ b/src/Resources/QuoteLineGroup/LineItem.php @@ -153,10 +153,16 @@ class LineItem { */ public ?string $customer_id; + /** + * + * @var ?string $proration_mode + */ + public ?string $proration_mode; + /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" ]; + protected static array $knownFields = [ "id" , "subscription_id" , "date_from" , "date_to" , "unit_amount" , "quantity" , "amount" , "pricing_model" , "is_taxed" , "tax_amount" , "tax_rate" , "unit_amount_in_decimal" , "quantity_in_decimal" , "amount_in_decimal" , "discount_amount" , "item_level_discount_amount" , "metered" , "is_percentage_pricing" , "reference_line_item_id" , "description" , "entity_description" , "entity_type" , "tax_exempt_reason" , "entity_id" , "customer_id" , "proration_mode" ]; /** * dynamic properties for resources @@ -190,6 +196,7 @@ private function __construct( ?string $tax_exempt_reason, ?string $entity_id, ?string $customer_id, + ?string $proration_mode, ) { $this->id = $id; @@ -216,7 +223,8 @@ private function __construct( $this->entity_type = $entity_type; $this->tax_exempt_reason = $tax_exempt_reason; $this->entity_id = $entity_id; - $this->customer_id = $customer_id; + $this->customer_id = $customer_id; + $this->proration_mode = $proration_mode; } public static function from(array $resourceAttributes): self @@ -246,6 +254,7 @@ public static function from(array $resourceAttributes): self $resourceAttributes['tax_exempt_reason'] ?? null, $resourceAttributes['entity_id'] ?? null, $resourceAttributes['customer_id'] ?? null, + $resourceAttributes['proration_mode'] ?? null, ); @@ -281,6 +290,7 @@ public function toArray(): array 'tax_exempt_reason' => $this->tax_exempt_reason, 'entity_id' => $this->entity_id, 'customer_id' => $this->customer_id, + 'proration_mode' => $this->proration_mode, ], function ($value) { return $value !== null; diff --git a/src/Resources/QuotedCharge/Charge.php b/src/Resources/QuotedCharge/Charge.php index 13f220f6..e5c866f0 100644 --- a/src/Resources/QuotedCharge/Charge.php +++ b/src/Resources/QuotedCharge/Charge.php @@ -21,6 +21,12 @@ class Charge { */ public ?string $description; + /** + * + * @var ?string $entity_description + */ + public ?string $entity_description; + /** * * @var ?int $service_period_in_days @@ -48,7 +54,7 @@ class Charge { /** * @var array $knownFields */ - protected static array $knownFields = [ "amount" , "amount_in_decimal" , "description" , "service_period_in_days" , "avalara_sale_type" , "avalara_transaction_type" , "avalara_service_type" ]; + protected static array $knownFields = [ "amount" , "amount_in_decimal" , "description" , "entity_description" , "service_period_in_days" , "avalara_sale_type" , "avalara_transaction_type" , "avalara_service_type" ]; /** * dynamic properties for resources @@ -60,6 +66,7 @@ private function __construct( ?int $amount, ?string $amount_in_decimal, ?string $description, + ?string $entity_description, ?int $service_period_in_days, ?string $avalara_sale_type, ?int $avalara_transaction_type, @@ -69,6 +76,7 @@ private function __construct( $this->amount = $amount; $this->amount_in_decimal = $amount_in_decimal; $this->description = $description; + $this->entity_description = $entity_description; $this->service_period_in_days = $service_period_in_days; $this->avalara_sale_type = $avalara_sale_type; $this->avalara_transaction_type = $avalara_transaction_type; @@ -80,6 +88,7 @@ public static function from(array $resourceAttributes): self $returnData = new self( $resourceAttributes['amount'] ?? null, $resourceAttributes['amount_in_decimal'] ?? null, $resourceAttributes['description'] ?? null, + $resourceAttributes['entity_description'] ?? null, $resourceAttributes['service_period_in_days'] ?? null, $resourceAttributes['avalara_sale_type'] ?? null, $resourceAttributes['avalara_transaction_type'] ?? null, @@ -97,6 +106,7 @@ public function toArray(): array $data = array_filter(['amount' => $this->amount, 'amount_in_decimal' => $this->amount_in_decimal, 'description' => $this->description, + 'entity_description' => $this->entity_description, 'service_period_in_days' => $this->service_period_in_days, 'avalara_sale_type' => $this->avalara_sale_type, 'avalara_transaction_type' => $this->avalara_transaction_type, diff --git a/src/Resources/QuotedCharge/InvoiceItem.php b/src/Resources/QuotedCharge/InvoiceItem.php index fd9e0888..424ff5cd 100644 --- a/src/Resources/QuotedCharge/InvoiceItem.php +++ b/src/Resources/QuotedCharge/InvoiceItem.php @@ -33,6 +33,18 @@ class InvoiceItem { */ public ?string $unit_price_in_decimal; + /** + * + * @var ?string $description + */ + public ?string $description; + + /** + * + * @var ?string $entity_description + */ + public ?string $entity_description; + /** * * @var ?int $service_period_days @@ -42,7 +54,7 @@ class InvoiceItem { /** * @var array $knownFields */ - protected static array $knownFields = [ "item_price_id" , "quantity" , "quantity_in_decimal" , "unit_price" , "unit_price_in_decimal" , "service_period_days" ]; + protected static array $knownFields = [ "item_price_id" , "quantity" , "quantity_in_decimal" , "unit_price" , "unit_price_in_decimal" , "description" , "entity_description" , "service_period_days" ]; /** * dynamic properties for resources @@ -56,6 +68,8 @@ private function __construct( ?string $quantity_in_decimal, ?int $unit_price, ?string $unit_price_in_decimal, + ?string $description, + ?string $entity_description, ?int $service_period_days, ) { @@ -64,6 +78,8 @@ private function __construct( $this->quantity_in_decimal = $quantity_in_decimal; $this->unit_price = $unit_price; $this->unit_price_in_decimal = $unit_price_in_decimal; + $this->description = $description; + $this->entity_description = $entity_description; $this->service_period_days = $service_period_days; } @@ -74,6 +90,8 @@ public static function from(array $resourceAttributes): self $resourceAttributes['quantity_in_decimal'] ?? null, $resourceAttributes['unit_price'] ?? null, $resourceAttributes['unit_price_in_decimal'] ?? null, + $resourceAttributes['description'] ?? null, + $resourceAttributes['entity_description'] ?? null, $resourceAttributes['service_period_days'] ?? null, @@ -90,6 +108,8 @@ public function toArray(): array 'quantity_in_decimal' => $this->quantity_in_decimal, 'unit_price' => $this->unit_price, 'unit_price_in_decimal' => $this->unit_price_in_decimal, + 'description' => $this->description, + 'entity_description' => $this->entity_description, 'service_period_days' => $this->service_period_days, ], function ($value) { diff --git a/src/Resources/Ramp/DiscountsToAdd.php b/src/Resources/Ramp/DiscountsToAdd.php index 834fac6e..7f6a1efd 100644 --- a/src/Resources/Ramp/DiscountsToAdd.php +++ b/src/Resources/Ramp/DiscountsToAdd.php @@ -33,6 +33,12 @@ class DiscountsToAdd { */ public ?int $amount; + /** + * + * @var ?int $quantity + */ + public ?int $quantity; + /** * * @var ?string $duration_type @@ -78,7 +84,7 @@ class DiscountsToAdd { /** * @var array $knownFields */ - protected static array $knownFields = [ "id" , "invoice_name" , "type" , "percentage" , "amount" , "duration_type" , "period" , "period_unit" , "included_in_mrr" , "apply_on" , "item_price_id" , "created_at" ]; + protected static array $knownFields = [ "id" , "invoice_name" , "type" , "percentage" , "amount" , "quantity" , "duration_type" , "period" , "period_unit" , "included_in_mrr" , "apply_on" , "item_price_id" , "created_at" ]; /** * dynamic properties for resources @@ -92,6 +98,7 @@ private function __construct( ?string $type, ?float $percentage, ?int $amount, + ?int $quantity, ?string $duration_type, ?int $period, ?string $period_unit, @@ -106,6 +113,7 @@ private function __construct( $this->type = $type; $this->percentage = $percentage; $this->amount = $amount; + $this->quantity = $quantity; $this->duration_type = $duration_type; $this->period = $period; $this->period_unit = $period_unit; @@ -122,6 +130,7 @@ public static function from(array $resourceAttributes): self $resourceAttributes['type'] ?? null, $resourceAttributes['percentage'] ?? null, $resourceAttributes['amount'] ?? null, + $resourceAttributes['quantity'] ?? null, $resourceAttributes['duration_type'] ?? null, $resourceAttributes['period'] ?? null, $resourceAttributes['period_unit'] ?? null, @@ -144,6 +153,7 @@ public function toArray(): array 'type' => $this->type, 'percentage' => $this->percentage, 'amount' => $this->amount, + 'quantity' => $this->quantity, 'duration_type' => $this->duration_type, 'period' => $this->period, 'period_unit' => $this->period_unit, diff --git a/src/Resources/Ramp/Enums/DiscountsToAddType.php b/src/Resources/Ramp/Enums/DiscountsToAddType.php index fe8b1930..49748489 100644 --- a/src/Resources/Ramp/Enums/DiscountsToAddType.php +++ b/src/Resources/Ramp/Enums/DiscountsToAddType.php @@ -5,6 +5,7 @@ enum DiscountsToAddType : string { case FIXED_AMOUNT = "fixed_amount"; case PERCENTAGE = "percentage"; + case OFFER_QUANTITY = "offer_quantity"; case UNKNOWN = "unknown"; public static function tryFromValue(string $value): self { diff --git a/src/Responses/MeterResponse/ListMeterResponse.php b/src/Responses/MeterResponse/ListMeterResponse.php new file mode 100644 index 00000000..0a779b04 --- /dev/null +++ b/src/Responses/MeterResponse/ListMeterResponse.php @@ -0,0 +1,54 @@ + $list + */ + public array $list; + + /** + * + * @var ?string $next_offset + */ + public ?string $next_offset; + + + private function __construct( + array $list, + ?string $next_offset, + array $responseHeaders=[], + array $rawResponse=[] + ) + { + parent::__construct($responseHeaders, $rawResponse); + $this->list = $list; + $this->next_offset = $next_offset; + + } + public static function from(array $resourceAttributes, array $headers = []): self + { + $list = array_map(function (array $result): ListMeterResponseListObject { + return new ListMeterResponseListObject( + isset($result['meter']) ? Meter::from($result['meter']) : null, + );}, $resourceAttributes['list'] ?? []); + + return new self($list, + $resourceAttributes['next_offset'] ?? null, $headers, $resourceAttributes); + } + + public function toArray(): array + { + $data = array_filter([ + 'list' => $this->list, + 'next_offset' => $this->next_offset, + ]); + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Responses/MeterResponse/ListMeterResponseListObject.php b/src/Responses/MeterResponse/ListMeterResponseListObject.php new file mode 100644 index 00000000..d5d1d2e9 --- /dev/null +++ b/src/Responses/MeterResponse/ListMeterResponseListObject.php @@ -0,0 +1,14 @@ +meter = $meter; + } +} diff --git a/src/Responses/MeteredFeatureResponse/ArchiveMeteredFeatureResponse.php b/src/Responses/MeteredFeatureResponse/ArchiveMeteredFeatureResponse.php new file mode 100644 index 00000000..a8d691e9 --- /dev/null +++ b/src/Responses/MeteredFeatureResponse/ArchiveMeteredFeatureResponse.php @@ -0,0 +1,45 @@ +meter = $meter; + + } + public static function from(array $resourceAttributes, array $headers = []): self + { + return new self( + isset($resourceAttributes['meter']) ? Meter::from($resourceAttributes['meter']) : null, + $headers, $resourceAttributes); + } + + public function toArray(): array + { + $data = array_filter([ + ]); + + if($this->meter instanceof Meter){ + $data['meter'] = $this->meter->toArray(); + } + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Responses/MeteredFeatureResponse/CreateMeteredFeatureResponse.php b/src/Responses/MeteredFeatureResponse/CreateMeteredFeatureResponse.php new file mode 100644 index 00000000..f20b9d25 --- /dev/null +++ b/src/Responses/MeteredFeatureResponse/CreateMeteredFeatureResponse.php @@ -0,0 +1,45 @@ +meter = $meter; + + } + public static function from(array $resourceAttributes, array $headers = []): self + { + return new self( + isset($resourceAttributes['meter']) ? Meter::from($resourceAttributes['meter']) : null, + $headers, $resourceAttributes); + } + + public function toArray(): array + { + $data = array_filter([ + ]); + + if($this->meter instanceof Meter){ + $data['meter'] = $this->meter->toArray(); + } + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Responses/MeteredFeatureResponse/DeleteMeteredFeatureResponse.php b/src/Responses/MeteredFeatureResponse/DeleteMeteredFeatureResponse.php new file mode 100644 index 00000000..dfca57a0 --- /dev/null +++ b/src/Responses/MeteredFeatureResponse/DeleteMeteredFeatureResponse.php @@ -0,0 +1,45 @@ +meter = $meter; + + } + public static function from(array $resourceAttributes, array $headers = []): self + { + return new self( + isset($resourceAttributes['meter']) ? Meter::from($resourceAttributes['meter']) : null, + $headers, $resourceAttributes); + } + + public function toArray(): array + { + $data = array_filter([ + ]); + + if($this->meter instanceof Meter){ + $data['meter'] = $this->meter->toArray(); + } + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/Responses/MeteredFeatureResponse/ReactivateMeteredFeatureResponse.php b/src/Responses/MeteredFeatureResponse/ReactivateMeteredFeatureResponse.php new file mode 100644 index 00000000..7e72cf6f --- /dev/null +++ b/src/Responses/MeteredFeatureResponse/ReactivateMeteredFeatureResponse.php @@ -0,0 +1,45 @@ +meter = $meter; + + } + public static function from(array $resourceAttributes, array $headers = []): self + { + return new self( + isset($resourceAttributes['meter']) ? Meter::from($resourceAttributes['meter']) : null, + $headers, $resourceAttributes); + } + + public function toArray(): array + { + $data = array_filter([ + ]); + + if($this->meter instanceof Meter){ + $data['meter'] = $this->meter->toArray(); + } + + return $data; + } +} +?> \ No newline at end of file diff --git a/src/ValueObjects/APIRequester.php b/src/ValueObjects/APIRequester.php index bfe8e464..276fe57b 100644 --- a/src/ValueObjects/APIRequester.php +++ b/src/ValueObjects/APIRequester.php @@ -63,7 +63,7 @@ private function sendRequest(ChargebeePayload $payload, int $retryCount): Respon $client = $this->httpClientFactory->create(); $request = $this->httpClientFactory->createRequest($payload); if($retryCount > 0) { - $request->withAddedHeader('X-CB-Retry-Attempt', $retryCount); + $request = $request->withAddedHeader('X-CB-Retry-Attempt', (string)$retryCount); } $response = $client->sendRequest($request); return new ResponseObject( diff --git a/src/Version.php b/src/Version.php index e9fe2cc9..ab47d5eb 100644 --- a/src/Version.php +++ b/src/Version.php @@ -4,7 +4,7 @@ final class Version { - const VERSION = '4.23.0'; + const VERSION = '4.24.0'; } ?> \ No newline at end of file