Skip to content

Commit

Permalink
Refactoring serviceRefererName (#51)
Browse files Browse the repository at this point in the history
* Refactoring serviceRefererName

* ServiceRefererName
  • Loading branch information
magnomoreira authored Jun 28, 2023
1 parent 10ffa44 commit da08d12
Show file tree
Hide file tree
Showing 23 changed files with 219 additions and 1,286 deletions.
72 changes: 37 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ In order to setup authentication and initialization of the API client, you need

| Parameter | Description |
|-----------|-------------|
| serviceRefererName | TODO: add a description |
| basicAuthUserName | The username to use with basic authentication |
| basicAuthPassword | The password to use with basic authentication |

Expand All @@ -121,10 +122,11 @@ In order to setup authentication and initialization of the API client, you need
API client can be initialized as following.

```php
$serviceRefererName = 'serviceRefererName';
$basicAuthUserName = 'basicAuthUserName'; // The username to use with basic authentication
$basicAuthPassword = 'basicAuthPassword'; // The password to use with basic authentication

$client = new PagarmeCoreApiLib\PagarmeCoreApiClient($basicAuthUserName, $basicAuthPassword);
$client = new PagarmeCoreApiLib\PagarmeCoreApiClient($serviceRefererName, $basicAuthUserName, $basicAuthPassword);
```


Expand Down Expand Up @@ -377,8 +379,8 @@ function getUsages(
```php
$subscriptionId = 'subscription_id';
$itemId = 'item_id';
$page = 71;
$size = 71;
$page = 69;
$size = 69;
$code = 'code';
$group = 'group';
$usedSince = date("D M d, Y G:i");
Expand Down Expand Up @@ -577,8 +579,8 @@ function getSubscriptionItems(

```php
$subscriptionId = 'subscription_id';
$page = 71;
$size = 71;
$page = 69;
$size = 69;
$name = 'name';
$code = 'code';
$status = 'status';
Expand Down Expand Up @@ -784,8 +786,8 @@ function getSubscriptions(
#### Example Usage

```php
$page = 71;
$size = 71;
$page = 160;
$size = 160;
$code = 'code';
$billingType = 'billing_type';
$customerId = 'customer_id';
Expand Down Expand Up @@ -1327,8 +1329,8 @@ function getDiscounts(

```php
$subscriptionId = 'subscription_id';
$page = 71;
$size = 71;
$page = 160;
$size = 160;

$result = $subscriptions->getDiscounts($subscriptionId, $page, $size);

Expand Down Expand Up @@ -1465,8 +1467,8 @@ function getIncrements(

```php
$subscriptionId = 'subscription_id';
$page = 71;
$size = 71;
$page = 160;
$size = 160;

$result = $subscriptions->getIncrements($subscriptionId, $page, $size);

Expand Down Expand Up @@ -1843,8 +1845,8 @@ function getOrders(
#### Example Usage

```php
$page = 162;
$size = 162;
$page = 160;
$size = 160;
$code = 'code';
$status = 'status';
$createdSince = date("D M d, Y G:i");
Expand Down Expand Up @@ -2715,8 +2717,8 @@ function getPlans(
#### Example Usage

```php
$page = 162;
$size = 162;
$page = 160;
$size = 160;
$name = 'name';
$status = 'status';
$billingType = 'billing_type';
Expand Down Expand Up @@ -3009,8 +3011,8 @@ function getInvoices(
#### Example Usage

```php
$page = 162;
$size = 162;
$page = 252;
$size = 252;
$code = 'code';
$customerId = 'customer_id';
$subscriptionId = 'subscription_id';
Expand Down Expand Up @@ -3533,8 +3535,8 @@ function getAccessTokens(

```php
$customerId = 'customer_id';
$page = 162;
$size = 162;
$page = 252;
$size = 252;

$result = $customers->getAccessTokens($customerId, $page, $size);

Expand Down Expand Up @@ -3625,8 +3627,8 @@ function getAddresses(

```php
$customerId = 'customer_id';
$page = 121;
$size = 121;
$page = 252;
$size = 252;

$result = $customers->getAddresses($customerId, $page, $size);

Expand Down Expand Up @@ -3854,8 +3856,8 @@ function getCards(

```php
$customerId = 'customer_id';
$page = 121;
$size = 121;
$page = 252;
$size = 252;

$result = $customers->getCards($customerId, $page, $size);

Expand Down Expand Up @@ -4227,8 +4229,8 @@ function getChargeTransactions(

```php
$chargeId = 'charge_id';
$page = 121;
$size = 121;
$page = 252;
$size = 252;

$result = $charges->getChargeTransactions($chargeId, $page, $size);

Expand Down Expand Up @@ -4330,8 +4332,8 @@ function getCharges(
#### Example Usage

```php
$page = 121;
$size = 121;
$page = 252;
$size = 252;
$code = 'code';
$status = 'status';
$paymentMethod = 'payment_method';
Expand Down Expand Up @@ -4890,8 +4892,8 @@ function getAnticipations(

```php
$recipientId = 'recipient_id';
$page = 121;
$size = 121;
$page = 252;
$size = 252;
$status = 'status';
$timeframe = 'timeframe';
$paymentDateSince = date("D M d, Y G:i");
Expand Down Expand Up @@ -4985,8 +4987,8 @@ function getRecipients(
#### Example Usage

```php
$page = 121;
$size = 121;
$page = 252;
$size = 252;

$result = $recipients->getRecipients($page, $size);

Expand Down Expand Up @@ -5215,8 +5217,8 @@ function getTransfers(

```php
$recipientId = 'recipient_id';
$page = 212;
$size = 212;
$page = 210;
$size = 210;
$status = 'status';
$createdSince = date("D M d, Y G:i");
$createdUntil = date("D M d, Y G:i");
Expand Down Expand Up @@ -5359,8 +5361,8 @@ function getWithdrawals(

```php
$recipientId = 'recipient_id';
$page = 212;
$size = 212;
$page = 210;
$size = 210;
$status = 'status';
$createdSince = date("D M d, Y G:i");
$createdUntil = date("D M d, Y G:i");
Expand Down
4 changes: 4 additions & 0 deletions src/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ class Configuration
* @var string
*/
public static $BASEURI = 'https://api.pagar.me/core/v5';
/**
* @todo Replace the $serviceRefererName with an appropriate value
*/
public static $serviceRefererName = '';

/**
* The username to use with basic authentication
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/BaseController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class BaseController
* User-agent to be sent with API calls
* @var string
*/
const USER_AGENT = 'PagarmeCoreApi - PHP 5.7.6';
const USER_AGENT = 'PagarmeCoreApi - PHP 5.7.7';

/**
* HttpCallBack instance associated with this controller
Expand Down
21 changes: 17 additions & 4 deletions src/Controllers/ChargesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public function updateChargeMetadata(
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName,
'Content-Type' => 'application/json',
'idempotency-key' => $idempotencyKey
);
Expand Down Expand Up @@ -162,6 +163,7 @@ public function captureCharge(
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName,
'Content-Type' => 'application/json',
'idempotency-key' => $idempotencyKey
);
Expand Down Expand Up @@ -253,6 +255,7 @@ public function updateChargePaymentMethod(
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName,
'Content-Type' => 'application/json',
'idempotency-key' => $idempotencyKey
);
Expand Down Expand Up @@ -348,7 +351,8 @@ public function getChargeTransactions(
//prepare headers
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json'
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName
);

//set HTTP basic auth parameters
Expand Down Expand Up @@ -434,6 +438,7 @@ public function updateChargeDueDate(
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName,
'Content-Type' => 'application/json',
'idempotency-key' => $idempotencyKey
);
Expand Down Expand Up @@ -543,7 +548,8 @@ public function getCharges(
//prepare headers
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json'
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName
);

//set HTTP basic auth parameters
Expand Down Expand Up @@ -629,6 +635,7 @@ public function updateChargeCard(
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName,
'Content-Type' => 'application/json',
'idempotency-key' => $idempotencyKey
);
Expand Down Expand Up @@ -714,7 +721,8 @@ public function getCharge(
//prepare headers
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json'
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName
);

//set HTTP basic auth parameters
Expand Down Expand Up @@ -800,6 +808,7 @@ public function cancelCharge(
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName,
'Content-Type' => 'application/json',
'idempotency-key' => $idempotencyKey
);
Expand Down Expand Up @@ -891,7 +900,8 @@ public function getChargesSummary(
//prepare headers
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json'
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName
);

//set HTTP basic auth parameters
Expand Down Expand Up @@ -975,6 +985,7 @@ public function retryCharge(
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName,
'idempotency-key' => $idempotencyKey
);

Expand Down Expand Up @@ -1054,6 +1065,7 @@ public function createCharge(
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName,
'Content-Type' => 'application/json',
'idempotency-key' => $idempotencyKey
);
Expand Down Expand Up @@ -1144,6 +1156,7 @@ public function confirmPayment(
$_headers = array (
'user-agent' => BaseController::USER_AGENT,
'Accept' => 'application/json',
'ServiceRefererName' => Configuration::$serviceRefererName,
'Content-Type' => 'application/json',
'idempotency-key' => $idempotencyKey
);
Expand Down
Loading

0 comments on commit da08d12

Please sign in to comment.