Skip to content

Commit

Permalink
6.7.5 Return optional pixAdditionalInformation (#20)
Browse files Browse the repository at this point in the history
Co-authored-by: Unknown <[email protected]>
  • Loading branch information
magnomoreira and samuelleitemundipagg authored Mar 16, 2023
1 parent ce9e5be commit 552ca1c
Show file tree
Hide file tree
Showing 7 changed files with 155 additions and 76 deletions.
2 changes: 0 additions & 2 deletions doc/controllers/charges.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,13 @@ $request_boleto_billingAddress = new Models\CreateAddressRequest(
$request_boleto_billingAddress_line1,
$request_boleto_billingAddress_line2
);
$request_boleto_billingAddressId = 'billing_address_id2';
$request_boleto_documentNumber = 'document_number0';
$request_boleto_statementDescriptor = 'statement_descriptor6';
$request_boleto = new Models\CreateBoletoPaymentRequest(
$request_boleto_retries,
$request_boleto_bank,
$request_boleto_instructions,
$request_boleto_billingAddress,
$request_boleto_billingAddressId,
$request_boleto_documentNumber,
$request_boleto_statementDescriptor
);
Expand Down
4 changes: 2 additions & 2 deletions doc/models/create-boleto-payment-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Contains the settings for creating a boleto payment
| `instructions` | `string` | Required | The instructions field that will be printed on the boleto. | getInstructions(): string | setInstructions(string instructions): void |
| `dueAt` | `?\DateTime` | Optional | Boleto due date | getDueAt(): ?\DateTime | setDueAt(?\DateTime dueAt): void |
| `billingAddress` | [`CreateAddressRequest`](../../doc/models/create-address-request.md) | Required | Card's billing address | getBillingAddress(): CreateAddressRequest | setBillingAddress(CreateAddressRequest billingAddress): void |
| `billingAddressId` | `string` | Required | The address id for the billing address | getBillingAddressId(): string | setBillingAddressId(string billingAddressId): void |
| `billingAddressId` | `?string` | Optional | The address id for the billing address | getBillingAddressId(): ?string | setBillingAddressId(?string billingAddressId): void |
| `nossoNumero` | `?string` | Optional | Customer identification number with the bank | getNossoNumero(): ?string | setNossoNumero(?string nossoNumero): void |
| `documentNumber` | `string` | Required | Boleto identification | getDocumentNumber(): string | setDocumentNumber(string documentNumber): void |
| `statementDescriptor` | `string` | Required | Soft Descriptor | getStatementDescriptor(): string | setStatementDescriptor(string statementDescriptor): void |
Expand Down Expand Up @@ -48,7 +48,7 @@ Contains the settings for creating a boleto payment
"line_1": "line_18",
"line_2": "line_26"
},
"billing_address_id": "billing_address_id6",
"billing_address_id": null,
"nosso_numero": null,
"document_number": "document_number6",
"statement_descriptor": "statement_descriptor0",
Expand Down
8 changes: 4 additions & 4 deletions doc/models/pix-additional-information.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ Pix Additional Information

| Name | Type | Tags | Description | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `name` | `string` | Required | - | getName(): string | setName(string name): void |
| `value` | `string` | Required | - | getValue(): string | setValue(string value): void |
| `name` | `?string` | Optional | - | getName(): ?string | setName(?string name): void |
| `value` | `?string` | Optional | - | getValue(): ?string | setValue(?string value): void |

## Example (as JSON)

```json
{
"Name": "Name0",
"Value": "Value2"
"Name": null,
"Value": null
}
```

2 changes: 1 addition & 1 deletion doc/models/update-charge-payment-method-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Request for updating the payment method of a charge
"line_1": "line_18",
"line_2": "line_26"
},
"billing_address_id": "billing_address_id6",
"billing_address_id": null,
"nosso_numero": null,
"document_number": "document_number6",
"statement_descriptor": "statement_descriptor0",
Expand Down
149 changes: 108 additions & 41 deletions src/Models/CreateBoletoPaymentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,24 +34,24 @@ class CreateBoletoPaymentRequest implements \JsonSerializable
private $instructions;

