Skip to content

Commit

Permalink
added partner statement list api
Browse files Browse the repository at this point in the history
  • Loading branch information
devops-blockchyp committed Oct 19, 2023
1 parent 4583a70 commit d522650
Show file tree
Hide file tree
Showing 4 changed files with 179 additions and 42 deletions.
135 changes: 93 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3953,48 +3953,6 @@ the standard underwriting process via offer codes and invitations.



#### Retrieve Pricing Policy



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

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,
but other inactive policies can be returned by providing the `id` parameter.




```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::pricingPolicy($request);


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

```

#### Merchant Profile


Expand Down Expand Up @@ -4434,6 +4392,99 @@ echo 'Response: ' . print_r($response, true) . PHP_EOL;

```

### Partner Utilities


These partner only APIs give ISV partners advanced reporting and tools for managing their portfolio.

Use of these APIs requires partner scoped API credentials
with special roles and permissions that may require a special arrangement with BlockChyp.



#### Partner Statements



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

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.




```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::partnerStatements($request);


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

```

#### Retrieve Pricing Policy



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

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,
but other inactive policies can be returned by providing the `id` parameter.




```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::pricingPolicy($request);


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

```




Expand Down
24 changes: 24 additions & 0 deletions examples/PartnerStatementsExample.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::partnerStatements($request);


// View the result
echo 'Response: ' . print_r($response, true) . PHP_EOL;
13 changes: 13 additions & 0 deletions lib/BlockChyp.php
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,19 @@ public static function transactionHistory($request)
{
return self::gatewayRequest('POST', '/api/tx-history', $request);
}
/**
* Returns pricing policy for a merchant.
*
* @param array $request The request body.
*
* @throws \BlockChyp\Exception\ConnectionException if the connection fails.
*
* @return array The API response.
*/
public static function partnerStatements($request)
{
return self::gatewayRequest('POST', '/api/partner-statement-list', $request);
}
/**
* Returns pricing policy for a merchant.
*
Expand Down
49 changes: 49 additions & 0 deletions tests/itests/PartnerStatementsTest.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 PartnerStatementsTest extends BlockChypTestCase
{

/**
* @group itest
*/
public function testPartnerStatements()
{
$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 PartnerStatementsTest...' . PHP_EOL; // Set request values
$request = [
'test' => true,
];

// self::logRequest($request);

try {

$response = BlockChyp::partnerStatements($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 d522650

Please sign in to comment.