Skip to content

Commit

Permalink
Merge pull request #36 from pagarme/CodeGen-PHP
Browse files Browse the repository at this point in the history
Code gen php
  • Loading branch information
andreals authored Feb 19, 2024
2 parents 728d004 + 5a42793 commit b31a0a3
Show file tree
Hide file tree
Showing 77 changed files with 5,679 additions and 430 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ License:
The MIT License (MIT)
http://opensource.org/licenses/MIT

Copyright (c) 2014 - 2023 APIMATIC Limited
Copyright (c) 2014 - 2024 APIMATIC Limited

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
52 changes: 22 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ To run your project, right click on your PHP file inside your Test project and c

## Initialize the API Client

**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/client.md)
**_Note:_** Documentation for the client can be found [here.](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/client.md)

The following parameters are configurable for the API Client:

Expand All @@ -115,54 +115,46 @@ The following parameters are configurable for the API Client:
| `retryOnTimeout` | `bool` | Whether to retry on request timeout.<br>*Default*: `true` |
| `httpStatusCodesToRetry` | `array` | Http status codes to retry against.<br>*Default*: `408, 413, 429, 500, 502, 503, 504, 521, 522, 524` |
| `httpMethodsToRetry` | `array` | Http methods to retry against.<br>*Default*: `'GET', 'PUT'` |
| `basicAuthUserName` | `string` | The username to use with basic authentication |
| `basicAuthPassword` | `string` | The password to use with basic authentication |

The API client can be initialized as follows:

```php
$client = PagarmeApiSDKClientBuilder::init()
->basicAuthUserName('BasicAuthUserName')
->basicAuthPassword('BasicAuthPassword')
->serviceRefererName('ServiceRefererName')
->build();
```

## Authorization

This API uses `Basic Authentication`.

## API Errors

Here is the list of errors that the API might throw.

| HTTP Status Code | Error Description | Exception Class |
| --- | --- | --- |
| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) |
| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) |
| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) |
| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) |
| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) |
| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/models/error-exception.md) |
| 400 | Invalid request | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) |
| 401 | Invalid API key | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) |
| 404 | An informed resource was not found | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) |
| 412 | Business validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) |
| 422 | Contract validation error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) |
| 500 | Internal server error | [`ErrorException`](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/models/error-exception.md) |

## List of APIs

* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/subscriptions.md)
* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/orders.md)
* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/plans.md)
* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/invoices.md)
* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/customers.md)
* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/charges.md)
* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/recipients.md)
* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/tokens.md)
* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/transactions.md)
* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/transfers.md)
* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/payables.md)
* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/controllers/balance-operations.md)
* [Subscriptions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/subscriptions.md)
* [Orders](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/orders.md)
* [Plans](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/plans.md)
* [Invoices](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/invoices.md)
* [Customers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/customers.md)
* [Charges](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/charges.md)
* [Recipients](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/recipients.md)
* [Tokens](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/tokens.md)
* [Transactions](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/transactions.md)
* [Transfers](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/transfers.md)
* [Payables](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/payables.md)
* [Balance Operations](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/controllers/balance-operations.md)

## Classes Documentation

* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/api-exception.md)
* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/http-request.md)
* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.1/doc/http-response.md)
* [ApiException](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/api-exception.md)
* [HttpRequest](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/http-request.md)
* [HttpResponse](https://www.github.com/pagarme/pagarme-php-sdk/tree/6.8.5/doc/http-response.md)

4 changes: 0 additions & 4 deletions doc/client.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@ The following parameters are configurable for the API Client:
| `retryOnTimeout` | `bool` | Whether to retry on request timeout.<br>*Default*: `true` |
| `httpStatusCodesToRetry` | `array` | Http status codes to retry against.<br>*Default*: `408, 413, 429, 500, 502, 503, 504, 521, 522, 524` |
| `httpMethodsToRetry` | `array` | Http methods to retry against.<br>*Default*: `'GET', 'PUT'` |
| `basicAuthUserName` | `string` | The username to use with basic authentication |
| `basicAuthPassword` | `string` | The password to use with basic authentication |

The API client can be initialized as follows:

```php
$client = PagarmeApiSDKClientBuilder::init()
->basicAuthUserName('BasicAuthUserName')
->basicAuthPassword('BasicAuthPassword')
->serviceRefererName('ServiceRefererName')
->build();
```
Expand Down
4 changes: 2 additions & 2 deletions doc/controllers/customers.md
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ function getCustomers(
| --- | --- | --- | --- |
| `name` | `?string` | Query, Optional | Name of the Customer |
| `document` | `?string` | Query, Optional | Document of the Customer |
| `page` | `?int` | Query, Optional | Current page the the search<br>**Default**: `1` |
| `size` | `?int` | Query, Optional | Quantity pages of the search<br>**Default**: `10` |
| `page` | `?int` | Query, Optional | Current page the the search |
| `size` | `?int` | Query, Optional | Quantity pages of the search |
| `email` | `?string` | Query, Optional | Customer's email |
| `code` | `?string` | Query, Optional | Customer's code |

Expand Down
5 changes: 0 additions & 5 deletions doc/controllers/recipients.md
Original file line number Diff line number Diff line change
Expand Up @@ -736,11 +736,6 @@ function createRecipient(CreateRecipientRequest $request, ?string $idempotencyKe

```php
$request = CreateRecipientRequestBuilder::init(
'name6',
'email0',
'description6',
'document0',
'type4',
CreateBankAccountRequestBuilder::init(
'holder_name4',
'holder_type0',
Expand Down
4 changes: 0 additions & 4 deletions doc/controllers/tokens.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ $tokensController = $client->getTokensController();

# Create Token

:information_source: **Note** This endpoint does not require authentication.

```php
function createToken(
string $publicKey,
Expand Down Expand Up @@ -67,8 +65,6 @@ $result = $tokensController->createToken(

Gets a token from its id

:information_source: **Note** This endpoint does not require authentication.

```php
function getToken(string $id, string $publicKey): GetTokenResponse
```
Expand Down
56 changes: 56 additions & 0 deletions doc/models/create-managing-partner-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

# Create Managing Partner Request

Managing Partner Request

## Structure

`CreateManagingPartnerRequest`

## Fields

| Name | Type | Tags | Description | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `name` | `string` | Required | - | getName(): string | setName(string name): void |
| `email` | `string` | Required | - | getEmail(): string | setEmail(string email): void |
| `document` | `string` | Required | - | getDocument(): string | setDocument(string document): void |
| `motherName` | `string` | Required | - | getMotherName(): string | setMotherName(string motherName): void |
| `birthdate` | `string` | Required | - | getBirthdate(): string | setBirthdate(string birthdate): void |
| `monthlyIncome` | `int` | Required | - | getMonthlyIncome(): int | setMonthlyIncome(int monthlyIncome): void |
| `professionalOccupation` | `string` | Required | - | getProfessionalOccupation(): string | setProfessionalOccupation(string professionalOccupation): void |
| `selfDeclaredLegalRepresentative` | `bool` | Required | - | getSelfDeclaredLegalRepresentative(): bool | setSelfDeclaredLegalRepresentative(bool selfDeclaredLegalRepresentative): void |
| `address` | [`CreateRegisterInformationAddressRequest`](../../doc/models/create-register-information-address-request.md) | Required | - | getAddress(): CreateRegisterInformationAddressRequest | setAddress(CreateRegisterInformationAddressRequest address): void |
| `phoneNumbers` | [`CreateRegisterInformationPhoneRequest[]`](../../doc/models/create-register-information-phone-request.md) | Required | - | getPhoneNumbers(): array | setPhoneNumbers(array phoneNumbers): void |

## Example (as JSON)

```json
{
"name": "name4",
"email": "email2",
"document": "document2",
"mother_name": "mother_name0",
"birthdate": "birthdate8",
"monthly_income": 70,
"professional_occupation": "professional_occupation8",
"self_declared_legal_representative": false,
"address": {
"street": "street6",
"complementary": "complementary8",
"street_number": "street_number6",
"neighborhood": "neighborhood2",
"city": "city6",
"state": "state2",
"zip_code": "zip_code0",
"reference_point": "reference_point0"
},
"phone_numbers": [
{
"ddd": "ddd4",
"number": "number2",
"type": "type0"
}
]
}
```

26 changes: 11 additions & 15 deletions doc/models/create-recipient-request.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,22 @@ Request for creating a recipient

| Name | Type | Tags | Description | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `name` | `string` | Required | Recipient name | getName(): string | setName(string name): void |
| `email` | `string` | Required | Recipient email | getEmail(): string | setEmail(string email): void |
| `description` | `string` | Required | Recipient description | getDescription(): string | setDescription(string description): void |
| `document` | `string` | Required | Recipient document number | getDocument(): string | setDocument(string document): void |
| `type` | `string` | Required | Recipient type | getType(): string | setType(string type): void |
| `name` | `?string` | Optional | Recipient name. Required if the register_information field isn't populated. | getName(): ?string | setName(?string name): void |
| `email` | `?string` | Optional | Recipient email. Required if the register_information field isn't populated. | getEmail(): ?string | setEmail(?string email): void |
| `description` | `?string` | Optional | Recipient description | getDescription(): ?string | setDescription(?string description): void |
| `document` | `?string` | Optional | Recipient document number. Required if the register_information field isn't populated. | getDocument(): ?string | setDocument(?string document): void |
| `type` | `?string` | Optional | Recipient type. Required if the register_information field isn't populated. | getType(): ?string | setType(?string type): void |
| `defaultBankAccount` | [`CreateBankAccountRequest`](../../doc/models/create-bank-account-request.md) | Required | Bank account | getDefaultBankAccount(): CreateBankAccountRequest | setDefaultBankAccount(CreateBankAccountRequest defaultBankAccount): void |
| `metadata` | `array<string,string>` | Required | Metadata | getMetadata(): array | setMetadata(array metadata): void |
| `transferSettings` | [`?CreateTransferSettingsRequest`](../../doc/models/create-transfer-settings-request.md) | Optional | Receiver Transfer Information | getTransferSettings(): ?CreateTransferSettingsRequest | setTransferSettings(?CreateTransferSettingsRequest transferSettings): void |
| `code` | `string` | Required | Recipient code | getCode(): string | setCode(string code): void |
| `paymentMode` | `string` | Required | Payment mode<br>**Default**: `'bank_transfer'` | getPaymentMode(): string | setPaymentMode(string paymentMode): void |
| `registerInformation` | [`?CreateRegisterInformationBaseRequest`](../../doc/models/create-register-information-base-request.md) | Optional | Register Information | getRegisterInformation(): ?CreateRegisterInformationBaseRequest | setRegisterInformation(?CreateRegisterInformationBaseRequest registerInformation): void |

## Example (as JSON)

```json
{
"name": "name6",
"email": "email0",
"description": "description6",
"document": "document0",
"type": "type4",
"default_bank_account": {
"holder_name": "holder_name4",
"holder_type": "holder_type0",
Expand All @@ -53,11 +49,11 @@ Request for creating a recipient
},
"code": "code4",
"payment_mode": "bank_transfer",
"transfer_settings": {
"transfer_enabled": false,
"transfer_interval": "transfer_interval4",
"transfer_day": 10
}
"name": "name6",
"email": "email0",
"description": "description6",
"document": "document0",
"type": "type4"
}
```

37 changes: 37 additions & 0 deletions doc/models/create-register-information-address-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# Create Register Information Address Request

Register Information Address

## Structure

`CreateRegisterInformationAddressRequest`

## Fields

| Name | Type | Tags | Description | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `street` | `string` | Required | - | getStreet(): string | setStreet(string street): void |
| `complementary` | `string` | Required | - | getComplementary(): string | setComplementary(string complementary): void |
| `streetNumber` | `string` | Required | - | getStreetNumber(): string | setStreetNumber(string streetNumber): void |
| `neighborhood` | `string` | Required | - | getNeighborhood(): string | setNeighborhood(string neighborhood): void |
| `city` | `string` | Required | - | getCity(): string | setCity(string city): void |
| `state` | `string` | Required | - | getState(): string | setState(string state): void |
| `zipCode` | `string` | Required | - | getZipCode(): string | setZipCode(string zipCode): void |
| `referencePoint` | `string` | Required | - | getReferencePoint(): string | setReferencePoint(string referencePoint): void |

## Example (as JSON)

```json
{
"street": "street8",
"complementary": "complementary0",
"street_number": "street_number8",
"neighborhood": "neighborhood4",
"city": "city8",
"state": "state4",
"zip_code": "zip_code2",
"reference_point": "reference_point2"
}
```

37 changes: 37 additions & 0 deletions doc/models/create-register-information-base-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@

# Create Register Information Base Request

Request object for RegisterInformation.

## Structure

`CreateRegisterInformationBaseRequest`

## Fields

| Name | Type | Tags | Description | Getter | Setter |
| --- | --- | --- | --- | --- | --- |
| `email` | `string` | Required | - | getEmail(): string | setEmail(string email): void |
| `document` | `string` | Required | - | getDocument(): string | setDocument(string document): void |
| `type` | `string` | Required | "individual" ou "corporation" | getType(): string | setType(string type): void |
| `siteUrl` | `?string` | Optional | - | getSiteUrl(): ?string | setSiteUrl(?string siteUrl): void |
| `phoneNumbers` | [`CreateRegisterInformationPhoneRequest[]`](../../doc/models/create-register-information-phone-request.md) | Required | - | getPhoneNumbers(): array | setPhoneNumbers(array phoneNumbers): void |

## Example (as JSON)

```json
{
"email": "email4",
"document": "document6",
"type": "type8",
"phone_numbers": [
{
"ddd": "ddd4",
"number": "number2",
"type": "type0"
}
],
"site_url": "site_url4"
}
```

Loading

0 comments on commit b31a0a3

Please sign in to comment.