Skip to content
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
64 changes: 64 additions & 0 deletions lib/recurly/client.php
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,38 @@ public function removeCouponRedemption(string $account_id, array $options = []):
return $this->makeRequest('DELETE', $path, [], $options);
}

/**
* Show the coupon redemption
*
* @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 $coupon_redemption_id Coupon Redemption ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`.
* @param array $options Associative array of optional parameters
*
* @return \Recurly\Resources\CouponRedemption A coupon redemption.
* @link https://developers.recurly.com/api/v2021-02-25#operation/get_coupon_redemption
*/
public function getCouponRedemption(string $account_id, string $coupon_redemption_id, array $options = []): \Recurly\Resources\CouponRedemption
{
$path = $this->interpolatePath("/accounts/{account_id}/coupon_redemptions/{coupon_redemption_id}", ['account_id' => $account_id, 'coupon_redemption_id' => $coupon_redemption_id]);
return $this->makeRequest('GET', $path, [], $options);
}

/**
* Delete the coupon redemption
*
* @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 $coupon_redemption_id Coupon Redemption ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`.
* @param array $options Associative array of optional parameters
*
* @return \Recurly\Resources\CouponRedemption Coupon redemption deleted.
* @link https://developers.recurly.com/api/v2021-02-25#operation/remove_coupon_redemption_by_id
*/
public function removeCouponRedemptionById(string $account_id, string $coupon_redemption_id, array $options = []): \Recurly\Resources\CouponRedemption
{
$path = $this->interpolatePath("/accounts/{account_id}/coupon_redemptions/{coupon_redemption_id}", ['account_id' => $account_id, 'coupon_redemption_id' => $coupon_redemption_id]);
return $this->makeRequest('DELETE', $path, [], $options);
}

/**
* List an account's credit payments
*
Expand Down Expand Up @@ -3196,6 +3228,38 @@ public function listSubscriptionCouponRedemptions(string $subscription_id, array
return new \Recurly\Pager($this, $path, $options);
}

/**
* Show the coupon redemption for a subscription
*
* @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`.
* @param string $coupon_redemption_id Coupon Redemption ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`.
* @param array $options Associative array of optional parameters
*
* @return \Recurly\Resources\CouponRedemption The coupon redemption on a subscription.
* @link https://developers.recurly.com/api/v2021-02-25#operation/get_subscription_coupon_redemption
*/
public function getSubscriptionCouponRedemption(string $subscription_id, string $coupon_redemption_id, array $options = []): \Recurly\Resources\CouponRedemption
{
$path = $this->interpolatePath("/subscriptions/{subscription_id}/coupon_redemptions/{coupon_redemption_id}", ['subscription_id' => $subscription_id, 'coupon_redemption_id' => $coupon_redemption_id]);
return $this->makeRequest('GET', $path, [], $options);
}

/**
* Delete the coupon redemption from a subscription
*
* @param string $subscription_id Subscription ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`.
* @param string $coupon_redemption_id Coupon Redemption ID or UUID. For ID no prefix is used e.g. `e28zov4fw0v2`. For UUID use prefix `uuid-`, e.g. `uuid-123457890`.
* @param array $options Associative array of optional parameters
*
* @return \Recurly\Resources\CouponRedemption Coupon redemption deleted.
* @link https://developers.recurly.com/api/v2021-02-25#operation/remove_subscription_coupon_redemption
*/
public function removeSubscriptionCouponRedemption(string $subscription_id, string $coupon_redemption_id, array $options = []): \Recurly\Resources\CouponRedemption
{
$path = $this->interpolatePath("/subscriptions/{subscription_id}/coupon_redemptions/{coupon_redemption_id}", ['subscription_id' => $subscription_id, 'coupon_redemption_id' => $coupon_redemption_id]);
return $this->makeRequest('DELETE', $path, [], $options);
}

/**
* List a subscription add-on's usage records
*
Expand Down
24 changes: 24 additions & 0 deletions lib/recurly/resources/coupon_redemption.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CouponRedemption extends RecurlyResource
private $_state;
private $_subscription_id;
private $_updated_at;
private $_uuid;

protected static $array_hints = [
];
Expand Down Expand Up @@ -280,4 +281,27 @@ public function setUpdatedAt(string $updated_at): void
{
$this->_updated_at = $updated_at;
}

/**
* Getter method for the uuid attribute.
* The UUID is useful for matching data with the CSV exports and building URLs into Recurly's UI.
*
* @return ?string
*/
public function getUuid(): ?string
{
return $this->_uuid;
}

/**
* Setter method for the uuid attribute.
*
* @param string $uuid
*
* @return void
*/
public function setUuid(string $uuid): void
{
$this->_uuid = $uuid;
}
}
28 changes: 28 additions & 0 deletions lib/recurly/resources/credit_application_policy.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,40 @@
// phpcs:disable
class CreditApplicationPolicy extends RecurlyResource
{
private $_allowed_origins;
private $_mode;

protected static $array_hints = [
'setAllowedOrigins' => 'string',
];


/**
* Getter method for the allowed_origins attribute.
* Optional array of credit invoice origin types to allow when mode is `all`.
If not specified when mode is `all`, credits from all origins are applied.
Only valid when mode is `all`.

*
* @return array
*/
public function getAllowedOrigins(): array
{
return $this->_allowed_origins ?? [] ;
}

/**
* Setter method for the allowed_origins attribute.
*
* @param array $allowed_origins
*
* @return void
*/
public function setAllowedOrigins(array $allowed_origins): void
{
$this->_allowed_origins = $allowed_origins;
}

/**
* Getter method for the mode attribute.
* Determines which credit invoices are applied to invoices:
Expand Down
25 changes: 25 additions & 0 deletions lib/recurly/resources/invoice_collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ class InvoiceCollection extends RecurlyResource
private $_charge_invoice;
private $_credit_invoices;
private $_object;
private $_verification_transactions;

protected static $array_hints = [
'setCreditInvoices' => '\Recurly\Resources\Invoice',
'setVerificationTransactions' => '\Recurly\Resources\Transaction',
];


Expand Down Expand Up @@ -89,4 +91,27 @@ public function setObject(string $object): void
{
$this->_object = $object;
}

/**
* Getter method for the verification_transactions attribute.
* Verification transactions (used for free trial payment method validation)
*
* @return array
*/
public function getVerificationTransactions(): array
{
return $this->_verification_transactions ?? [] ;
}

/**
* Setter method for the verification_transactions attribute.
*
* @param array $verification_transactions
*
* @return void
*/
public function setVerificationTransactions(array $verification_transactions): void
{
$this->_verification_transactions = $verification_transactions;
}
}
4 changes: 3 additions & 1 deletion lib/recurly/resources/subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,9 @@ public function setCreatedAt(string $created_at): void
/**
* Getter method for the credit_application_policy attribute.
* Controls whether credit invoices are automatically applied to new invoices.
The `mode` field determines the application behavior.
The `mode` field determines the application behavior. When mode is `all`,
the optional `allowed_origins` array can restrict which credit invoice origins
are applied.

*
* @return ?\Recurly\Resources\CreditApplicationPolicy
Expand Down
Loading