Skip to content

Commit

Permalink
Merge pull request #283 from blockchyp/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
devops-blockchyp committed Sep 18, 2024
1 parent 47c3438 commit b90b0c6
Show file tree
Hide file tree
Showing 5 changed files with 237 additions and 0 deletions.
54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4775,6 +4775,7 @@ BlockChyp::setSigningKey(getenv('BC_SIGNING_KEY'));

// Populate request values
$request = [
'merchantId' => '<MERCHANT ID>',
];


Expand All @@ -4786,6 +4787,59 @@ echo 'Response: ' . print_r($response, true) . PHP_EOL;

```

#### Submit Application



* **API Credential Types:** Partner
* **Required Role:** INVITE MERCHANT

This is a partner level API that can be used to submit applications to add new merchant accounts. The application requires a significant amount of detailed information about the merchant and their business. Rather than providing an exhaustive list of required fields, we recommend submitting as much information as possible in your initial request.

If any required fields are missing or if there are any validation errors, the API will return specific error messages indicating which fields need to be addressed. Simply review these validation errors, fill in the missing information or correct any errors, and resubmit the application.

Key areas of information include:
- Business details (name, type, tax information)
- Contact information
- Address information (physical and mailing)
- Owner details
- Bank account information
- Transaction volume estimates
- Operational settings (timezone, batch close time, etc.)

**Note:** Some fields may be conditionally required based on the values of other fields. The validation process will guide you through ensuring all necessary information is provided.




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


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

```




Expand Down
1 change: 1 addition & 0 deletions examples/MerchantCredentialGenerationExample.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

// Populate request values
$request = [
'merchantId' => '<MERCHANT ID>',
];


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


// View the result
echo 'Response: ' . print_r($response, true) . PHP_EOL;
15 changes: 15 additions & 0 deletions lib/BlockChyp.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,21 @@ public static function merchantCredentialGeneration($request)
return self::dashboardRequest('POST', '/api/generate-merchant-creds', $request);
}

/**
* Submits and application to add a new merchant account.
*
* @param array $request The request body.
*
* @throws \BlockChyp\Exception\ConnectionException if the connection fails.
*
* @return array The API response.
*/

public static function submitApplication($request)
{
return self::dashboardRequest('POST', '/api/submit-application', $request);
}

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

use BlockChyp\BlockChyp;

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

class SubmitApplicationTest extends BlockChypTestCase
{

/**
* @group itest
*/
public function testSubmitApplication()
{
$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 SubmitApplicationTest...' . 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 = [
'test' => true,
'inviteCode' => 'asdf',
'dbaName' => 'BlockChyp',
'corporateName' => 'BlockChyp Inc.',
'webSite' => 'https://www.blockchyp.com',
'taxIdNumber' => '123456789',
'entityType' => 'CORPORATION',
'stateOfIncorporation' => 'UT',
'merchantType' => 'RETAIL',
'businessDescription' => 'Payment processing solutions',
'yearsInBusiness' => '5',
'businessPhoneNumber' => '5555551234',
'physicalAddress' => [
'address1' => '355 S 520 W',
'city' => 'Lindon',
'stateOrProvince' => 'UT',
'postalCode' => '84042',
'countryCode' => 'US',
],
'mailingAddress' => [
'address1' => '355 S 520 W',
'city' => 'Lindon',
'stateOrProvince' => 'UT',
'postalCode' => '84042',
'countryCode' => 'US',
],
'contactFirstName' => 'John',
'contactLastName' => 'Doe',
'contactPhoneNumber' => '5555555678',
'contactEmail' => '[email protected]',
'contactTitle' => 'CEO',
'contactTaxIdNumber' => '987654321',
'contactDOB' => '1980-01-01',
'contactDlNumber' => 'D1234567',
'contactDlStateOrProvince' => 'NY',
'contactDlExpiration' => '2025-12-31',
'contactHomeAddress' => [
'address1' => '355 S 520 W',
'city' => 'Lindon',
'stateOrProvince' => 'UT',
'postalCode' => '84042',
'countryCode' => 'US',
],
'contactRole' => 'OWNER',
'owners' => [
[
'firstName' => 'John',
'lastName' => 'Doe',
'jobTitle' => 'CEO',
'taxIdNumber' => '876543210',
'phoneNumber' => '5555559876',
'dob' => '1981-02-02',
'ownership' => '50',
'email' => '[email protected]',
'dlNumber' => 'D7654321',
'dlStateOrProvince' => 'UT',
'dlExpiration' => '2024-12-31',
'address' => [
'address1' => '355 S 520 W',
'city' => 'Lindon',
'stateOrProvince' => 'UT',
'postalCode' => '84042',
'countryCode' => 'US',
],
],
],
'manualAccount' => [
'name' => 'Business Checking',
'bank' => 'Test Bank',
'accountHolderName' => 'BlockChyp Inc.',
'routingNumber' => '124001545',
'accountNumber' => '987654321',
],
'averageTransaction' => '100.00',
'highTransaction' => '1000.00',
'averageMonth' => '10000.00',
'highMonth' => '20000.00',
'refundPolicy' => '30_DAYS',
'refundDays' => '30',
'timeZone' => 'America/Denver',
'batchCloseTime' => '23:59',
'multipleLocations' => 'false',
'ebtRequested' => 'false',
'ecommerce' => 'true',
'cardPresentPercentage' => '70',
'phoneOrderPercentage' => '10',
'ecomPercentage' => '20',
'signerName' => 'John Doe',
];

// self::logRequest($request);

try {

$response = BlockChyp::submitApplication($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 b90b0c6

Please sign in to comment.