Skip to content

Commit

Permalink
Merge pull request #281 from blockchyp/develop
Browse files Browse the repository at this point in the history
Develop to Master
  • Loading branch information
devops-blockchyp committed Sep 12, 2024
1 parent facba61 commit aeb5939
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 1 deletion.
48 changes: 48 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4301,6 +4301,54 @@ $request = [
$response = BlockChyp::inviteMerchantUser($request);


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

```

#### Add Gateway Merchant



* **API Credential Types:** Partner
* **Required Role:** Gateway Boarding

This is a partner level API that can be used to manually board gateway merchants. Use this API in conjunction
with Platform Configuration to instantly board gateway merchants. Note that most partners don't have
permission to do this and are unlikely to get it.

Settings can be changed by using the Update Merchant API.




```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 = [
'profile' => [
'dbaName' => 'DBA Name',
'companyName' => 'Corporate Entity Name',
],
];


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


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

Expand Down
28 changes: 28 additions & 0 deletions examples/AddGatewayMerchantExample.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?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 = [
'profile' => [
'dbaName' => 'DBA Name',
'companyName' => 'Corporate Entity Name',
],
];


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


// View the result
echo 'Response: ' . print_r($response, true) . PHP_EOL;
1 change: 0 additions & 1 deletion examples/UpdateMerchantPlatformsExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

// Populate request values
$request = [
'merchantId' => 'XXXXXXXXXXXXX',
];


Expand Down
15 changes: 15 additions & 0 deletions lib/BlockChyp.php
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,21 @@ public static function inviteMerchantUser($request)
return self::dashboardRequest('POST', '/api/invite-merchant-user', $request);
}

/**
* Adds a live gateway merchant account.
*
* @param array $request The request body.
*
* @throws \BlockChyp\Exception\ConnectionException if the connection fails.
*
* @return array The API response.
*/

public static function addGatewayMerchant($request)
{
return self::dashboardRequest('POST', '/api/add-gateway-merchant', $request);
}

/**
* Adds a test merchant account.
*
Expand Down
59 changes: 59 additions & 0 deletions tests/itests/AddGatewayMerchantTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
<?php

use BlockChyp\BlockChyp;

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

class AddGatewayMerchantTest extends BlockChypTestCase
{

/**
* @group itest
*/
public function testAddGatewayMerchant()
{
$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 AddGatewayMerchantTest...' . PHP_EOL;
$profile = $config->profiles->partner;
if (!empty($profile)) {
BlockChyp::setApiKey($profile->apiKey);
BlockChyp::setBearerToken($profile->bearerToken);
BlockChyp::setSigningKey($profile->signingKey);
}
// Set request values
$request = [
'profile' => [
'dbaName' => 'DBA Name',
'companyName' => 'Corporate Entity Name',
],
];

// self::logRequest($request);

try {

$response = BlockChyp::addGatewayMerchant($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 aeb5939

Please sign in to comment.