From 8d5539cd427001d1994659c61d9c846089b411c0 Mon Sep 17 00:00:00 2001 From: Robson Junior Date: Wed, 21 Dec 2022 14:56:40 -0300 Subject: [PATCH] 6.7.0 - Boleto no request e response de Subscription (#13) Co-authored-by: Unknown --- .../create-subscription-boleto-request.md | 27 ++++ doc/models/create-subscription-request.md | 1 + doc/models/get-invoice-response.md | 24 ++-- doc/models/get-period-response.md | 24 ++-- .../get-subscription-boleto-response.md | 35 +++++ doc/models/get-subscription-item-response.md | 9 +- doc/models/get-subscription-response.md | 19 ++- doc/models/get-usage-response.md | 12 +- doc/models/list-invoices-response.md | 48 ++++--- .../list-subscription-items-response.md | 21 ++- doc/models/list-subscriptions-response.md | 54 +++++--- doc/models/list-usages-response.md | 15 +- ...ate-subscription-payment-method-request.md | 1 + .../CreateSubscriptionBoletoRequest.php | 124 +++++++++++++++++ src/Models/CreateSubscriptionRequest.php | 28 ++++ src/Models/GetSubscriptionBoletoResponse.php | 128 ++++++++++++++++++ src/Models/GetSubscriptionResponse.php | 26 ++++ ...UpdateSubscriptionPaymentMethodRequest.php | 28 ++++ src/PagarmeApiSDKClient.php | 2 +- 19 files changed, 550 insertions(+), 76 deletions(-) create mode 100644 doc/models/create-subscription-boleto-request.md create mode 100644 doc/models/get-subscription-boleto-response.md create mode 100644 src/Models/CreateSubscriptionBoletoRequest.php create mode 100644 src/Models/GetSubscriptionBoletoResponse.php diff --git a/doc/models/create-subscription-boleto-request.md b/doc/models/create-subscription-boleto-request.md new file mode 100644 index 0000000..ca1de5e --- /dev/null +++ b/doc/models/create-subscription-boleto-request.md @@ -0,0 +1,27 @@ + +# Create Subscription Boleto Request + +Information about fines and interest on the "boleto" used from payment + +## Structure + +`CreateSubscriptionBoletoRequest` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `interest` | [`?CreateInterestRequest`](../../doc/models/create-interest-request.md) | Optional | - | getInterest(): ?CreateInterestRequest | setInterest(?CreateInterestRequest interest): void | +| `fine` | [`?CreateFineRequest`](../../doc/models/create-fine-request.md) | Optional | - | getFine(): ?CreateFineRequest | setFine(?CreateFineRequest fine): void | +| `maxDaysToPayPastDue` | `?int` | Optional | - | getMaxDaysToPayPastDue(): ?int | setMaxDaysToPayPastDue(?int maxDaysToPayPastDue): void | + +## Example (as JSON) + +```json +{ + "interest": null, + "fine": null, + "max_days_to_pay_past_due": null +} +``` + diff --git a/doc/models/create-subscription-request.md b/doc/models/create-subscription-request.md index ea34e14..f95953a 100644 --- a/doc/models/create-subscription-request.md +++ b/doc/models/create-subscription-request.md @@ -43,6 +43,7 @@ Request for creating a subcription | `period` | [`?CreatePeriodRequest`](../../doc/models/create-period-request.md) | Optional | - | getPeriod(): ?CreatePeriodRequest | setPeriod(?CreatePeriodRequest period): void | | `submerchant` | [`?CreateSubMerchantRequest`](../../doc/models/create-sub-merchant-request.md) | Optional | SubMerchant | getSubmerchant(): ?CreateSubMerchantRequest | setSubmerchant(?CreateSubMerchantRequest submerchant): void | | `split` | [`?CreateSubscriptionSplitRequest`](../../doc/models/create-subscription-split-request.md) | Optional | Subscription's split | getSplit(): ?CreateSubscriptionSplitRequest | setSplit(?CreateSubscriptionSplitRequest split): void | +| `boleto` | [`?CreateSubscriptionBoletoRequest`](../../doc/models/create-subscription-boleto-request.md) | Optional | Information about fines and interest on the "boleto" used from payment | getBoleto(): ?CreateSubscriptionBoletoRequest | setBoleto(?CreateSubscriptionBoletoRequest boleto): void | ## Example (as JSON) diff --git a/doc/models/get-invoice-response.md b/doc/models/get-invoice-response.md index 6a481b4..d9eec42 100644 --- a/doc/models/get-invoice-response.md +++ b/doc/models/get-invoice-response.md @@ -526,7 +526,8 @@ Response object for getting an invoice "id": "id1" } ] - } + }, + "boleto": null }, "name": "name4", "quantity": null, @@ -704,7 +705,8 @@ Response object for getting an invoice "id": "id9" } ] - } + }, + "boleto": null }, "name": "name5", "quantity": null, @@ -765,7 +767,8 @@ Response object for getting an invoice "id": "id8" } ] - } + }, + "boleto": null }, "name": "name1", "quantity": null, @@ -1052,7 +1055,8 @@ Response object for getting an invoice "id": "id9" } ] - } + }, + "boleto": null }, "name": "name5", "quantity": null, @@ -1276,7 +1280,8 @@ Response object for getting an invoice "id": "id0" } ] - } + }, + "boleto": null }, "name": "name6", "quantity": null, @@ -1468,7 +1473,8 @@ Response object for getting an invoice "id": "id8" } ] - } + }, + "boleto": null }, "name": "name7", "quantity": null, @@ -1560,7 +1566,8 @@ Response object for getting an invoice "id": "id0" } ] - } + }, + "boleto": null }, "name": "name2", "quantity": null, @@ -1621,7 +1628,8 @@ Response object for getting an invoice "id": "id5" } ] - } + }, + "boleto": null }, "cycle": null, "shipping": { diff --git a/doc/models/get-period-response.md b/doc/models/get-period-response.md index be4c502..480eace 100644 --- a/doc/models/get-period-response.md +++ b/doc/models/get-period-response.md @@ -396,7 +396,8 @@ Response object for getting a period "id": "id1" } ] - } + }, + "boleto": null }, "name": "name4", "quantity": null, @@ -574,7 +575,8 @@ Response object for getting a period "id": "id9" } ] - } + }, + "boleto": null }, "name": "name5", "quantity": null, @@ -635,7 +637,8 @@ Response object for getting a period "id": "id8" } ] - } + }, + "boleto": null }, "name": "name1", "quantity": null, @@ -922,7 +925,8 @@ Response object for getting a period "id": "id9" } ] - } + }, + "boleto": null }, "name": "name5", "quantity": null, @@ -1146,7 +1150,8 @@ Response object for getting a period "id": "id0" } ] - } + }, + "boleto": null }, "name": "name6", "quantity": null, @@ -1338,7 +1343,8 @@ Response object for getting a period "id": "id8" } ] - } + }, + "boleto": null }, "name": "name7", "quantity": null, @@ -1430,7 +1436,8 @@ Response object for getting a period "id": "id0" } ] - } + }, + "boleto": null }, "name": "name2", "quantity": null, @@ -1491,7 +1498,8 @@ Response object for getting a period "id": "id5" } ] - } + }, + "boleto": null }, "status": "status8", "duration": 112, diff --git a/doc/models/get-subscription-boleto-response.md b/doc/models/get-subscription-boleto-response.md new file mode 100644 index 0000000..b1b1fbb --- /dev/null +++ b/doc/models/get-subscription-boleto-response.md @@ -0,0 +1,35 @@ + +# Get Subscription Boleto Response + +Response object for getting a boleto + +## Structure + +`GetSubscriptionBoletoResponse` + +## Fields + +| Name | Type | Tags | Description | Getter | Setter | +| --- | --- | --- | --- | --- | --- | +| `interest` | [`?GetInterestResponse`](../../doc/models/get-interest-response.md) | Optional | Interest | getInterest(): ?GetInterestResponse | setInterest(?GetInterestResponse interest): void | +| `fine` | [`?GetFineResponse`](../../doc/models/get-fine-response.md) | Optional | Fine | getFine(): ?GetFineResponse | setFine(?GetFineResponse fine): void | +| `maxDaysToPayPastDue` | `?int` | Optional | - | getMaxDaysToPayPastDue(): ?int | setMaxDaysToPayPastDue(?int maxDaysToPayPastDue): void | + +## Example (as JSON) + +```json +{ + "interest": { + "days": 2, + "type": "percentage", + "amount": 20 + }, + "fine": { + "days": 2, + "type": "flat", + "amount": 10 + }, + "max_days_to_pay_past_due": 2 +} +``` + diff --git a/doc/models/get-subscription-item-response.md b/doc/models/get-subscription-item-response.md index 77b469f..33f1cbc 100644 --- a/doc/models/get-subscription-item-response.md +++ b/doc/models/get-subscription-item-response.md @@ -507,7 +507,8 @@ "id": "id8" } ] - } + }, + "boleto": null }, "name": "name1", "quantity": null, @@ -960,7 +961,8 @@ "id": "id0" } ] - } + }, + "boleto": null }, "name": "name2", "quantity": null, @@ -1021,7 +1023,8 @@ "id": "id5" } ] - } + }, + "boleto": null }, "name": "name0", "quantity": null, diff --git a/doc/models/get-subscription-response.md b/doc/models/get-subscription-response.md index b45c276..0f83072 100644 --- a/doc/models/get-subscription-response.md +++ b/doc/models/get-subscription-response.md @@ -37,6 +37,7 @@ | `increments` | [`GetIncrementResponse[]`](../../doc/models/get-increment-response.md) | Required | Subscription increments | getIncrements(): array | setIncrements(array increments): void | | `boletoDueDays` | `?int` | Optional | Days until boleto expires | getBoletoDueDays(): ?int | setBoletoDueDays(?int boletoDueDays): void | | `split` | [`GetSubscriptionSplitResponse`](../../doc/models/get-subscription-split-response.md) | Required | Subscription's split response | getSplit(): GetSubscriptionSplitResponse | setSplit(GetSubscriptionSplitResponse split): void | +| `boleto` | [`?GetSubscriptionBoletoResponse`](../../doc/models/get-subscription-boleto-response.md) | Optional | - | getBoleto(): ?GetSubscriptionBoletoResponse | setBoleto(?GetSubscriptionBoletoResponse boleto): void | ## Example (as JSON) @@ -407,7 +408,8 @@ "id": "id7" } ] - } + }, + "boleto": null }, "name": "name4", "quantity": null, @@ -607,7 +609,8 @@ "id": "id9" } ] - } + }, + "boleto": null }, "name": "name5", "quantity": null, @@ -668,7 +671,8 @@ "id": "id8" } ] - } + }, + "boleto": null }, "name": "name7", "quantity": null, @@ -1026,7 +1030,8 @@ "id": "id9" } ] - } + }, + "boleto": null }, "name": "name3", "quantity": null, @@ -1101,7 +1106,8 @@ "id": "id6" } ] - } + }, + "boleto": null }, "name": "name8", "quantity": null, @@ -1162,7 +1168,8 @@ "id": "id7" } ] - } + }, + "boleto": null } ``` diff --git a/doc/models/get-usage-response.md b/doc/models/get-usage-response.md index 75b382d..3cc5f6e 100644 --- a/doc/models/get-usage-response.md +++ b/doc/models/get-usage-response.md @@ -600,7 +600,8 @@ Response object for getting a usage "id": "id3" } ] - } + }, + "boleto": null }, "name": "name5", "quantity": null, @@ -893,7 +894,8 @@ Response object for getting a usage "id": "id2" } ] - } + }, + "boleto": null }, "name": "name6", "quantity": null, @@ -1248,7 +1250,8 @@ Response object for getting a usage "id": "id4" } ] - } + }, + "boleto": null }, "name": "name7", "quantity": null, @@ -1328,7 +1331,8 @@ Response object for getting a usage "id": "id0" } ] - } + }, + "boleto": null }, "name": "name6", "quantity": null, diff --git a/doc/models/list-invoices-response.md b/doc/models/list-invoices-response.md index d315b83..25783d5 100644 --- a/doc/models/list-invoices-response.md +++ b/doc/models/list-invoices-response.md @@ -501,7 +501,8 @@ Response object for listing invoices "id": "id2" } ] - } + }, + "boleto": null }, "name": "name3", "quantity": null, @@ -691,7 +692,8 @@ Response object for listing invoices "id": "id0" } ] - } + }, + "boleto": null }, "name": "name4", "quantity": null, @@ -752,7 +754,8 @@ Response object for listing invoices "id": "id3" } ] - } + }, + "boleto": null }, "name": "name8", "quantity": null, @@ -1073,7 +1076,8 @@ Response object for listing invoices "id": "id4" } ] - } + }, + "boleto": null }, "name": "name2", "quantity": null, @@ -1136,7 +1140,8 @@ Response object for listing invoices "id": "id5" } ] - } + }, + "boleto": null }, "name": "name9", "quantity": null, @@ -1197,7 +1202,8 @@ Response object for listing invoices "id": "id2" } ] - } + }, + "boleto": null }, "cycle": null, "shipping": { @@ -1754,7 +1760,8 @@ Response object for listing invoices "id": "id4" } ] - } + }, + "boleto": null }, "name": "name2", "quantity": null, @@ -1817,7 +1824,8 @@ Response object for listing invoices "id": "id5" } ] - } + }, + "boleto": null }, "name": "name9", "quantity": null, @@ -2146,7 +2154,8 @@ Response object for listing invoices "id": "id3" } ] - } + }, + "boleto": null }, "name": "name1", "quantity": null, @@ -2357,7 +2366,8 @@ Response object for listing invoices "id": "id4" } ] - } + }, + "boleto": null }, "name": "name2", "quantity": null, @@ -2550,7 +2560,8 @@ Response object for listing invoices "id": "id2" } ] - } + }, + "boleto": null }, "name": "name3", "quantity": null, @@ -2642,7 +2653,8 @@ Response object for listing invoices "id": "id4" } ] - } + }, + "boleto": null }, "name": "name0", "quantity": null, @@ -2967,7 +2979,8 @@ Response object for listing invoices "id": "id5" } ] - } + }, + "boleto": null }, "name": "name0", "quantity": null, @@ -3157,7 +3170,8 @@ Response object for listing invoices "id": "id3" } ] - } + }, + "boleto": null }, "name": "name1", "quantity": null, @@ -3218,7 +3232,8 @@ Response object for listing invoices "id": "id6" } ] - } + }, + "boleto": null }, "name": "name1", "quantity": null, @@ -3298,7 +3313,8 @@ Response object for listing invoices "id": "id4" } ] - } + }, + "boleto": null }, "cycle": null, "shipping": { diff --git a/doc/models/list-subscription-items-response.md b/doc/models/list-subscription-items-response.md index ee6fea4..7d61e8f 100644 --- a/doc/models/list-subscription-items-response.md +++ b/doc/models/list-subscription-items-response.md @@ -500,7 +500,8 @@ Response model for listing subscription items "id": "id3" } ] - } + }, + "boleto": null }, "name": "name8", "quantity": null, @@ -763,7 +764,8 @@ Response model for listing subscription items "id": "id5" } ] - } + }, + "boleto": null }, "name": "name9", "quantity": null, @@ -824,7 +826,8 @@ Response model for listing subscription items "id": "id2" } ] - } + }, + "boleto": null }, "name": "name5", "quantity": null, @@ -1195,7 +1198,8 @@ Response model for listing subscription items "id": "id5" } ] - } + }, + "boleto": null }, "name": "name9", "quantity": null, @@ -1678,7 +1682,8 @@ Response model for listing subscription items "id": "id4" } ] - } + }, + "boleto": null }, "name": "name0", "quantity": null, @@ -2033,7 +2038,8 @@ Response model for listing subscription items "id": "id6" } ] - } + }, + "boleto": null }, "name": "name1", "quantity": null, @@ -2113,7 +2119,8 @@ Response model for listing subscription items "id": "id4" } ] - } + }, + "boleto": null }, "name": "name6", "quantity": null, diff --git a/doc/models/list-subscriptions-response.md b/doc/models/list-subscriptions-response.md index 1c0b81b..5ae808c 100644 --- a/doc/models/list-subscriptions-response.md +++ b/doc/models/list-subscriptions-response.md @@ -387,7 +387,8 @@ Response object for listing subscriptions "id": "id2" } ] - } + }, + "boleto": null }, "name": "name5", "quantity": null, @@ -587,7 +588,8 @@ Response object for listing subscriptions "id": "id4" } ] - } + }, + "boleto": null }, "name": "name6", "quantity": null, @@ -648,7 +650,8 @@ Response object for listing subscriptions "id": "id9" } ] - } + }, + "boleto": null }, "name": "name2", "quantity": null, @@ -956,7 +959,8 @@ Response object for listing subscriptions "id": "id4" } ] - } + }, + "boleto": null }, "name": "name6", "quantity": null, @@ -1158,7 +1162,8 @@ Response object for listing subscriptions "id": "id3" } ] - } + }, + "boleto": null }, "name": "name7", "quantity": null, @@ -1350,7 +1355,8 @@ Response object for listing subscriptions "id": "id5" } ] - } + }, + "boleto": null }, "name": "name8", "quantity": null, @@ -1430,7 +1436,8 @@ Response object for listing subscriptions "id": "id1" } ] - } + }, + "boleto": null }, "name": "name3", "quantity": null, @@ -1490,7 +1497,8 @@ Response object for listing subscriptions "id": "id6" } ] - } + }, + "boleto": null }, { "id": "id6", @@ -1841,7 +1849,8 @@ Response object for listing subscriptions "id": "id4" } ] - } + }, + "boleto": null }, "name": "name6", "quantity": null, @@ -2043,7 +2052,8 @@ Response object for listing subscriptions "id": "id3" } ] - } + }, + "boleto": null }, "name": "name7", "quantity": null, @@ -2235,7 +2245,8 @@ Response object for listing subscriptions "id": "id5" } ] - } + }, + "boleto": null }, "name": "name8", "quantity": null, @@ -2315,7 +2326,8 @@ Response object for listing subscriptions "id": "id1" } ] - } + }, + "boleto": null }, "name": "name3", "quantity": null, @@ -2657,7 +2669,8 @@ Response object for listing subscriptions "id": "id3" } ] - } + }, + "boleto": null }, "name": "name7", "quantity": null, @@ -2732,7 +2745,8 @@ Response object for listing subscriptions "id": "id0" } ] - } + }, + "boleto": null }, "name": "name4", "quantity": null, @@ -3057,7 +3071,8 @@ Response object for listing subscriptions "id": "id5" } ] - } + }, + "boleto": null }, "name": "name8", "quantity": null, @@ -3257,7 +3272,8 @@ Response object for listing subscriptions "id": "id7" } ] - } + }, + "boleto": null }, "name": "name9", "quantity": null, @@ -3318,7 +3334,8 @@ Response object for listing subscriptions "id": "id2" } ] - } + }, + "boleto": null }, "name": "name5", "quantity": null, @@ -3399,7 +3416,8 @@ Response object for listing subscriptions "id": "id8" } ] - } + }, + "boleto": null } ], "paging": { diff --git a/doc/models/list-usages-response.md b/doc/models/list-usages-response.md index 5acbe46..d1f4429 100644 --- a/doc/models/list-usages-response.md +++ b/doc/models/list-usages-response.md @@ -635,7 +635,8 @@ Response model for listing the usages from a subscription item "id": "id7" } ] - } + }, + "boleto": null }, "name": "name4", "quantity": null, @@ -710,7 +711,8 @@ Response model for listing the usages from a subscription item "id": "id7" } ] - } + }, + "boleto": null }, "name": "name1", "quantity": null, @@ -1230,7 +1232,8 @@ Response model for listing the usages from a subscription item "id": "id5" } ] - } + }, + "boleto": null }, "name": "name5", "quantity": null, @@ -1481,7 +1484,8 @@ Response model for listing the usages from a subscription item "id": "id6" } ] - } + }, + "boleto": null }, "name": "name6", "quantity": null, @@ -1542,7 +1546,8 @@ Response model for listing the usages from a subscription item "id": "id9" } ] - } + }, + "boleto": null }, "name": "name2", "quantity": null, diff --git a/doc/models/update-subscription-payment-method-request.md b/doc/models/update-subscription-payment-method-request.md index d9f483e..7848b5a 100644 --- a/doc/models/update-subscription-payment-method-request.md +++ b/doc/models/update-subscription-payment-method-request.md @@ -15,6 +15,7 @@ Request for updating a subscription's payment method | `cardId` | `string` | Required | Card id | getCardId(): string | setCardId(string cardId): void | | `card` | [`CreateCardRequest`](../../doc/models/create-card-request.md) | Required | Card data | getCard(): CreateCardRequest | setCard(CreateCardRequest card): void | | `cardToken` | `?string` | Optional | The Card Token | getCardToken(): ?string | setCardToken(?string cardToken): void | +| `boleto` | [`?CreateSubscriptionBoletoRequest`](../../doc/models/create-subscription-boleto-request.md) | Optional | Information about fines and interest on the "boleto" used from payment | getBoleto(): ?CreateSubscriptionBoletoRequest | setBoleto(?CreateSubscriptionBoletoRequest boleto): void | ## Example (as JSON) diff --git a/src/Models/CreateSubscriptionBoletoRequest.php b/src/Models/CreateSubscriptionBoletoRequest.php new file mode 100644 index 0000000..8926f28 --- /dev/null +++ b/src/Models/CreateSubscriptionBoletoRequest.php @@ -0,0 +1,124 @@ +interest; + } + + /** + * Sets Interest. + * + * @maps interest + */ + public function setInterest(?CreateInterestRequest $interest): void + { + $this->interest = $interest; + } + + /** + * Returns Fine. + */ + public function getFine(): ?CreateFineRequest + { + return $this->fine; + } + + /** + * Sets Fine. + * + * @maps fine + */ + public function setFine(?CreateFineRequest $fine): void + { + $this->fine = $fine; + } + + /** + * Returns Max Days to Pay Past Due. + */ + public function getMaxDaysToPayPastDue(): ?int + { + if (count($this->maxDaysToPayPastDue) == 0) { + return null; + } + return $this->maxDaysToPayPastDue['value']; + } + + /** + * Sets Max Days to Pay Past Due. + * + * @maps max_days_to_pay_past_due + */ + public function setMaxDaysToPayPastDue(?int $maxDaysToPayPastDue): void + { + $this->maxDaysToPayPastDue['value'] = $maxDaysToPayPastDue; + } + + /** + * Unsets Max Days to Pay Past Due. + */ + public function unsetMaxDaysToPayPastDue(): void + { + $this->maxDaysToPayPastDue = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->interest)) { + $json['interest'] = $this->interest; + } + if (isset($this->fine)) { + $json['fine'] = $this->fine; + } + if (!empty($this->maxDaysToPayPastDue)) { + $json['max_days_to_pay_past_due'] = $this->maxDaysToPayPastDue['value']; + } + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/CreateSubscriptionRequest.php b/src/Models/CreateSubscriptionRequest.php index 4e4d5d5..78b07b9 100644 --- a/src/Models/CreateSubscriptionRequest.php +++ b/src/Models/CreateSubscriptionRequest.php @@ -178,6 +178,11 @@ class CreateSubscriptionRequest implements \JsonSerializable */ private $split; + /** + * @var CreateSubscriptionBoletoRequest|null + */ + private $boleto; + /** * @param CreateCustomerRequest $customer * @param CreateCardRequest $card @@ -907,6 +912,26 @@ public function setSplit(?CreateSubscriptionSplitRequest $split): void $this->split = $split; } + /** + * Returns Boleto. + * Information about fines and interest on the "boleto" used from payment + */ + public function getBoleto(): ?CreateSubscriptionBoletoRequest + { + return $this->boleto; + } + + /** + * Sets Boleto. + * Information about fines and interest on the "boleto" used from payment + * + * @maps boleto + */ + public function setBoleto(?CreateSubscriptionBoletoRequest $boleto): void + { + $this->boleto = $boleto; + } + /** * Encode this object to JSON * @@ -981,6 +1006,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->split)) { $json['split'] = $this->split; } + if (isset($this->boleto)) { + $json['boleto'] = $this->boleto; + } return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } diff --git a/src/Models/GetSubscriptionBoletoResponse.php b/src/Models/GetSubscriptionBoletoResponse.php new file mode 100644 index 0000000..f4907f8 --- /dev/null +++ b/src/Models/GetSubscriptionBoletoResponse.php @@ -0,0 +1,128 @@ +interest; + } + + /** + * Sets Interest. + * Interest + * + * @maps interest + */ + public function setInterest(?GetInterestResponse $interest): void + { + $this->interest = $interest; + } + + /** + * Returns Fine. + * Fine + */ + public function getFine(): ?GetFineResponse + { + return $this->fine; + } + + /** + * Sets Fine. + * Fine + * + * @maps fine + */ + public function setFine(?GetFineResponse $fine): void + { + $this->fine = $fine; + } + + /** + * Returns Max Days to Pay Past Due. + */ + public function getMaxDaysToPayPastDue(): ?int + { + if (count($this->maxDaysToPayPastDue) == 0) { + return null; + } + return $this->maxDaysToPayPastDue['value']; + } + + /** + * Sets Max Days to Pay Past Due. + * + * @maps max_days_to_pay_past_due + */ + public function setMaxDaysToPayPastDue(?int $maxDaysToPayPastDue): void + { + $this->maxDaysToPayPastDue['value'] = $maxDaysToPayPastDue; + } + + /** + * Unsets Max Days to Pay Past Due. + */ + public function unsetMaxDaysToPayPastDue(): void + { + $this->maxDaysToPayPastDue = []; + } + + /** + * Encode this object to JSON + * + * @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields + * are set. (default: false) + * + * @return array|stdClass + */ + #[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1) + public function jsonSerialize(bool $asArrayWhenEmpty = false) + { + $json = []; + if (isset($this->interest)) { + $json['interest'] = $this->interest; + } + if (isset($this->fine)) { + $json['fine'] = $this->fine; + } + if (!empty($this->maxDaysToPayPastDue)) { + $json['max_days_to_pay_past_due'] = $this->maxDaysToPayPastDue['value']; + } + + return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; + } +} diff --git a/src/Models/GetSubscriptionResponse.php b/src/Models/GetSubscriptionResponse.php index cece403..657e3f1 100644 --- a/src/Models/GetSubscriptionResponse.php +++ b/src/Models/GetSubscriptionResponse.php @@ -155,6 +155,11 @@ class GetSubscriptionResponse implements \JsonSerializable */ private $split; + /** + * @var GetSubscriptionBoletoResponse|null + */ + private $boleto; + /** * @param string $id * @param string $code @@ -776,6 +781,24 @@ public function setSplit(GetSubscriptionSplitResponse $split): void $this->split = $split; } + /** + * Returns Boleto. + */ + public function getBoleto(): ?GetSubscriptionBoletoResponse + { + return $this->boleto; + } + + /** + * Sets Boleto. + * + * @maps boleto + */ + public function setBoleto(?GetSubscriptionBoletoResponse $boleto): void + { + $this->boleto = $boleto; + } + /** * Encode this object to JSON * @@ -832,6 +855,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) $json['boleto_due_days'] = $this->boletoDueDays; } $json['split'] = $this->split; + if (isset($this->boleto)) { + $json['boleto'] = $this->boleto; + } return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } diff --git a/src/Models/UpdateSubscriptionPaymentMethodRequest.php b/src/Models/UpdateSubscriptionPaymentMethodRequest.php index 737dd88..9053f09 100644 --- a/src/Models/UpdateSubscriptionPaymentMethodRequest.php +++ b/src/Models/UpdateSubscriptionPaymentMethodRequest.php @@ -37,6 +37,11 @@ class UpdateSubscriptionPaymentMethodRequest implements \JsonSerializable */ private $cardToken; + /** + * @var CreateSubscriptionBoletoRequest|null + */ + private $boleto; + /** * @param string $paymentMethod * @param string $cardId @@ -132,6 +137,26 @@ public function setCardToken(?string $cardToken): void $this->cardToken = $cardToken; } + /** + * Returns Boleto. + * Information about fines and interest on the "boleto" used from payment + */ + public function getBoleto(): ?CreateSubscriptionBoletoRequest + { + return $this->boleto; + } + + /** + * Sets Boleto. + * Information about fines and interest on the "boleto" used from payment + * + * @maps boleto + */ + public function setBoleto(?CreateSubscriptionBoletoRequest $boleto): void + { + $this->boleto = $boleto; + } + /** * Encode this object to JSON * @@ -150,6 +175,9 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false) if (isset($this->cardToken)) { $json['card_token'] = $this->cardToken; } + if (isset($this->boleto)) { + $json['boleto'] = $this->boleto; + } return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json; } diff --git a/src/PagarmeApiSDKClient.php b/src/PagarmeApiSDKClient.php index b53b43e..5f5e27c 100644 --- a/src/PagarmeApiSDKClient.php +++ b/src/PagarmeApiSDKClient.php @@ -73,7 +73,7 @@ public function __construct(array $config = []) ->converter(new CompatibilityConverter()) ->jsonHelper(ApiHelper::getJsonHelper()) ->apiCallback($this->config['httpCallback'] ?? null) - ->userAgent('PagarmeCoreApi - PHP 6.6.0') + ->userAgent('PagarmeApiSDK - PHP 6.7.0') ->globalErrors($this->getGlobalErrors()) ->serverUrls(self::ENVIRONMENT_MAP[$this->getEnvironment()], Server::DEFAULT_) ->authManagers(['global' => $this->basicAuthManager])