diff --git a/README.md b/README.md index c86cf15..11a5927 100644 --- a/README.md +++ b/README.md @@ -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 | @@ -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); ``` @@ -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"); @@ -577,8 +579,8 @@ function getSubscriptionItems( ```php $subscriptionId = 'subscription_id'; -$page = 71; -$size = 71; +$page = 69; +$size = 69; $name = 'name'; $code = 'code'; $status = 'status'; @@ -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'; @@ -1327,8 +1329,8 @@ function getDiscounts( ```php $subscriptionId = 'subscription_id'; -$page = 71; -$size = 71; +$page = 160; +$size = 160; $result = $subscriptions->getDiscounts($subscriptionId, $page, $size); @@ -1465,8 +1467,8 @@ function getIncrements( ```php $subscriptionId = 'subscription_id'; -$page = 71; -$size = 71; +$page = 160; +$size = 160; $result = $subscriptions->getIncrements($subscriptionId, $page, $size); @@ -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"); @@ -2715,8 +2717,8 @@ function getPlans( #### Example Usage ```php -$page = 162; -$size = 162; +$page = 160; +$size = 160; $name = 'name'; $status = 'status'; $billingType = 'billing_type'; @@ -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'; @@ -3533,8 +3535,8 @@ function getAccessTokens( ```php $customerId = 'customer_id'; -$page = 162; -$size = 162; +$page = 252; +$size = 252; $result = $customers->getAccessTokens($customerId, $page, $size); @@ -3625,8 +3627,8 @@ function getAddresses( ```php $customerId = 'customer_id'; -$page = 121; -$size = 121; +$page = 252; +$size = 252; $result = $customers->getAddresses($customerId, $page, $size); @@ -3854,8 +3856,8 @@ function getCards( ```php $customerId = 'customer_id'; -$page = 121; -$size = 121; +$page = 252; +$size = 252; $result = $customers->getCards($customerId, $page, $size); @@ -4227,8 +4229,8 @@ function getChargeTransactions( ```php $chargeId = 'charge_id'; -$page = 121; -$size = 121; +$page = 252; +$size = 252; $result = $charges->getChargeTransactions($chargeId, $page, $size); @@ -4330,8 +4332,8 @@ function getCharges( #### Example Usage ```php -$page = 121; -$size = 121; +$page = 252; +$size = 252; $code = 'code'; $status = 'status'; $paymentMethod = 'payment_method'; @@ -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"); @@ -4985,8 +4987,8 @@ function getRecipients( #### Example Usage ```php -$page = 121; -$size = 121; +$page = 252; +$size = 252; $result = $recipients->getRecipients($page, $size); @@ -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"); @@ -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"); diff --git a/src/Configuration.php b/src/Configuration.php index 62487c9..e978451 100644 --- a/src/Configuration.php +++ b/src/Configuration.php @@ -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 diff --git a/src/Controllers/BaseController.php b/src/Controllers/BaseController.php index 0b39d8c..6a4e883 100644 --- a/src/Controllers/BaseController.php +++ b/src/Controllers/BaseController.php @@ -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 diff --git a/src/Controllers/ChargesController.php b/src/Controllers/ChargesController.php index cde6b3b..554b864 100644 --- a/src/Controllers/ChargesController.php +++ b/src/Controllers/ChargesController.php @@ -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 ); @@ -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 ); @@ -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 ); @@ -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 @@ -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 ); @@ -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 @@ -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 ); @@ -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 @@ -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 ); @@ -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 @@ -975,6 +985,7 @@ public function retryCharge( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -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 ); @@ -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 ); diff --git a/src/Controllers/CustomersController.php b/src/Controllers/CustomersController.php index f1bb13f..06e1a1a 100644 --- a/src/Controllers/CustomersController.php +++ b/src/Controllers/CustomersController.php @@ -74,6 +74,7 @@ public function updateCard( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -165,6 +166,7 @@ public function deleteCard( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -249,7 +251,8 @@ public function getCard( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -338,6 +341,7 @@ public function updateAddress( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -426,7 +430,8 @@ public function getAddress( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -513,6 +518,7 @@ public function deleteAddress( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -600,6 +606,7 @@ public function deleteAccessToken( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -684,7 +691,8 @@ public function getAccessToken( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -770,6 +778,7 @@ public function createAccessToken( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -865,7 +874,8 @@ public function getAccessTokens( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -951,6 +961,7 @@ public function createAddress( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1046,7 +1057,8 @@ public function getAddresses( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1125,6 +1137,7 @@ public function createCustomer( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1225,7 +1238,8 @@ public function getCustomers( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1306,7 +1320,8 @@ public function deleteAccessTokens( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1392,6 +1407,7 @@ public function createCard( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1487,7 +1503,8 @@ public function getCards( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1573,6 +1590,7 @@ public function updateCustomer( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1658,7 +1676,8 @@ public function getCustomer( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1745,6 +1764,7 @@ public function renewCard( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -1831,6 +1851,7 @@ public function updateCustomerMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); diff --git a/src/Controllers/InvoicesController.php b/src/Controllers/InvoicesController.php index cfa6d2a..eb2bc04 100644 --- a/src/Controllers/InvoicesController.php +++ b/src/Controllers/InvoicesController.php @@ -67,7 +67,8 @@ public function getPartialInvoice( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -151,6 +152,7 @@ public function cancelInvoice( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -232,7 +234,8 @@ public function getInvoice( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -321,6 +324,7 @@ public function createInvoice( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -411,6 +415,7 @@ public function updateInvoiceMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -526,7 +531,8 @@ public function getInvoices( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -612,6 +618,7 @@ public function updateInvoiceStatus( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); diff --git a/src/Controllers/OrdersController.php b/src/Controllers/OrdersController.php index 7a5b045..cfde4db 100644 --- a/src/Controllers/OrdersController.php +++ b/src/Controllers/OrdersController.php @@ -85,7 +85,8 @@ public function getOrders( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -164,6 +165,7 @@ public function createOrder( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -252,6 +254,7 @@ public function deleteAllOrderItems( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -338,6 +341,7 @@ public function createOrderItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -431,6 +435,7 @@ public function updateOrderItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -522,6 +527,7 @@ public function deleteOrderItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -606,7 +612,8 @@ public function getOrderItem( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -692,6 +699,7 @@ public function closeOrder( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -782,6 +790,7 @@ public function updateOrderMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -867,7 +876,8 @@ public function getOrder( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters diff --git a/src/Controllers/PlansController.php b/src/Controllers/PlansController.php index a74813e..40c6157 100644 --- a/src/Controllers/PlansController.php +++ b/src/Controllers/PlansController.php @@ -67,7 +67,8 @@ public function getPlan( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -153,6 +154,7 @@ public function updatePlan( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -241,6 +243,7 @@ public function deletePlan( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -327,6 +330,7 @@ public function updatePlanMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -420,6 +424,7 @@ public function updatePlanItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -508,7 +513,8 @@ public function getPlanItem( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -595,6 +601,7 @@ public function deletePlanItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -681,6 +688,7 @@ public function createPlanItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -764,6 +772,7 @@ public function createPlan( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -867,7 +876,8 @@ public function getPlans( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters diff --git a/src/Controllers/RecipientsController.php b/src/Controllers/RecipientsController.php index 10c74d6..7aa082c 100644 --- a/src/Controllers/RecipientsController.php +++ b/src/Controllers/RecipientsController.php @@ -70,7 +70,8 @@ public function getTransfer( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -156,6 +157,7 @@ public function updateRecipient( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -241,7 +243,8 @@ public function getRecipient( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -327,6 +330,7 @@ public function createAnticipation( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -440,7 +444,8 @@ public function getAnticipations( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -531,7 +536,8 @@ public function getAnticipationLimits( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -615,7 +621,8 @@ public function getRecipients( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -694,6 +701,7 @@ public function createRecipient( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -782,7 +790,8 @@ public function getWithdrawById( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -868,6 +877,7 @@ public function updateRecipientDefaultBankAccount( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -958,6 +968,7 @@ public function updateRecipientMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1062,7 +1073,8 @@ public function getTransfers( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1148,6 +1160,7 @@ public function createTransfer( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1236,6 +1249,7 @@ public function createWithdraw( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json' ); @@ -1339,7 +1353,8 @@ public function getWithdrawals( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1426,6 +1441,7 @@ public function updateAutomaticAnticipationSettings( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1514,7 +1530,8 @@ public function getAnticipation( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1600,6 +1617,7 @@ public function updateRecipientTransferSettings( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1685,7 +1703,8 @@ public function getBalance( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1766,7 +1785,8 @@ public function getRecipientByCode( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1840,7 +1860,8 @@ public function getDefaultRecipient() //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters diff --git a/src/Controllers/SellersController.php b/src/Controllers/SellersController.php deleted file mode 100644 index 5e6855c..0000000 --- a/src/Controllers/SellersController.php +++ /dev/null @@ -1,427 +0,0 @@ - BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey - ); - - //json encode body - $_bodyJson = Request\Body::Json($request); - - //set HTTP basic auth parameters - Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); - - //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::POST, $_headers, $_queryUrl); - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - - //and invoke the API call request to fetch the response - $response = Request::post($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - - $mapper = $this->getJsonMapper(); - - return $mapper->mapClass($response->body, 'PagarmeCoreApiLib\\Models\\GetSellerResponse'); - } - - /** - * @todo Add general description for this endpoint - * - * @param string $sellerId Seller Id - * @param Models\UpdateMetadataRequest $request Request for updating the charge metadata - * @param string $idempotencyKey (optional) TODO: type description here - * @return mixed response from the API call - * @throws APIException Thrown if API call fails - */ - public function updateSellerMetadata( - $sellerId, - $request, - $idempotencyKey = null - ) { - - //prepare query string for API call - $_queryBuilder = '/sellers/{seller_id}/metadata'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'seller_id' => $sellerId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey - ); - - //json encode body - $_bodyJson = Request\Body::Json($request); - - //set HTTP basic auth parameters - Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); - - //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PATCH, $_headers, $_queryUrl); - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - - //and invoke the API call request to fetch the response - $response = Request::patch($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - - $mapper = $this->getJsonMapper(); - - return $mapper->mapClass($response->body, 'PagarmeCoreApiLib\\Models\\GetSellerResponse'); - } - - /** - * @todo Add general description for this endpoint - * - * @param string $id TODO: type description here - * @param Models\UpdateSellerRequest $request Update Seller model - * @param string $idempotencyKey (optional) TODO: type description here - * @return mixed response from the API call - * @throws APIException Thrown if API call fails - */ - public function updateSeller( - $id, - $request, - $idempotencyKey = null - ) { - - //prepare query string for API call - $_queryBuilder = '/sellers/{id}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'id' => $id, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'content-type' => 'application/json; charset=utf-8', - 'idempotency-key' => $idempotencyKey - ); - - //json encode body - $_bodyJson = Request\Body::Json($request); - - //set HTTP basic auth parameters - Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); - - //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::PUT, $_headers, $_queryUrl); - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - - //and invoke the API call request to fetch the response - $response = Request::put($_queryUrl, $_headers, $_bodyJson); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - - $mapper = $this->getJsonMapper(); - - return $mapper->mapClass($response->body, 'PagarmeCoreApiLib\\Models\\GetSellerResponse'); - } - - /** - * @todo Add general description for this endpoint - * - * @param string $sellerId Seller Id - * @param string $idempotencyKey (optional) TODO: type description here - * @return mixed response from the API call - * @throws APIException Thrown if API call fails - */ - public function deleteSeller( - $sellerId, - $idempotencyKey = null - ) { - - //prepare query string for API call - $_queryBuilder = '/sellers/{sellerId}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'sellerId' => $sellerId, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json', - 'idempotency-key' => $idempotencyKey - ); - - //set HTTP basic auth parameters - Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); - - //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::DELETE, $_headers, $_queryUrl); - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - - //and invoke the API call request to fetch the response - $response = Request::delete($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - - $mapper = $this->getJsonMapper(); - - return $mapper->mapClass($response->body, 'PagarmeCoreApiLib\\Models\\GetSellerResponse'); - } - - /** - * @todo Add general description for this endpoint - * - * @param string $id Seller Id - * @return mixed response from the API call - * @throws APIException Thrown if API call fails - */ - public function getSellerById( - $id - ) { - - //prepare query string for API call - $_queryBuilder = '/sellers/{id}'; - - //process optional query parameters - $_queryBuilder = APIHelper::appendUrlWithTemplateParameters($_queryBuilder, array ( - 'id' => $id, - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set HTTP basic auth parameters - Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); - - //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - - //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - - $mapper = $this->getJsonMapper(); - - return $mapper->mapClass($response->body, 'PagarmeCoreApiLib\\Models\\GetSellerResponse'); - } - - /** - * @todo Add general description for this endpoint - * - * @param integer $page (optional) Page number - * @param integer $size (optional) Page size - * @param string $name (optional) TODO: type description here - * @param string $document (optional) TODO: type description here - * @param string $code (optional) TODO: type description here - * @param string $status (optional) TODO: type description here - * @param string $type (optional) TODO: type description here - * @param DateTime $createdSince (optional) TODO: type description here - * @param DateTime $createdUntil (optional) TODO: type description here - * @return mixed response from the API call - * @throws APIException Thrown if API call fails - */ - public function getSellers( - $page = null, - $size = null, - $name = null, - $document = null, - $code = null, - $status = null, - $type = null, - $createdSince = null, - $createdUntil = null - ) { - - //prepare query string for API call - $_queryBuilder = '/sellers'; - - //process optional query parameters - APIHelper::appendUrlWithQueryParameters($_queryBuilder, array ( - 'page' => $page, - 'size' => $size, - 'name' => $name, - 'document' => $document, - 'code' => $code, - 'status' => $status, - 'type' => $type, - 'created_Since' => DateTimeHelper::toRfc3339DateTime($createdSince), - 'created_Until' => DateTimeHelper::toRfc3339DateTime($createdUntil), - )); - - //validate and preprocess url - $_queryUrl = APIHelper::cleanUrl(Configuration::$BASEURI . $_queryBuilder); - - //prepare headers - $_headers = array ( - 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' - ); - - //set HTTP basic auth parameters - Request::auth(Configuration::$basicAuthUserName, Configuration::$basicAuthPassword); - - //call on-before Http callback - $_httpRequest = new HttpRequest(HttpMethod::GET, $_headers, $_queryUrl); - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnBeforeRequest($_httpRequest); - } - - //and invoke the API call request to fetch the response - $response = Request::get($_queryUrl, $_headers); - - $_httpResponse = new HttpResponse($response->code, $response->headers, $response->raw_body); - $_httpContext = new HttpContext($_httpRequest, $_httpResponse); - - //call on-after Http callback - if ($this->getHttpCallBack() != null) { - $this->getHttpCallBack()->callOnAfterRequest($_httpContext); - } - - //handle errors defined at the API level - $this->validateResponse($_httpResponse, $_httpContext); - - $mapper = $this->getJsonMapper(); - - return $mapper->mapClass($response->body, 'PagarmeCoreApiLib\\Models\\ListSellerResponse'); - } -} diff --git a/src/Controllers/SubscriptionsController.php b/src/Controllers/SubscriptionsController.php index fa79614..8913b5f 100644 --- a/src/Controllers/SubscriptionsController.php +++ b/src/Controllers/SubscriptionsController.php @@ -72,6 +72,7 @@ public function updateSubscriptionCard( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -167,6 +168,7 @@ public function deleteUsage( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -253,6 +255,7 @@ public function createDiscount( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -344,6 +347,7 @@ public function createAnUsage( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -450,7 +454,8 @@ public function getUsages( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -536,6 +541,7 @@ public function updateCurrentCycleStatus( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -623,6 +629,7 @@ public function updateSubscriptionPaymentMethod( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -714,6 +721,7 @@ public function deleteDiscount( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -823,7 +831,8 @@ public function getSubscriptionItems( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -909,6 +918,7 @@ public function createSubscriptionItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -997,7 +1007,8 @@ public function getSubscriptionItem( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1086,6 +1097,7 @@ public function updateSubscriptionItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1204,7 +1216,8 @@ public function getSubscriptions( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1283,6 +1296,7 @@ public function createSubscription( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1373,6 +1387,7 @@ public function cancelSubscription( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1458,7 +1473,8 @@ public function getSubscription( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1544,6 +1560,7 @@ public function createIncrement( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1632,7 +1649,8 @@ public function getDiscountById( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -1719,6 +1737,7 @@ public function updateSubscriptionAffiliationId( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1809,6 +1828,7 @@ public function updateSubscriptionMetadata( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -1900,6 +1920,7 @@ public function deleteIncrement( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -1984,7 +2005,8 @@ public function getIncrementById( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -2075,7 +2097,8 @@ public function getSubscriptionCycles( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -2159,6 +2182,7 @@ public function renewSubscription( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -2250,7 +2274,8 @@ public function getDiscounts( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -2337,6 +2362,7 @@ public function updateSubscriptionBillingDate( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -2429,6 +2455,7 @@ public function deleteSubscriptionItem( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'idempotency-key' => $idempotencyKey ); @@ -2520,7 +2547,8 @@ public function getIncrements( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -2606,6 +2634,7 @@ public function updateSubscriptionDueDays( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -2697,6 +2726,7 @@ public function updateSubscriptionStartAt( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -2788,6 +2818,7 @@ public function updateLatestPeriodEndAt( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -2879,6 +2910,7 @@ public function updateSubscriptionMiniumPrice( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -2967,7 +2999,8 @@ public function getSubscriptionCycleById( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -3052,7 +3085,8 @@ public function getUsageReport( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -3136,6 +3170,7 @@ public function updateSplitSubscription( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json' ); diff --git a/src/Controllers/TokensController.php b/src/Controllers/TokensController.php index 722fa03..308f2d5 100644 --- a/src/Controllers/TokensController.php +++ b/src/Controllers/TokensController.php @@ -78,6 +78,7 @@ public function createToken( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json', 'idempotency-key' => $idempotencyKey ); @@ -173,7 +174,8 @@ public function getToken( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters diff --git a/src/Controllers/TransactionsController.php b/src/Controllers/TransactionsController.php index b13110d..3ed64de 100644 --- a/src/Controllers/TransactionsController.php +++ b/src/Controllers/TransactionsController.php @@ -66,7 +66,8 @@ public function getTransaction( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters diff --git a/src/Controllers/TransfersController.php b/src/Controllers/TransfersController.php index 7fbfa97..01d0b22 100644 --- a/src/Controllers/TransfersController.php +++ b/src/Controllers/TransfersController.php @@ -66,7 +66,8 @@ public function getTransferById( //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters @@ -143,6 +144,7 @@ public function postCreateTransfer( $_headers = array ( 'user-agent' => BaseController::USER_AGENT, 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName, 'Content-Type' => 'application/json' ); @@ -220,7 +222,8 @@ public function getTransfers1() //prepare headers $_headers = array ( 'user-agent' => BaseController::USER_AGENT, - 'Accept' => 'application/json' + 'Accept' => 'application/json', + 'ServiceRefererName' => Configuration::$serviceRefererName ); //set HTTP basic auth parameters diff --git a/src/Models/CancelSplitRequest.php b/src/Models/CancelSplitRequest.php deleted file mode 100644 index 0668e80..0000000 --- a/src/Models/CancelSplitRequest.php +++ /dev/null @@ -1,86 +0,0 @@ -type - * @param integer $amount Initialization value for $this->amount - * @param string $recipientId Initialization value for $this->recipientId - * @param CreateSplitOptionsRequest $options Initialization value for $this->options - * @param string $splitRuleId Initialization value for $this->splitRuleId - */ - public function __construct() - { - if (5 == func_num_args()) { - $this->type = func_get_arg(0); - $this->amount = func_get_arg(1); - $this->recipientId = func_get_arg(2); - $this->options = func_get_arg(3); - $this->splitRuleId = func_get_arg(4); - } - } - - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['type'] = $this->type; - $json['amount'] = $this->amount; - $json['recipient_id'] = $this->recipientId; - $json['options'] = $this->options; - $json['split_rule_id'] = $this->splitRuleId; - - return $json; - } -} diff --git a/src/Models/CreateSellerRequest.php b/src/Models/CreateSellerRequest.php deleted file mode 100644 index ead1246..0000000 --- a/src/Models/CreateSellerRequest.php +++ /dev/null @@ -1,101 +0,0 @@ -name - * @param string $code Initialization value for $this->code - * @param string $description Initialization value for $this->description - * @param string $document Initialization value for $this->document - * @param CreateAddressRequest $address Initialization value for $this->address - * @param string $type Initialization value for $this->type - * @param array $metadata Initialization value for $this->metadata - */ - public function __construct() - { - if (7 == func_num_args()) { - $this->name = func_get_arg(0); - $this->code = func_get_arg(1); - $this->description = func_get_arg(2); - $this->document = func_get_arg(3); - $this->address = func_get_arg(4); - $this->type = func_get_arg(5); - $this->metadata = func_get_arg(6); - } - } - - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['name'] = $this->name; - $json['code'] = $this->code; - $json['description'] = $this->description; - $json['document'] = $this->document; - $json['address'] = $this->address; - $json['type'] = $this->type; - $json['metadata'] = $this->metadata; - - return $json; - } -} diff --git a/src/Models/GetSellerResponse.php b/src/Models/GetSellerResponse.php deleted file mode 100644 index ee9a7f1..0000000 --- a/src/Models/GetSellerResponse.php +++ /dev/null @@ -1,151 +0,0 @@ -id - * @param string $name Initialization value for $this->name - * @param string $code Initialization value for $this->code - * @param string $document Initialization value for $this->document - * @param string $description Initialization value for $this->description - * @param string $status Initialization value for $this->status - * @param string $createdAt Initialization value for $this->createdAt - * @param string $updatedAt Initialization value for $this->updatedAt - * @param GetAddressResponse $address Initialization value for $this->address - * @param array $metadata Initialization value for $this->metadata - * @param string $deletedAt Initialization value for $this->deletedAt - */ - public function __construct() - { - if (11 == func_num_args()) { - $this->id = func_get_arg(0); - $this->name = func_get_arg(1); - $this->code = func_get_arg(2); - $this->document = func_get_arg(3); - $this->description = func_get_arg(4); - $this->status = func_get_arg(5); - $this->createdAt = func_get_arg(6); - $this->updatedAt = func_get_arg(7); - $this->address = func_get_arg(8); - $this->metadata = func_get_arg(9); - $this->deletedAt = func_get_arg(10); - } - } - - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['id'] = $this->id; - $json['name'] = $this->name; - $json['code'] = $this->code; - $json['document'] = $this->document; - $json['description'] = $this->description; - $json['Status'] = $this->status; - $json['CreatedAt'] = $this->createdAt; - $json['UpdatedAt'] = $this->updatedAt; - $json['Address'] = $this->address; - $json['Metadata'] = $this->metadata; - $json['DeletedAt'] = $this->deletedAt; - - return $json; - } -} diff --git a/src/Models/GetSellersRequest.php b/src/Models/GetSellersRequest.php deleted file mode 100644 index c11d6d2..0000000 --- a/src/Models/GetSellersRequest.php +++ /dev/null @@ -1,106 +0,0 @@ -name - * @param string $document Initialization value for $this->document - * @param string $code Initialization value for $this->code - * @param string $status Initialization value for $this->status - * @param string $type Initialization value for $this->type - * @param string $createdSince Initialization value for $this->createdSince - * @param string $createdUntil Initialization value for $this->createdUntil - */ - public function __construct() - { - if (7 == func_num_args()) { - $this->name = func_get_arg(0); - $this->document = func_get_arg(1); - $this->code = func_get_arg(2); - $this->status = func_get_arg(3); - $this->type = func_get_arg(4); - $this->createdSince = func_get_arg(5); - $this->createdUntil = func_get_arg(6); - } - } - - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['name'] = $this->name; - $json['document'] = $this->document; - $json['code'] = $this->code; - $json['status'] = $this->status; - $json['type'] = $this->type; - $json['created_Since'] = $this->createdSince; - $json['created_Until'] = $this->createdUntil; - - return $json; - } -} diff --git a/src/Models/GetUsagesDetailsResponse.php b/src/Models/GetUsagesDetailsResponse.php deleted file mode 100644 index a223722..0000000 --- a/src/Models/GetUsagesDetailsResponse.php +++ /dev/null @@ -1,99 +0,0 @@ -subscriptionId - * @param integer $totalAmount Initialization value for $this->totalAmount - * @param GetPeriodResponse $period Initialization value for $this->period - * @param ListUsagesDetailsResponse $usages Initialization value for $this->usages - * @param integer $totalDiscount Initialization value for $this->totalDiscount - * @param integer $totalIncrement Initialization value for $this->totalIncrement - */ - public function __construct() - { - if (6 == func_num_args()) { - $this->subscriptionId = func_get_arg(0); - $this->totalAmount = func_get_arg(1); - $this->period = func_get_arg(2); - $this->usages = func_get_arg(3); - $this->totalDiscount = func_get_arg(4); - $this->totalIncrement = func_get_arg(5); - } - } - - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['subscription_id'] = $this->subscriptionId; - $json['total_amount'] = $this->totalAmount; - $json['Period'] = $this->period; - $json['Usages'] = $this->usages; - $json['total_discount'] = $this->totalDiscount; - $json['total_increment'] = $this->totalIncrement; - - return $json; - } -} diff --git a/src/Models/ListSellerResponse.php b/src/Models/ListSellerResponse.php deleted file mode 100644 index ebf177a..0000000 --- a/src/Models/ListSellerResponse.php +++ /dev/null @@ -1,56 +0,0 @@ -data - * @param PagingResponse $paging Initialization value for $this->paging - */ - public function __construct() - { - if (2 == func_num_args()) { - $this->data = func_get_arg(0); - $this->paging = func_get_arg(1); - } - } - - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['data'] = $this->data; - $json['paging'] = $this->paging; - - return $json; - } -} diff --git a/src/Models/ListUsagesDetailsResponse.php b/src/Models/ListUsagesDetailsResponse.php deleted file mode 100644 index 79d532e..0000000 --- a/src/Models/ListUsagesDetailsResponse.php +++ /dev/null @@ -1,56 +0,0 @@ -data - * @param PagingResponse $paging Initialization value for $this->paging - */ - public function __construct() - { - if (2 == func_num_args()) { - $this->data = func_get_arg(0); - $this->paging = func_get_arg(1); - } - } - - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['data'] = $this->data; - $json['paging'] = $this->paging; - - return $json; - } -} diff --git a/src/Models/UpdateSellerRequest.php b/src/Models/UpdateSellerRequest.php deleted file mode 100644 index b482d2f..0000000 --- a/src/Models/UpdateSellerRequest.php +++ /dev/null @@ -1,116 +0,0 @@ -name - * @param string $code Initialization value for $this->code - * @param string $description Initialization value for $this->description - * @param string $document Initialization value for $this->document - * @param string $status Initialization value for $this->status - * @param string $type Initialization value for $this->type - * @param CreateAddressRequest $address Initialization value for $this->address - * @param array $metadata Initialization value for $this->metadata - */ - public function __construct() - { - if (8 == func_num_args()) { - $this->name = func_get_arg(0); - $this->code = func_get_arg(1); - $this->description = func_get_arg(2); - $this->document = func_get_arg(3); - $this->status = func_get_arg(4); - $this->type = func_get_arg(5); - $this->address = func_get_arg(6); - $this->metadata = func_get_arg(7); - } - } - - - /** - * Encode this object to JSON - */ - public function jsonSerialize() - { - $json = array(); - $json['name'] = $this->name; - $json['code'] = $this->code; - $json['description'] = $this->description; - $json['document'] = $this->document; - $json['status'] = $this->status; - $json['type'] = $this->type; - $json['address'] = $this->address; - $json['metadata'] = $this->metadata; - - return $json; - } -} diff --git a/src/PagarmeCoreApiClient.php b/src/PagarmeCoreApiClient.php index 1584404..95f0119 100644 --- a/src/PagarmeCoreApiClient.php +++ b/src/PagarmeCoreApiClient.php @@ -17,12 +17,14 @@ class PagarmeCoreApiClient /** * Constructor with authentication and configuration parameters */ - public function __construct( + public function __construct( $basicAuthUserName = null, - $basicAuthPassword = null + $basicAuthPassword = null, + $serviceRefererName = null ) { Configuration::$basicAuthUserName = $basicAuthUserName ? $basicAuthUserName : Configuration::$basicAuthUserName; Configuration::$basicAuthPassword = $basicAuthPassword ? $basicAuthPassword : Configuration::$basicAuthPassword; + Configuration::$serviceRefererName = $serviceRefererName ? $serviceRefererName : Configuration::$serviceRefererName; } /** * Singleton access to Subscriptions controller