Skip to content

Commit

Permalink
added partner statement detail api
Browse files Browse the repository at this point in the history
  • Loading branch information
devops-blockchyp committed Oct 19, 2023
1 parent d522650 commit ca1132e
Show file tree
Hide file tree
Showing 4 changed files with 131 additions and 3 deletions.
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4407,7 +4407,7 @@ with special roles and permissions that may require a special arrangement with B


* **API Credential Types:** Partner
* **Required Role:** Merchant Management
* **Required Role:** Partner API Access

The API returns a list of partner residual statements. By default, all statements are returned with the most recent
statements listed first. Optional date parameters can filter statements to a specific date range.
Expand Down Expand Up @@ -4438,6 +4438,48 @@ $request = [
$response = BlockChyp::partnerStatements($request);


// View the result
echo 'Response: ' . print_r($response, true) . PHP_EOL;

```

#### Partner Statement Detail



* **API Credential Types:** Partner
* **Required Role:** Partner API Access

The API returns detailed information about a specific partner statement. The optional `includeMerchantStatement` and
`includeInterchange` parameters can be used to return low level detail about how the
residuals or commissions were computed.




```php
<?php

// For composer based systems
require_once('vendor/autoload.php');

// For manual installation
#require_once('/path/to/blockchyp/init.php');

use BlockChyp\BlockChyp;

BlockChyp::setApiKey(getenv('BC_API_KEY'));
BlockChyp::setBearerToken(getenv('BC_BEARER_TOKEN'));
BlockChyp::setSigningKey(getenv('BC_SIGNING_KEY'));

// Populate request values
$request = [
];


$response = BlockChyp::partnerStatementDetail($request);


// View the result
echo 'Response: ' . print_r($response, true) . PHP_EOL;

Expand All @@ -4448,7 +4490,7 @@ echo 'Response: ' . print_r($response, true) . PHP_EOL;


* **API Credential Types:** Partner
* **Required Role:** Read Pricing API
* **Required Role:** Partner API Access

The API returns the current pricing policy for a merchant. This API is valid for partner scoped API credentials
and `merchantId` is a required parameter. By default this API returns the currently in-force pricing policy for a merchant,
Expand Down
24 changes: 24 additions & 0 deletions examples/PartnerStatementDetailExample.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

// For composer based systems
require_once('vendor/autoload.php');

// For manual installation
#require_once('/path/to/blockchyp/init.php');

use BlockChyp\BlockChyp;

BlockChyp::setApiKey(getenv('BC_API_KEY'));
BlockChyp::setBearerToken(getenv('BC_BEARER_TOKEN'));
BlockChyp::setSigningKey(getenv('BC_SIGNING_KEY'));

// Populate request values
$request = [
];


$response = BlockChyp::partnerStatementDetail($request);


// View the result
echo 'Response: ' . print_r($response, true) . PHP_EOL;
15 changes: 14 additions & 1 deletion lib/BlockChyp.php
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ public static function transactionHistory($request)
return self::gatewayRequest('POST', '/api/tx-history', $request);
}
/**
* Returns pricing policy for a merchant.
* Returns a list of partner statements.
*
* @param array $request The request body.
*
Expand All @@ -528,6 +528,19 @@ public static function partnerStatements($request)
{
return self::gatewayRequest('POST', '/api/partner-statement-list', $request);
}
/**
* Returns detail for a single partner statement.
*
* @param array $request The request body.
*
* @throws \BlockChyp\Exception\ConnectionException if the connection fails.
*
* @return array The API response.
*/
public static function partnerStatementDetail($request)
{
return self::gatewayRequest('POST', '/api/partner-statement-detail', $request);
}
/**
* Returns pricing policy for a merchant.
*
Expand Down
49 changes: 49 additions & 0 deletions tests/itests/PartnerStatementDetailTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

use BlockChyp\BlockChyp;

require_once(__DIR__ . '/../BlockChypTestCase.php');

class PartnerStatementDetailTest extends BlockChypTestCase
{

/**
* @group itest
*/
public function testPartnerStatementDetail()
{
$config = $this->loadTestConfiguration();

BlockChyp::setApiKey($config->apiKey);
BlockChyp::setBearerToken($config->bearerToken);
BlockChyp::setSigningKey($config->signingKey);
BlockChyp::setGatewayHost($config->gatewayHost);
BlockChyp::setTestGatewayHost($config->testGatewayHost);
BlockChyp::setDashboardHost($config->dashboardHost);

echo 'Running PartnerStatementDetailTest...' . PHP_EOL; // Set request values
$request = [
'test' => true,
];

// self::logRequest($request);

try {

$response = BlockChyp::partnerStatementDetail($request);

// self::logResponse($response);

// Response assertions

$this->assertTrue($response['success']);

} catch (Exception $ex) {

echo $ex->getTraceAsString();
$this->assertEmpty($ex);

}
$this->processResponseDelay($request);
}
}

0 comments on commit ca1132e

Please sign in to comment.