/**
* @var \DateTime|null
* @var array
*/
private $dueAt;
private $dueAt = [];

/**
* @var CreateAddressRequest
*/
private $billingAddress;

/**
* @var string
* @var array
*/
private $billingAddressId;
private $billingAddressId = [];

/**
* @var string|null
* @var array
*/
private $nossoNumero;
private $nossoNumero = [];

/**
* @var string
Expand All @@ -64,26 +64,25 @@ class CreateBoletoPaymentRequest implements \JsonSerializable
private $statementDescriptor;

/**
* @var CreateInterestRequest|null
* @var array
*/
private $interest;
private $interest = [];

/**
* @var CreateFineRequest|null
* @var array
*/
private $fine;
private $fine = [];

/**
* @var int|null
* @var array
*/
private $maxDaysToPayPastDue;
private $maxDaysToPayPastDue = [];

/**
* @param int $retries
* @param string $bank
* @param string $instructions
* @param CreateAddressRequest $billingAddress
* @param string $billingAddressId
* @param string $documentNumber
* @param string $statementDescriptor
*/
Expand All @@ -92,15 +91,13 @@ public function __construct(
string $bank,
string $instructions,
CreateAddressRequest $billingAddress,
string $billingAddressId,
string $documentNumber,
string $statementDescriptor
) {
$this->retries = $retries;
$this->bank = $bank;
$this->instructions = $instructions;
$this->billingAddress = $billingAddress;
$this->billingAddressId = $billingAddressId;
$this->documentNumber = $documentNumber;
$this->statementDescriptor = $statementDescriptor;
}
Expand Down Expand Up @@ -174,7 +171,10 @@ public function setInstructions(string $instructions): void
*/
public function getDueAt(): ?\DateTime
{
return $this->dueAt;
if (count($this->dueAt) == 0) {
return null;
}
return $this->dueAt['value'];
}

/**
Expand All @@ -186,7 +186,16 @@ public function getDueAt(): ?\DateTime
*/
public function setDueAt(?\DateTime $dueAt): void
{
$this->dueAt = $dueAt;
$this->dueAt['value'] = $dueAt;
}

/**
* Unsets Due At.
* Boleto due date
*/
public function unsetDueAt(): void
{
$this->dueAt = [];
}

/**
Expand Down Expand Up @@ -214,21 +223,32 @@ public function setBillingAddress(CreateAddressRequest $billingAddress): void
* Returns Billing Address Id.
* The address id for the billing address
*/
public function getBillingAddressId(): string
public function getBillingAddressId(): ?string
{
return $this->billingAddressId;
if (count($this->billingAddressId) == 0) {
return null;
}
return $this->billingAddressId['value'];
}

/**
* Sets Billing Address Id.
* The address id for the billing address
*
* @required
* @maps billing_address_id
*/
public function setBillingAddressId(string $billingAddressId): void
public function setBillingAddressId(?string $billingAddressId): void
{
$this->billingAddressId = $billingAddressId;
$this->billingAddressId['value'] = $billingAddressId;
}

/**
* Unsets Billing Address Id.
* The address id for the billing address
*/
public function unsetBillingAddressId(): void
{
$this->billingAddressId = [];
}

/**
Expand All @@ -237,7 +257,10 @@ public function setBillingAddressId(string $billingAddressId): void
*/
public function getNossoNumero(): ?string
{
return $this->nossoNumero;
if (count($this->nossoNumero) == 0) {
return null;
}
return $this->nossoNumero['value'];
}

/**
Expand All @@ -248,7 +271,16 @@ public function getNossoNumero(): ?string
*/
public function setNossoNumero(?string $nossoNumero): void
{
$this->nossoNumero = $nossoNumero;
$this->nossoNumero['value'] = $nossoNumero;
}

