diff --git a/.bumpversion.cfg b/.bumpversion.cfg index e1c23f5f..c40cd895 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 4.29.0 +current_version = 4.34.0 parse = (?P\d+) \.(?P\d+) \.(?P\d+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc0bd178..7233b212 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,60 @@ # Changelog +## [4.34.0](https://github.com/recurly/recurly-client-php/tree/4.34.0) (2023-05-03) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.33.0...4.34.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#761](https://github.com/recurly/recurly-client-php/pull/761) ([recurly-integrations](https://github.com/recurly-integrations)) + + + +## [4.33.0](https://github.com/recurly/recurly-client-php/tree/4.33.0) (2023-04-26) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.32.0...4.33.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 (used_tax_service on Invoice) [#759](https://github.com/recurly/recurly-client-php/pull/759) ([recurly-integrations](https://github.com/recurly-integrations)) + + + +## [4.32.0](https://github.com/recurly/recurly-client-php/tree/4.32.0) (2023-04-13) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.31.0...4.32.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 (External Accounts) [#756](https://github.com/recurly/recurly-client-php/pull/756) ([recurly-integrations](https://github.com/recurly-integrations)) + + + +## [4.31.0](https://github.com/recurly/recurly-client-php/tree/4.31.0) (2023-04-05) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.30.0...4.31.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 [#753](https://github.com/recurly/recurly-client-php/pull/753) ([recurly-integrations](https://github.com/recurly-integrations)) + + + +## [4.30.0](https://github.com/recurly/recurly-client-php/tree/4.30.0) (2023-03-29) + +[Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.29.0...4.30.0) + + +**Merged Pull Requests** + +- Generated Latest Changes for v2021-02-25 (External Invoices) [#751](https://github.com/recurly/recurly-client-php/pull/751) ([recurly-integrations](https://github.com/recurly-integrations)) + + + ## [4.29.0](https://github.com/recurly/recurly-client-php/tree/4.29.0) (2023-02-22) [Full Changelog](https://github.com/recurly/recurly-client-php/compare/4.28.0...4.29.0) diff --git a/composer.json b/composer.json index 8f07352e..1c1b68dd 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "recurly/recurly-client", - "version": "4.29.0", + "version": "4.34.0", "type": "library", "description": "The PHP client library for the Recurly API", "keywords": ["recurly", "payments", "pay"], diff --git a/lib/recurly/client.php b/lib/recurly/client.php index add76d02..6104128e 100644 --- a/lib/recurly/client.php +++ b/lib/recurly/client.php @@ -536,6 +536,109 @@ public function listAccountCreditPayments(string $account_id, array $options = [ return new \Recurly\Pager($this, $path, $options); } + /** + * List external accounts for an account + * + * @param string $account_id Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. + * @param array $options Associative array of optional parameters + * + * @return \Recurly\Pager A list of external accounts on an account. + * @link https://developers.recurly.com/api/v2021-02-25#operation/list_account_external_account + */ + public function listAccountExternalAccount(string $account_id, array $options = []): \Recurly\Pager + { + $path = $this->interpolatePath("/accounts/{account_id}/external_accounts", ['account_id' => $account_id]); + return new \Recurly\Pager($this, $path, $options); + } + + /** + * Create an external account + * + * @param string $account_id Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. + * @param array $body The body of the request. + * @param array $options Associative array of optional parameters + * + * @return \Recurly\Resources\ExternalAccount A representation of the created external_account. + * @link https://developers.recurly.com/api/v2021-02-25#operation/create_account_external_account + */ + public function createAccountExternalAccount(string $account_id, array $body, array $options = []): \Recurly\Resources\ExternalAccount + { + $path = $this->interpolatePath("/accounts/{account_id}/external_accounts", ['account_id' => $account_id]); + return $this->makeRequest('POST', $path, $body, $options); + } + + /** + * Get an external account for an account + * + * @param string $account_id Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. + * @param string $external_account_id External account ID, e.g. `s28zov4fw0cb`. + * @param array $options Associative array of optional parameters + * + * @return \Recurly\Resources\ExternalAccount A external account on an account. + * @link https://developers.recurly.com/api/v2021-02-25#operation/get_account_external_account + */ + public function getAccountExternalAccount(string $account_id, string $external_account_id, array $options = []): \Recurly\Resources\ExternalAccount + { + $path = $this->interpolatePath("/accounts/{account_id}/external_accounts/{external_account_id}", ['account_id' => $account_id, 'external_account_id' => $external_account_id]); + return $this->makeRequest('GET', $path, [], $options); + } + + /** + * Update an external account + * + * @param string $account_id Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. + * @param string $external_account_id External account ID, e.g. `s28zov4fw0cb`. + * @param array $body The body of the request. + * @param array $options Associative array of optional parameters + * + * @return \Recurly\Resources\ExternalAccount A representation of the updated external_account. + * @link https://developers.recurly.com/api/v2021-02-25#operation/update_account_external_account + */ + public function updateAccountExternalAccount(string $account_id, string $external_account_id, array $body, array $options = []): \Recurly\Resources\ExternalAccount + { + $path = $this->interpolatePath("/accounts/{account_id}/external_accounts/{external_account_id}", ['account_id' => $account_id, 'external_account_id' => $external_account_id]); + return $this->makeRequest('PUT', $path, $body, $options); + } + + /** + * Delete an external account for an account + * + * @param string $account_id Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. + * @param string $external_account_id External account ID, e.g. `s28zov4fw0cb`. + * @param array $options Associative array of optional parameters + * + * @return \Recurly\Resources\ExternalAccount Successful Delete + * @link https://developers.recurly.com/api/v2021-02-25#operation/delete_account_external_account + */ + public function deleteAccountExternalAccount(string $account_id, string $external_account_id, array $options = []): \Recurly\Resources\ExternalAccount + { + $path = $this->interpolatePath("/accounts/{account_id}/external_accounts/{external_account_id}", ['account_id' => $account_id, 'external_account_id' => $external_account_id]); + return $this->makeRequest('DELETE', $path, [], $options); + } + + /** + * List the external invoices on an account + * + * @param string $account_id Account ID or code. For ID no prefix is used e.g. `e28zov4fw0v2`. For code use prefix `code-`, e.g. `code-bob`. + * @param array $options Associative array of optional parameters + * + * Supported optional query string parameters: + * + * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending + * order. In descending order updated records will move behind the cursor and could + * prevent some records from being returned. + * - $options['params']['limit'] (int): Limit number of records 1-200. + * - $options['params']['order'] (string): Sort order. + * + * @return \Recurly\Pager A list of the the external_invoices on an account. + * @link https://developers.recurly.com/api/v2021-02-25#operation/list_account_external_invoices + */ + public function listAccountExternalInvoices(string $account_id, array $options = []): \Recurly\Pager + { + $path = $this->interpolatePath("/accounts/{account_id}/external_invoices", ['account_id' => $account_id]); + return new \Recurly\Pager($this, $path, $options); + } + /** * List an account's invoices * @@ -1567,6 +1670,29 @@ public function getExternalSubscription(string $external_subscription_id, array return $this->makeRequest('GET', $path, [], $options); } + /** + * List the external invoices on an external subscription + * + * @param string $external_subscription_id External subscription id + * @param array $options Associative array of optional parameters + * + * Supported optional query string parameters: + * + * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending + * order. In descending order updated records will move behind the cursor and could + * prevent some records from being returned. + * - $options['params']['limit'] (int): Limit number of records 1-200. + * - $options['params']['order'] (string): Sort order. + * + * @return \Recurly\Pager A list of the the external_invoices on a site. + * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_subscription_external_invoices + */ + public function listExternalSubscriptionExternalInvoices(string $external_subscription_id, array $options = []): \Recurly\Pager + { + $path = $this->interpolatePath("/external_subscriptions/{external_subscription_id}/external_invoices", ['external_subscription_id' => $external_subscription_id]); + return new \Recurly\Pager($this, $path, $options); + } + /** * List a site's invoices * @@ -3046,6 +3172,43 @@ public function getInvoiceTemplate(string $invoice_template_id, array $options = return $this->makeRequest('GET', $path, [], $options); } + /** + * List the external invoices on a site + * + * @param array $options Associative array of optional parameters + * + * Supported optional query string parameters: + * + * - $options['params']['sort'] (string): Sort field. You *really* only want to sort by `updated_at` in ascending + * order. In descending order updated records will move behind the cursor and could + * prevent some records from being returned. + * - $options['params']['limit'] (int): Limit number of records 1-200. + * - $options['params']['order'] (string): Sort order. + * + * @return \Recurly\Pager A list of the the external_invoices on a site. + * @link https://developers.recurly.com/api/v2021-02-25#operation/list_external_invoices + */ + public function listExternalInvoices(array $options = []): \Recurly\Pager + { + $path = $this->interpolatePath("/external_invoices", []); + return new \Recurly\Pager($this, $path, $options); + } + + /** + * Fetch an external invoice + * + * @param string $external_invoice_id External invoice ID, e.g. `e28zov4fw0v2`. + * @param array $options Associative array of optional parameters + * + * @return \Recurly\Resources\ExternalInvoice Returns the external invoice + * @link https://developers.recurly.com/api/v2021-02-25#operation/show_external_invoice + */ + public function showExternalInvoice(string $external_invoice_id, array $options = []): \Recurly\Resources\ExternalInvoice + { + $path = $this->interpolatePath("/external_invoices/{external_invoice_id}", ['external_invoice_id' => $external_invoice_id]); + return $this->makeRequest('GET', $path, [], $options); + } + /** * List entitlements granted to an account * diff --git a/lib/recurly/resources/account.php b/lib/recurly/resources/account.php index e99c9a4f..b938ad47 100644 --- a/lib/recurly/resources/account.php +++ b/lib/recurly/resources/account.php @@ -24,6 +24,7 @@ class Account extends RecurlyResource private $_dunning_campaign_id; private $_email; private $_exemption_certificate; + private $_external_accounts; private $_first_name; private $_has_active_subscription; private $_has_canceled_subscription; @@ -48,6 +49,7 @@ class Account extends RecurlyResource protected static $array_hints = [ 'setCustomFields' => '\Recurly\Resources\CustomField', + 'setExternalAccounts' => '\Recurly\Resources\ExternalAccount', 'setShippingAddresses' => '\Recurly\Resources\ShippingAddress', ]; @@ -328,6 +330,29 @@ public function setExemptionCertificate(string $exemption_certificate): void $this->_exemption_certificate = $exemption_certificate; } + /** + * Getter method for the external_accounts attribute. + * The external accounts belonging to this account + * + * @return array + */ + public function getExternalAccounts(): array + { + return $this->_external_accounts ?? [] ; + } + + /** + * Setter method for the external_accounts attribute. + * + * @param array $external_accounts + * + * @return void + */ + public function setExternalAccounts(array $external_accounts): void + { + $this->_external_accounts = $external_accounts; + } + /** * Getter method for the first_name attribute. * diff --git a/lib/recurly/resources/external_account.php b/lib/recurly/resources/external_account.php new file mode 100644 index 00000000..259409de --- /dev/null +++ b/lib/recurly/resources/external_account.php @@ -0,0 +1,163 @@ +_created_at; + } + + /** + * Setter method for the created_at attribute. + * + * @param string $created_at + * + * @return void + */ + public function setCreatedAt(string $created_at): void + { + $this->_created_at = $created_at; + } + + /** + * Getter method for the external_account_code attribute. + * Represents the account code for the external account. + * + * @return ?string + */ + public function getExternalAccountCode(): ?string + { + return $this->_external_account_code; + } + + /** + * Setter method for the external_account_code attribute. + * + * @param string $external_account_code + * + * @return void + */ + public function setExternalAccountCode(string $external_account_code): void + { + $this->_external_account_code = $external_account_code; + } + + /** + * Getter method for the external_connection_type attribute. + * Represents the connection type. `AppleAppStore` or `GooglePlayStore` + * + * @return ?string + */ + public function getExternalConnectionType(): ?string + { + return $this->_external_connection_type; + } + + /** + * Setter method for the external_connection_type attribute. + * + * @param string $external_connection_type + * + * @return void + */ + public function setExternalConnectionType(string $external_connection_type): void + { + $this->_external_connection_type = $external_connection_type; + } + + /** + * Getter method for the id attribute. + * UUID of the external_account . + * + * @return ?string + */ + public function getId(): ?string + { + return $this->_id; + } + + /** + * Setter method for the id attribute. + * + * @param string $id + * + * @return void + */ + public function setId(string $id): void + { + $this->_id = $id; + } + + /** + * Getter method for the object attribute. + * + * + * @return ?string + */ + public function getObject(): ?string + { + return $this->_object; + } + + /** + * Setter method for the object attribute. + * + * @param string $object + * + * @return void + */ + public function setObject(string $object): void + { + $this->_object = $object; + } + + /** + * Getter method for the updated_at attribute. + * Last updated at + * + * @return ?string + */ + public function getUpdatedAt(): ?string + { + return $this->_updated_at; + } + + /** + * Setter method for the updated_at attribute. + * + * @param string $updated_at + * + * @return void + */ + public function setUpdatedAt(string $updated_at): void + { + $this->_updated_at = $updated_at; + } +} \ No newline at end of file diff --git a/lib/recurly/resources/external_charge.php b/lib/recurly/resources/external_charge.php new file mode 100644 index 00000000..a5916aff --- /dev/null +++ b/lib/recurly/resources/external_charge.php @@ -0,0 +1,259 @@ +_account; + } + + /** + * Setter method for the account attribute. + * + * @param \Recurly\Resources\AccountMini $account + * + * @return void + */ + public function setAccount(\Recurly\Resources\AccountMini $account): void + { + $this->_account = $account; + } + + /** + * Getter method for the created_at attribute. + * When the external charge was created in Recurly. + * + * @return ?string + */ + public function getCreatedAt(): ?string + { + return $this->_created_at; + } + + /** + * Setter method for the created_at attribute. + * + * @param string $created_at + * + * @return void + */ + public function setCreatedAt(string $created_at): void + { + $this->_created_at = $created_at; + } + + /** + * Getter method for the currency attribute. + * 3-letter ISO 4217 currency code. + * + * @return ?string + */ + public function getCurrency(): ?string + { + return $this->_currency; + } + + /** + * Setter method for the currency attribute. + * + * @param string $currency + * + * @return void + */ + public function setCurrency(string $currency): void + { + $this->_currency = $currency; + } + + /** + * Getter method for the description attribute. + * + * + * @return ?string + */ + public function getDescription(): ?string + { + return $this->_description; + } + + /** + * Setter method for the description attribute. + * + * @param string $description + * + * @return void + */ + public function setDescription(string $description): void + { + $this->_description = $description; + } + + /** + * Getter method for the external_product_reference attribute. + * External Product Reference details + * + * @return ?\Recurly\Resources\ExternalProductReferenceMini + */ + public function getExternalProductReference(): ?\Recurly\Resources\ExternalProductReferenceMini + { + return $this->_external_product_reference; + } + + /** + * Setter method for the external_product_reference attribute. + * + * @param \Recurly\Resources\ExternalProductReferenceMini $external_product_reference + * + * @return void + */ + public function setExternalProductReference(\Recurly\Resources\ExternalProductReferenceMini $external_product_reference): void + { + $this->_external_product_reference = $external_product_reference; + } + + /** + * Getter method for the id attribute. + * System-generated unique identifier for an external charge ID, e.g. `e28zov4fw0v2`. + * + * @return ?string + */ + public function getId(): ?string + { + return $this->_id; + } + + /** + * Setter method for the id attribute. + * + * @param string $id + * + * @return void + */ + public function setId(string $id): void + { + $this->_id = $id; + } + + /** + * Getter method for the object attribute. + * Object type + * + * @return ?string + */ + public function getObject(): ?string + { + return $this->_object; + } + + /** + * Setter method for the object attribute. + * + * @param string $object + * + * @return void + */ + public function setObject(string $object): void + { + $this->_object = $object; + } + + /** + * Getter method for the quantity attribute. + * + * + * @return ?int + */ + public function getQuantity(): ?int + { + return $this->_quantity; + } + + /** + * Setter method for the quantity attribute. + * + * @param int $quantity + * + * @return void + */ + public function setQuantity(int $quantity): void + { + $this->_quantity = $quantity; + } + + /** + * Getter method for the unit_amount attribute. + * Unit Amount + * + * @return ?string + */ + public function getUnitAmount(): ?string + { + return $this->_unit_amount; + } + + /** + * Setter method for the unit_amount attribute. + * + * @param string $unit_amount + * + * @return void + */ + public function setUnitAmount(string $unit_amount): void + { + $this->_unit_amount = $unit_amount; + } + + /** + * Getter method for the updated_at attribute. + * When the external charge was updated in Recurly. + * + * @return ?string + */ + public function getUpdatedAt(): ?string + { + return $this->_updated_at; + } + + /** + * Setter method for the updated_at attribute. + * + * @param string $updated_at + * + * @return void + */ + public function setUpdatedAt(string $updated_at): void + { + $this->_updated_at = $updated_at; + } +} \ No newline at end of file diff --git a/lib/recurly/resources/external_invoice.php b/lib/recurly/resources/external_invoice.php new file mode 100644 index 00000000..68adda90 --- /dev/null +++ b/lib/recurly/resources/external_invoice.php @@ -0,0 +1,308 @@ + '\Recurly\Resources\ExternalCharge', + ]; + + + /** + * Getter method for the account attribute. + * Account mini details + * + * @return ?\Recurly\Resources\AccountMini + */ + public function getAccount(): ?\Recurly\Resources\AccountMini + { + return $this->_account; + } + + /** + * Setter method for the account attribute. + * + * @param \Recurly\Resources\AccountMini $account + * + * @return void + */ + public function setAccount(\Recurly\Resources\AccountMini $account): void + { + $this->_account = $account; + } + + /** + * Getter method for the created_at attribute. + * When the external invoice was created in Recurly. + * + * @return ?string + */ + public function getCreatedAt(): ?string + { + return $this->_created_at; + } + + /** + * Setter method for the created_at attribute. + * + * @param string $created_at + * + * @return void + */ + public function setCreatedAt(string $created_at): void + { + $this->_created_at = $created_at; + } + + /** + * Getter method for the currency attribute. + * 3-letter ISO 4217 currency code. + * + * @return ?string + */ + public function getCurrency(): ?string + { + return $this->_currency; + } + + /** + * Setter method for the currency attribute. + * + * @param string $currency + * + * @return void + */ + public function setCurrency(string $currency): void + { + $this->_currency = $currency; + } + + /** + * Getter method for the external_id attribute. + * An identifier which associates the external invoice to a corresponding object in an external platform. + * + * @return ?string + */ + public function getExternalId(): ?string + { + return $this->_external_id; + } + + /** + * Setter method for the external_id attribute. + * + * @param string $external_id + * + * @return void + */ + public function setExternalId(string $external_id): void + { + $this->_external_id = $external_id; + } + + /** + * Getter method for the external_subscription attribute. + * Subscription from an external resource such as Apple App Store or Google Play Store. + * + * @return ?\Recurly\Resources\ExternalSubscription + */ + public function getExternalSubscription(): ?\Recurly\Resources\ExternalSubscription + { + return $this->_external_subscription; + } + + /** + * Setter method for the external_subscription attribute. + * + * @param \Recurly\Resources\ExternalSubscription $external_subscription + * + * @return void + */ + public function setExternalSubscription(\Recurly\Resources\ExternalSubscription $external_subscription): void + { + $this->_external_subscription = $external_subscription; + } + + /** + * Getter method for the id attribute. + * System-generated unique identifier for an external invoice ID, e.g. `e28zov4fw0v2`. + * + * @return ?string + */ + public function getId(): ?string + { + return $this->_id; + } + + /** + * Setter method for the id attribute. + * + * @param string $id + * + * @return void + */ + public function setId(string $id): void + { + $this->_id = $id; + } + + /** + * Getter method for the line_items attribute. + * + * + * @return array + */ + public function getLineItems(): array + { + return $this->_line_items ?? [] ; + } + + /** + * Setter method for the line_items attribute. + * + * @param array $line_items + * + * @return void + */ + public function setLineItems(array $line_items): void + { + $this->_line_items = $line_items; + } + + /** + * Getter method for the object attribute. + * Object type + * + * @return ?string + */ + public function getObject(): ?string + { + return $this->_object; + } + + /** + * Setter method for the object attribute. + * + * @param string $object + * + * @return void + */ + public function setObject(string $object): void + { + $this->_object = $object; + } + + /** + * Getter method for the purchased_at attribute. + * When the invoice was created in the external platform. + * + * @return ?string + */ + public function getPurchasedAt(): ?string + { + return $this->_purchased_at; + } + + /** + * Setter method for the purchased_at attribute. + * + * @param string $purchased_at + * + * @return void + */ + public function setPurchasedAt(string $purchased_at): void + { + $this->_purchased_at = $purchased_at; + } + + /** + * Getter method for the state attribute. + * + * + * @return ?string + */ + public function getState(): ?string + { + return $this->_state; + } + + /** + * Setter method for the state attribute. + * + * @param string $state + * + * @return void + */ + public function setState(string $state): void + { + $this->_state = $state; + } + + /** + * Getter method for the total attribute. + * Total + * + * @return ?string + */ + public function getTotal(): ?string + { + return $this->_total; + } + + /** + * Setter method for the total attribute. + * + * @param string $total + * + * @return void + */ + public function setTotal(string $total): void + { + $this->_total = $total; + } + + /** + * Getter method for the updated_at attribute. + * When the external invoice was updated in Recurly. + * + * @return ?string + */ + public function getUpdatedAt(): ?string + { + return $this->_updated_at; + } + + /** + * Setter method for the updated_at attribute. + * + * @param string $updated_at + * + * @return void + */ + public function setUpdatedAt(string $updated_at): void + { + $this->_updated_at = $updated_at; + } +} \ No newline at end of file diff --git a/lib/recurly/resources/invoice.php b/lib/recurly/resources/invoice.php index cdad2aab..ff624e81 100644 --- a/lib/recurly/resources/invoice.php +++ b/lib/recurly/resources/invoice.php @@ -49,6 +49,7 @@ class Invoice extends RecurlyResource private $_transactions; private $_type; private $_updated_at; + private $_used_tax_service; private $_uuid; private $_vat_number; private $_vat_reverse_charge_notes; @@ -912,6 +913,29 @@ public function setUpdatedAt(string $updated_at): void $this->_updated_at = $updated_at; } + /** + * Getter method for the used_tax_service attribute. + * Will be `true` when the invoice had a successful response from the tax service and `false` when the invoice was not sent to tax service due to a lack of address or enabled jurisdiction or was processed without tax due to a non-blocking error returned from the tax service. + * + * @return ?bool + */ + public function getUsedTaxService(): ?bool + { + return $this->_used_tax_service; + } + + /** + * Setter method for the used_tax_service attribute. + * + * @param bool $used_tax_service + * + * @return void + */ + public function setUsedTaxService(bool $used_tax_service): void + { + $this->_used_tax_service = $used_tax_service; + } + /** * Getter method for the uuid attribute. * Invoice UUID diff --git a/lib/recurly/resources/tax_detail.php b/lib/recurly/resources/tax_detail.php index d31c43b3..83728017 100644 --- a/lib/recurly/resources/tax_detail.php +++ b/lib/recurly/resources/tax_detail.php @@ -12,6 +12,9 @@ // phpcs:disable class TaxDetail extends RecurlyResource { + private $_billable; + private $_level; + private $_name; private $_rate; private $_region; private $_tax; @@ -21,6 +24,75 @@ class TaxDetail extends RecurlyResource ]; + /** + * Getter method for the billable attribute. + * Whether or not the line item is taxable. Only populated for a single LineItem fetch when Avalara for Communications is enabled. + * + * @return ?bool + */ + public function getBillable(): ?bool + { + return $this->_billable; + } + + /** + * Setter method for the billable attribute. + * + * @param bool $billable + * + * @return void + */ + public function setBillable(bool $billable): void + { + $this->_billable = $billable; + } + + /** + * Getter method for the level attribute. + * Provides the jurisdiction level for the Communications tax applied. Example values include city, state and federal. Present only when Avalara for Communications is enabled. + * + * @return ?string + */ + public function getLevel(): ?string + { + return $this->_level; + } + + /** + * Setter method for the level attribute. + * + * @param string $level + * + * @return void + */ + public function setLevel(string $level): void + { + $this->_level = $level; + } + + /** + * Getter method for the name attribute. + * Provides the name of the Communications tax applied. Present only when Avalara for Communications is enabled. + * + * @return ?string + */ + public function getName(): ?string + { + return $this->_name; + } + + /** + * Setter method for the name attribute. + * + * @param string $name + * + * @return void + */ + public function setName(string $name): void + { + $this->_name = $name; + } + /** * Getter method for the rate attribute. * Provides the tax rate for the region. @@ -46,7 +118,7 @@ public function setRate(float $rate): void /** * Getter method for the region attribute. - * Provides the tax region applied on an invoice. For Canadian Sales Tax, this will be either the 2 letter province code or country code. + * Provides the tax region applied on an invoice. For Canadian Sales Tax, this will be either the 2 letter province code or country code. Not present when Avalara for Communications is enabled. * * @return ?string */ @@ -92,7 +164,7 @@ public function setTax(float $tax): void /** * Getter method for the type attribute. - * Provides the tax type for the region. For Canadian Sales Tax, this will be GST, HST, QST or PST. + * Provides the tax type for the region or type of Comminications tax when Avalara for Communications is enabled. For Canadian Sales Tax, this will be GST, HST, QST or PST. * * @return ?string */ diff --git a/lib/recurly/resources/tax_info.php b/lib/recurly/resources/tax_info.php index 6ed8e000..cba8b7a0 100644 --- a/lib/recurly/resources/tax_info.php +++ b/lib/recurly/resources/tax_info.php @@ -24,7 +24,7 @@ class TaxInfo extends RecurlyResource /** * Getter method for the rate attribute. - * Rate + * The combined tax rate. Not present when Avalara for Communications is enabled. * * @return ?float */ @@ -47,7 +47,7 @@ public function setRate(float $rate): void /** * Getter method for the region attribute. - * Provides the tax region applied on an invoice. For U.S. Sales Tax, this will be the 2 letter state code. For EU VAT this will be the 2 letter country code. For all country level tax types, this will display the regional tax, like VAT, GST, or PST. + * Provides the tax region applied on an invoice. For U.S. Sales Tax, this will be the 2 letter state code. For EU VAT this will be the 2 letter country code. For all country level tax types, this will display the regional tax, like VAT, GST, or PST. Not present when Avalara for Communications is enabled. * * @return ?string */ @@ -70,7 +70,7 @@ public function setRegion(string $region): void /** * Getter method for the tax_details attribute. - * Provides additional tax details for Canadian Sales Tax when there is tax applied at both the country and province levels. This will only be populated for the Invoice response when fetching a single invoice and not for the InvoiceList or LineItem. + * Provides additional tax details for Communications taxes when Avalara for Communications is enabled or Canadian Sales Tax when there is tax applied at both the country and province levels. This will only be populated for the Invoice response when fetching a single invoice and not for the InvoiceList or LineItemList. Only populated for a single LineItem fetch when Avalara for Communications is enabled. * * @return array */ @@ -93,7 +93,7 @@ public function setTaxDetails(array $tax_details): void /** * Getter method for the type attribute. - * Provides the tax type as "vat" for EU VAT, "usst" for U.S. Sales Tax, or the 2 letter country code for country level tax types like Canada, Australia, New Zealand, Israel, and all non-EU European countries. + * Provides the tax type as "vat" for EU VAT, "usst" for U.S. Sales Tax, or the 2 letter country code for country level tax types like Canada, Australia, New Zealand, Israel, and all non-EU European countries. Not present when Avalara for Communications is enabled. * * @return ?string */ diff --git a/lib/recurly/version.php b/lib/recurly/version.php index f67e8ca4..4432ad78 100644 --- a/lib/recurly/version.php +++ b/lib/recurly/version.php @@ -4,5 +4,5 @@ class Version { - public const CURRENT = '4.29.0'; + public const CURRENT = '4.34.0'; } diff --git a/openapi/api.yaml b/openapi/api.yaml index 8db95d37..7a5a9afe 100644 --- a/openapi/api.yaml +++ b/openapi/api.yaml @@ -200,7 +200,9 @@ x-tagGroups: - usage - automated_exports - external_subscriptions + - external_invoices - external_products + - external_accounts - gift_cards - name: Products and Promotions tags: @@ -346,6 +348,11 @@ tags: description: A subscription from an external resource that is not managed by the Recurly platform and instead is managed by third-party platforms like Apple App Store and Google Play Store. +- name: external_invoices + x-displayName: External Invoices + description: An invoice from an external resource that is not managed by the Recurly + platform and instead is managed by third-party platforms like Apple App Store + and Google Play Store. - name: external_products x-displayName: External Product description: A product from an external resource that is not managed by the Recurly @@ -355,6 +362,11 @@ tags: x-displayName: Gift Cards description: Add gift card purchases to your checkout and allow gift card recipients to redeem the gift card for credit towards any of your products. +- name: external_accounts + x-displayName: External Accounts + description: An account from an external resource that is not managed by the Recurly + platform and instead is managed by third-party platforms like Apple App Store + and Google Play Store. paths: "/sites": get: @@ -3244,6 +3256,242 @@ paths: := err.(*recurly.Error); ok {\n\t\tfmt.Printf(\"Failed to retrieve next page: %v\", e)\n\t\tbreak\n\t}\n\tfor i, creditPayment := range creditPayments.Data() {\n\t\tfmt.Printf(\"Account Credit Payment %3d: %s\\n\",\n\t\t\ti,\n\t\t\tcreditPayment.Id,\n\t\t)\n\t}\n}" + "/accounts/{account_id}/external_accounts": + parameters: + - "$ref": "#/components/parameters/account_id" + get: + tags: + - external_accounts + operationId: list_account_external_account + summary: List external accounts for an account + responses: + '200': + description: A list of external accounts on an account. + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalAccountList" + '404': + description: Incorrect account or external_account ID. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '406': + description: Unavailable API version + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '422': + description: Feature not enabled on site + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] + post: + tags: + - external_accounts + operationId: create_account_external_account + summary: Create an external account + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalAccountCreate" + responses: + '200': + description: A representation of the created external_account. + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalAccount" + '404': + description: Incorrect account or external_account ID. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '406': + description: Unavailable API version + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '422': + description: Feature not enabled on site + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] + "/accounts/{account_id}/external_accounts/{external_account_id}": + parameters: + - "$ref": "#/components/parameters/account_id" + - "$ref": "#/components/parameters/external_account_id" + get: + tags: + - external_accounts + operationId: get_account_external_account + summary: Get an external account for an account + responses: + '200': + description: A external account on an account. + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalAccount" + '404': + description: Incorrect account or external_account ID. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '406': + description: Unavailable API version + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '422': + description: Feature not enabled on site + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] + put: + tags: + - external_accounts + operationId: update_account_external_account + summary: Update an external account + requestBody: + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalAccountUpdate" + responses: + '200': + description: A representation of the updated external_account. + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalAccount" + '404': + description: Incorrect account or external_account ID. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '406': + description: Unavailable API version + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '422': + description: Feature not enabled on site + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] + delete: + tags: + - external_accounts + operationId: delete_account_external_account + summary: Delete an external account for an account + responses: + '200': + description: Successful Delete + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalAccount" + '404': + description: External Account not found + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '406': + description: Unavailable API version + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '422': + description: Feature not enabled on site + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] + "/accounts/{account_id}/external_invoices": + parameters: + - "$ref": "#/components/parameters/account_id" + get: + tags: + - account + operationId: list_account_external_invoices + summary: List the external invoices on an account + description: See the [Pagination Guide](/developers/guides/pagination.html) + to learn how to use pagination in the API and Client Libraries. + parameters: + - "$ref": "#/components/parameters/sort_dates" + - "$ref": "#/components/parameters/limit" + - "$ref": "#/components/parameters/order" + responses: + '200': + description: A list of the the external_invoices on an account. + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalInvoiceList" + '404': + description: Incorrect account. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] "/accounts/{account_id}/invoices": get: tags: @@ -7588,6 +7836,40 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] + "/external_subscriptions/{external_subscription_id}/external_invoices": + parameters: + - "$ref": "#/components/parameters/external_subscription_id" + get: + tags: + - external_subscriptions + operationId: list_external_subscription_external_invoices + summary: List the external invoices on an external subscription + description: See the [Pagination Guide](/developers/guides/pagination.html) + to learn how to use pagination in the API and Client Libraries. + parameters: + - "$ref": "#/components/parameters/sort_dates" + - "$ref": "#/components/parameters/limit" + - "$ref": "#/components/parameters/order" + responses: + '200': + description: A list of the the external_invoices on a site. + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalInvoiceList" + '404': + description: Incorrect site. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] "/invoices": get: tags: @@ -15346,6 +15628,72 @@ paths: schema: "$ref": "#/components/schemas/Error" x-code-samples: [] + "/external_invoices": + get: + tags: + - external_invoices + operationId: list_external_invoices + summary: List the external invoices on a site + description: See the [Pagination Guide](/developers/guides/pagination.html) + to learn how to use pagination in the API and Client Libraries. + parameters: + - "$ref": "#/components/parameters/sort_dates" + - "$ref": "#/components/parameters/limit" + - "$ref": "#/components/parameters/order" + responses: + '200': + description: A list of the the external_invoices on a site. + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalInvoiceList" + '404': + description: Incorrect site. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] + "/external_invoices/{external_invoice_id}": + parameters: + - "$ref": "#/components/parameters/external_invoice_id" + get: + tags: + - external_invoices + operationId: show_external_invoice + summary: Fetch an external invoice + responses: + '201': + description: Returns the external invoice + content: + application/json: + schema: + "$ref": "#/components/schemas/ExternalInvoice" + '400': + description: Bad request; perhaps missing or invalid parameters. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + '404': + description: External invoice cannot be found for the specified reason. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + default: + description: Unexpected error. + content: + application/json: + schema: + "$ref": "#/components/schemas/Error" + x-code-samples: [] "/accounts/{account_id}/entitlements": parameters: - "$ref": "#/components/parameters/account_id" @@ -15643,6 +15991,20 @@ components: required: true schema: type: string + external_account_id: + name: external_account_id + in: path + description: External account ID, e.g. `s28zov4fw0cb`. + required: true + schema: + type: string + external_invoice_id: + name: external_invoice_id + in: path + description: External invoice ID, e.g. `e28zov4fw0v2`. + required: true + schema: + type: string external_product_id: name: external_product_id in: path @@ -16419,6 +16781,11 @@ components: maxLength: 50 acquisition: "$ref": "#/components/schemas/AccountAcquisitionUpdate" + external_accounts: + type: array + title: External Accounts + items: + "$ref": "#/components/schemas/ExternalAccountCreate" shipping_addresses: type: array items: @@ -16616,6 +16983,11 @@ components: merchant has an integration for the Vertex tax provider, this optional value will be sent in any tax calculation requests for the account. maxLength: 30 + external_accounts: + type: array + description: The external accounts belonging to this account + items: + "$ref": "#/components/schemas/ExternalAccount" parent_account_id: type: string maxLength: 13 @@ -17457,6 +17829,9 @@ components: title: Security code or CVV description: "*STRONGLY RECOMMENDED*" maxLength: 4 + currency: + type: string + description: 3-letter ISO 4217 currency code. vat_number: type: string title: VAT number @@ -18657,6 +19032,13 @@ components: description: The outstanding balance remaining on this invoice. tax_info: "$ref": "#/components/schemas/TaxInfo" + used_tax_service: + type: boolean + title: Used Tax Service? + description: Will be `true` when the invoice had a successful response from + the tax service and `false` when the invoice was not sent to tax service + due to a lack of address or enabled jurisdiction or was processed without + tax due to a non-blocking error returned from the tax service. vat_number: type: string title: VAT number @@ -21965,23 +22347,29 @@ components: description: Provides the tax type as "vat" for EU VAT, "usst" for U.S. Sales Tax, or the 2 letter country code for country level tax types like Canada, Australia, New Zealand, Israel, and all non-EU European countries. + Not present when Avalara for Communications is enabled. region: type: string title: Region description: Provides the tax region applied on an invoice. For U.S. Sales Tax, this will be the 2 letter state code. For EU VAT this will be the 2 letter country code. For all country level tax types, this will display - the regional tax, like VAT, GST, or PST. + the regional tax, like VAT, GST, or PST. Not present when Avalara for + Communications is enabled. rate: type: number format: float title: Rate + description: The combined tax rate. Not present when Avalara for Communications + is enabled. tax_details: type: array - description: Provides additional tax details for Canadian Sales Tax when - there is tax applied at both the country and province levels. This will - only be populated for the Invoice response when fetching a single invoice - and not for the InvoiceList or LineItem. + description: Provides additional tax details for Communications taxes when + Avalara for Communications is enabled or Canadian Sales Tax when there + is tax applied at both the country and province levels. This will only + be populated for the Invoice response when fetching a single invoice and + not for the InvoiceList or LineItemList. Only populated for a single LineItem + fetch when Avalara for Communications is enabled. items: "$ref": "#/components/schemas/TaxDetail" TaxDetail: @@ -21991,13 +22379,15 @@ components: type: type: string title: Type - description: Provides the tax type for the region. For Canadian Sales Tax, + description: Provides the tax type for the region or type of Comminications + tax when Avalara for Communications is enabled. For Canadian Sales Tax, this will be GST, HST, QST or PST. region: type: string title: Region description: Provides the tax region applied on an invoice. For Canadian Sales Tax, this will be either the 2 letter province code or country code. + Not present when Avalara for Communications is enabled. rate: type: number format: float @@ -22008,6 +22398,22 @@ components: format: float title: Tax description: The total tax applied for this tax type. + name: + type: string + title: Name + description: Provides the name of the Communications tax applied. Present + only when Avalara for Communications is enabled. + level: + type: string + title: Level + description: Provides the jurisdiction level for the Communications tax + applied. Example values include city, state and federal. Present only + when Avalara for Communications is enabled. + billable: + type: boolean + title: Billable + description: Whether or not the line item is taxable. Only populated for + a single LineItem fetch when Avalara for Communications is enabled. Transaction: type: object properties: @@ -22801,6 +23207,70 @@ components: type: array items: "$ref": "#/components/schemas/ExternalProduct" + ExternalAccountList: + type: object + properties: + object: + type: string + title: Object type + description: Will always be List. + has_more: + type: boolean + description: Indicates there are more results on subsequent pages. + next: + type: string + description: Path to subsequent page of results. + data: + type: array + items: + "$ref": "#/components/schemas/ExternalAccount" + ExternalAccountCreate: + type: object + properties: + external_account_code: + type: string + description: Represents the account code for the external account. + external_connection_type: + type: string + description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` + required: + - external_account_code + - external_connection_type + ExternalAccountUpdate: + type: object + properties: + external_account_code: + type: string + description: Represents the account code for the external account. + external_connection_type: + type: string + description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` + ExternalAccount: + type: object + title: External Account + properties: + object: + type: string + default: external_account + id: + type: string + description: UUID of the external_account . + external_account_code: + type: string + description: Represents the account code for the external account. + external_connection_type: + type: string + description: Represents the connection type. `AppleAppStore` or `GooglePlayStore` + created_at: + type: string + format: date-time + description: Created at + readOnly: true + updated_at: + type: string + format: date-time + description: Last updated at + readOnly: true ExternalProductReferenceMini: type: object title: External Product Reference details @@ -22918,6 +23388,110 @@ components: type: array items: "$ref": "#/components/schemas/ExternalSubscription" + ExternalInvoice: + type: object + description: Invoice from an external resource such as Apple App Store or Google + Play Store. + properties: + id: + type: string + title: External invoice ID + description: System-generated unique identifier for an external invoice + ID, e.g. `e28zov4fw0v2`. + object: + type: string + title: Object type + account: + "$ref": "#/components/schemas/AccountMini" + external_subscription: + "$ref": "#/components/schemas/ExternalSubscription" + external_id: + type: string + description: An identifier which associates the external invoice to a corresponding + object in an external platform. + state: + "$ref": "#/components/schemas/ExternalInvoiceStateEnum" + total: + type: string + format: decimal + title: Total + currency: + type: string + title: Currency + description: 3-letter ISO 4217 currency code. + line_items: + type: array + items: + "$ref": "#/components/schemas/ExternalCharge" + purchased_at: + type: string + format: date-time + description: When the invoice was created in the external platform. + created_at: + type: string + format: date-time + description: When the external invoice was created in Recurly. + updated_at: + type: string + format: date-time + title: Updated at + description: When the external invoice was updated in Recurly. + ExternalInvoiceList: + type: object + properties: + object: + type: string + title: Object type + description: Will always be List. + has_more: + type: boolean + description: Indicates there are more results on subsequent pages. + next: + type: string + description: Path to subsequent page of results. + data: + type: array + items: + "$ref": "#/components/schemas/ExternalInvoice" + ExternalCharge: + type: object + description: Charge from an external resource such as Apple App Store or Google + Play Store. + properties: + id: + type: string + title: External invoice ID + description: System-generated unique identifier for an external charge ID, + e.g. `e28zov4fw0v2`. + object: + type: string + title: Object type + account: + "$ref": "#/components/schemas/AccountMini" + currency: + type: string + title: Currency + description: 3-letter ISO 4217 currency code. + unit_amount: + type: string + format: decimal + title: Unit Amount + quantity: + type: integer + description: + type: string + external_product_reference: + "$ref": "#/components/schemas/ExternalProductReferenceMini" + created_at: + type: string + format: date-time + title: Created at + description: When the external charge was created in Recurly. + updated_at: + type: string + format: date-time + title: Updated at + description: When the external charge was updated in Recurly. CustomerPermission: type: object properties: @@ -23500,7 +24074,9 @@ components: - es-MX - es-US - fi-FI + - fr-BE - fr-CA + - fr-CH - fr-FR - hi-IN - it-IT @@ -24276,3 +24852,7 @@ components: enum: - ideal - sofort + ExternalInvoiceStateEnum: + type: string + enum: + - paid