Skip to content

Commit

Permalink
roughing in commmission breakdown api.
Browse files Browse the repository at this point in the history
  • Loading branch information
devops-blockchyp committed Oct 25, 2023
1 parent 5730dae commit ce7131b
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 0 deletions.
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4610,6 +4610,46 @@ echo 'Response: ' . print_r($response, true) . PHP_EOL;

```

#### Partner Commission Breakdown



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

This API allows partners to pull down the low level data used to compute a partner commission for a specific merchant statuement.




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


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

```




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


// View the result
echo 'Response: ' . print_r($response, true) . PHP_EOL;
14 changes: 14 additions & 0 deletions lib/BlockChyp.php
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,20 @@ public static function pricingPolicy($request)
{
return self::gatewayRequest('POST', '/api/read-pricing-policy', $request);
}
/**
* Returns low level details for how partner commissions were calculated for a
* specific merchant statement.
*
* @param array $request The request body.
*
* @throws \BlockChyp\Exception\ConnectionException if the connection fails.
*
* @return array The API response.
*/
public static function partnerCommissionBreakdown($request)
{
return self::gatewayRequest('POST', '/api/partner-commission-breakdown', $request);
}
/**
* Returns profile information for a merchant.
*
Expand Down
49 changes: 49 additions & 0 deletions tests/itests/PartnerCommissionBreakdownTest.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 PartnerCommissionBreakdownTest extends BlockChypTestCase
{

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

// self::logRequest($request);

try {

$response = BlockChyp::partnerCommissionBreakdown($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 ce7131b

Please sign in to comment.