/**
* Unsets Nosso Numero.
* Customer identification number with the bank
*/
public function unsetNossoNumero(): void
{
$this->nossoNumero = [];
}

/**
Expand Down Expand Up @@ -298,7 +330,10 @@ public function setStatementDescriptor(string $statementDescriptor): void
*/
public function getInterest(): ?CreateInterestRequest
{
return $this->interest;
if (count($this->interest) == 0) {
return null;
}
return $this->interest['value'];
}

/**
Expand All @@ -308,15 +343,26 @@ public function getInterest(): ?CreateInterestRequest
*/
public function setInterest(?CreateInterestRequest $interest): void
{
$this->interest = $interest;
$this->interest['value'] = $interest;
}

/**
* Unsets Interest.
*/
public function unsetInterest(): void
{
$this->interest = [];
}

/**
* Returns Fine.
*/
public function getFine(): ?CreateFineRequest
{
return $this->fine;
if (count($this->fine) == 0) {
return null;
}
return $this->fine['value'];
}

/**
Expand All @@ -326,15 +372,26 @@ public function getFine(): ?CreateFineRequest
*/
public function setFine(?CreateFineRequest $fine): void
{
$this->fine = $fine;
$this->fine['value'] = $fine;
}

/**
* Unsets Fine.
*/
public function unsetFine(): void
{
$this->fine = [];
}

/**
* Returns Max Days to Pay Past Due.
*/
public function getMaxDaysToPayPastDue(): ?int
{
return $this->maxDaysToPayPastDue;
if (count($this->maxDaysToPayPastDue) == 0) {
return null;
}
return $this->maxDaysToPayPastDue['value'];
}

/**
Expand All @@ -344,7 +401,15 @@ public function getMaxDaysToPayPastDue(): ?int
*/
public function setMaxDaysToPayPastDue(?int $maxDaysToPayPastDue): void
{
$this->maxDaysToPayPastDue = $maxDaysToPayPastDue;
$this->maxDaysToPayPastDue['value'] = $maxDaysToPayPastDue;
}

/**
* Unsets Max Days to Pay Past Due.
*/
public function unsetMaxDaysToPayPastDue(): void
{
$this->maxDaysToPayPastDue = [];
}

/**
Expand All @@ -362,24 +427,26 @@ public function jsonSerialize(bool $asArrayWhenEmpty = false)
$json['retries'] = $this->retries;
$json['bank'] = $this->bank;
$json['instructions'] = $this->instructions;
if (isset($this->dueAt)) {
$json['due_at'] = DateTimeHelper::toRfc3339DateTime($this->dueAt);
if (!empty($this->dueAt)) {
$json['due_at'] = DateTimeHelper::toRfc3339DateTime($this->dueAt['value']);
}
$json['billing_address'] = $this->billingAddress;
$json['billing_address_id'] = $this->billingAddressId;
if (isset($this->nossoNumero)) {
$json['nosso_numero'] = $this->nossoNumero;
if (!empty($this->billingAddressId)) {
$json['billing_address_id'] = $this->billingAddressId['value'];
}
if (!empty($this->nossoNumero)) {
$json['nosso_numero'] = $this->nossoNumero['value'];
}
$json['document_number'] = $this->documentNumber;
$json['statement_descriptor'] = $this->statementDescriptor;
if (isset($this->interest)) {
$json['interest'] = $this->interest;
if (!empty($this->interest)) {
$json['interest'] = $this->interest['value'];
}
if (isset($this->fine)) {
$json['fine'] = $this->fine;
if (!empty($this->fine)) {
$json['fine'] = $this->fine['value'];
}
if (isset($this->maxDaysToPayPastDue)) {
$json['max_days_to_pay_past_due'] = $this->maxDaysToPayPastDue;
if (!empty($this->maxDaysToPayPastDue)) {
$json['max_days_to_pay_past_due'] = $this->maxDaysToPayPastDue['value'];
}

return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
Expand Down
Loading

0 comments on commit 552ca1c

Please sign in to comment.