Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates #1255

Merged
merged 1 commit into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ class Event extends ApiResource
const SUBSCRIPTION_SCHEDULE_UPDATED = 'subscription_schedule.updated';
const TAX_RATE_CREATED = 'tax_rate.created';
const TAX_RATE_UPDATED = 'tax_rate.updated';
const TEST_HELPERS_TEST_CLOCK_ADVANCING = 'test_helpers.test_clock.advancing';
const TEST_HELPERS_TEST_CLOCK_CREATED = 'test_helpers.test_clock.created';
const TEST_HELPERS_TEST_CLOCK_DELETED = 'test_helpers.test_clock.deleted';
const TEST_HELPERS_TEST_CLOCK_INTERNAL_FAILURE = 'test_helpers.test_clock.internal_failure';
const TEST_HELPERS_TEST_CLOCK_READY = 'test_helpers.test_clock.ready';
const TOPUP_CANCELED = 'topup.canceled';
const TOPUP_CREATED = 'topup.created';
const TOPUP_FAILED = 'topup.failed';
Expand Down
17 changes: 17 additions & 0 deletions lib/Refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,21 @@ class Refund extends ApiResource
* @deprecated use FAILURE_REASON_EXPIRED_OR_CANCELED_CARD instead
*/
const FAILURE_REASON = 'expired_or_canceled_card';

/**
* @param null|array $params
* @param null|array|string $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Refund the canceled refund
*/
public function cancel($params = null, $opts = null)
{
$url = $this->instanceUrl() . '/cancel';
list($response, $opts) = $this->_request('post', $url, $params, $opts);
$this->refreshFrom($response, $opts);

return $this;
}
}
3 changes: 0 additions & 3 deletions lib/SKU.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@
*
* Can also be used to manage inventory.
*
* Related guide: <a href="https://stripe.com/docs/orders-legacy">Tax, Shipping,
* and Inventory</a>.
*
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property bool $active Whether the SKU is available for purchase.
Expand Down
19 changes: 19 additions & 0 deletions lib/Service/RefundService.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,25 @@ public function all($params = null, $opts = null)
return $this->requestCollection('get', '/v1/refunds', $params, $opts);
}

/**
* Cancels a refund with a status of <code>requires_action</code>.
*
* Refunds in other states cannot be canceled, and only refunds for payment methods
* that require customer action will enter the <code>requires_action</code> state.
*
* @param string $id
* @param null|array $params
* @param null|array|\Stripe\Util\RequestOptions $opts
*
* @throws \Stripe\Exception\ApiErrorException if the request fails
*
* @return \Stripe\Refund
*/
public function cancel($id, $params = null, $opts = null)
{
return $this->request('post', $this->buildPath('/v1/refunds/%s/cancel', $id), $params, $opts);
}

/**
* Create a refund.
*
Expand Down
5 changes: 4 additions & 1 deletion lib/TaxId.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property null|string|\Stripe\Customer $customer ID of the customer.
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property string $type Type of the tax ID, one of <code>ae_trn</code>, <code>au_abn</code>, <code>au_arn</code>, <code>br_cnpj</code>, <code>br_cpf</code>, <code>ca_bn</code>, <code>ca_gst_hst</code>, <code>ca_pst_bc</code>, <code>ca_pst_mb</code>, <code>ca_pst_sk</code>, <code>ca_qst</code>, <code>ch_vat</code>, <code>cl_tin</code>, <code>es_cif</code>, <code>eu_vat</code>, <code>gb_vat</code>, <code>ge_vat</code>, <code>hk_br</code>, <code>id_npwp</code>, <code>il_vat</code>, <code>in_gst</code>, <code>is_vat</code>, <code>jp_cn</code>, <code>jp_rn</code>, <code>kr_brn</code>, <code>li_uid</code>, <code>mx_rfc</code>, <code>my_frp</code>, <code>my_itn</code>, <code>my_sst</code>, <code>no_vat</code>, <code>nz_gst</code>, <code>ru_inn</code>, <code>ru_kpp</code>, <code>sa_vat</code>, <code>sg_gst</code>, <code>sg_uen</code>, <code>th_vat</code>, <code>tw_vat</code>, <code>ua_vat</code>, <code>us_ein</code>, or <code>za_vat</code>. Note that some legacy tax IDs have type <code>unknown</code>
* @property string $type Type of the tax ID, one of <code>ae_trn</code>, <code>au_abn</code>, <code>au_arn</code>, <code>bg_uic</code>, <code>br_cnpj</code>, <code>br_cpf</code>, <code>ca_bn</code>, <code>ca_gst_hst</code>, <code>ca_pst_bc</code>, <code>ca_pst_mb</code>, <code>ca_pst_sk</code>, <code>ca_qst</code>, <code>ch_vat</code>, <code>cl_tin</code>, <code>es_cif</code>, <code>eu_vat</code>, <code>gb_vat</code>, <code>ge_vat</code>, <code>hk_br</code>, <code>hu_tin</code>, <code>id_npwp</code>, <code>il_vat</code>, <code>in_gst</code>, <code>is_vat</code>, <code>jp_cn</code>, <code>jp_rn</code>, <code>kr_brn</code>, <code>li_uid</code>, <code>mx_rfc</code>, <code>my_frp</code>, <code>my_itn</code>, <code>my_sst</code>, <code>no_vat</code>, <code>nz_gst</code>, <code>ru_inn</code>, <code>ru_kpp</code>, <code>sa_vat</code>, <code>sg_gst</code>, <code>sg_uen</code>, <code>si_tin</code>, <code>th_vat</code>, <code>tw_vat</code>, <code>ua_vat</code>, <code>us_ein</code>, or <code>za_vat</code>. Note that some legacy tax IDs have type <code>unknown</code>
* @property string $value Value of the tax ID.
* @property null|\Stripe\StripeObject $verification Tax ID verification information.
*/
Expand All @@ -31,6 +31,7 @@ class TaxId extends ApiResource
const TYPE_AE_TRN = 'ae_trn';
const TYPE_AU_ABN = 'au_abn';
const TYPE_AU_ARN = 'au_arn';
const TYPE_BG_UIC = 'bg_uic';
const TYPE_BR_CNPJ = 'br_cnpj';
const TYPE_BR_CPF = 'br_cpf';
const TYPE_CA_BN = 'ca_bn';
Expand All @@ -46,6 +47,7 @@ class TaxId extends ApiResource
const TYPE_GB_VAT = 'gb_vat';
const TYPE_GE_VAT = 'ge_vat';
const TYPE_HK_BR = 'hk_br';
const TYPE_HU_TIN = 'hu_tin';
const TYPE_ID_NPWP = 'id_npwp';
const TYPE_IL_VAT = 'il_vat';
const TYPE_IN_GST = 'in_gst';
Expand All @@ -65,6 +67,7 @@ class TaxId extends ApiResource
const TYPE_SA_VAT = 'sa_vat';
const TYPE_SG_GST = 'sg_gst';
const TYPE_SG_UEN = 'sg_uen';
const TYPE_SI_TIN = 'si_tin';
const TYPE_TH_VAT = 'th_vat';
const TYPE_TW_VAT = 'tw_vat';
const TYPE_UA_VAT = 'ua_vat';
Expand Down