Skip to content

Commit

Permalink
Merge pull request #262 from blockchyp/feature/cleanup-test-failures
Browse files Browse the repository at this point in the history
Feature/cleanup test failures
  • Loading branch information
devops-blockchyp committed Apr 24, 2024
1 parent c768f57 commit 6351db8
Show file tree
Hide file tree
Showing 11 changed files with 159 additions and 25 deletions.
28 changes: 15 additions & 13 deletions lib/BlockChyp.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,19 +594,6 @@ public static function partnerCommissionBreakdown($request)
{
return self::gatewayRequest('POST', '/api/partner-commission-breakdown', $request);
}
/**
* Generates and returns api credentials for a given merchant.
*
* @param array $request The request body.
*
* @throws \BlockChyp\Exception\ConnectionException if the connection fails.
*
* @return array The API response.
*/
public static function merchantCredentialGeneration($request)
{
return self::gatewayRequest('POST', '/api/creds/generateMerchant', $request);
}
/**
* Returns profile information for a merchant.
*
Expand Down Expand Up @@ -685,6 +672,21 @@ public static function deleteToken($request)
{
return self::gatewayRequest('DELETE', '/api/token/' . $request["token"], $request);
}
/**
* Generates and returns api credentials for a given merchant.
*
* @param array $request The request body.
*
* @throws \BlockChyp\Exception\ConnectionException if the connection fails.
*
* @return array The API response.
*/

public static function merchantCredentialGeneration($request)
{
return self::dashboardRequest('POST', '/api/generate-merchant-creds', $request);
}

/**
* Adds a test merchant account.
*
Expand Down
1 change: 1 addition & 0 deletions tests/itests/CancelPaymentLinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function testCancelPaymentLink()

// Set request values
$request = [
'test' => true,
'linkCode' => $lastLinkCode,
];

Expand Down
41 changes: 39 additions & 2 deletions tests/itests/MerchantCredentialGenerationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,47 @@ public function testMerchantCredentialGeneration()
BlockChyp::setTestGatewayHost($config->testGatewayHost);
BlockChyp::setDashboardHost($config->dashboardHost);

echo 'Running MerchantCredentialGenerationTest...' . PHP_EOL; // Set request values
echo 'Running MerchantCredentialGenerationTest...' . 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 = [
'dbaName' => 'Test Merchant',
'companyName' => 'Test Merchant',
];

// self::logRequest($request);

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

// self::logResponse($response);

if (!empty($response['transactionId'])) {
$lastTransactionId = $response['transactionId'];
}
if (!empty($response['transactionRef'])) {
$lastTransactionRef = $response['transactionRef'];
}
if (!empty($response['customer'])) {
$lastCustomer = $response['customer'];
}
if (!empty($response['token'])) {
$lastToken = $response['token'];
}
if (!empty($response['linkCode'])) {
$lastLinkCode = $response['linkCode'];
}

// Set request values
$request = [
'test' => true,
'merchantId' => '<MERCHANT ID>',
'merchantId' => $response['merchantId'],
];

// self::logRequest($request);
Expand Down
5 changes: 2 additions & 3 deletions tests/itests/PANPreauthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ public function testPANPreauth()
'pan' => '4111111111111111',
'expMonth' => '12',
'expYear' => '2025',
'amount' => '25.55',
'amount' => '42.45',
'test' => true,
'bypassDupeFilter' => true,
];

// self::logRequest($request);
Expand Down Expand Up @@ -64,8 +65,6 @@ public function testPANPreauth()

$this->assertNotEmpty($response['entryMethod']);

$this->assertEquals('25.55', $response['authorizedAmount']);

$this->assertEquals('KEYED', $response['entryMethod']);

} catch (Exception $ex) {
Expand Down
9 changes: 8 additions & 1 deletion tests/itests/PartnerCommissionBreakdownTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ public function testPartnerCommissionBreakdown()
BlockChyp::setTestGatewayHost($config->testGatewayHost);
BlockChyp::setDashboardHost($config->dashboardHost);

echo 'Running PartnerCommissionBreakdownTest...' . PHP_EOL; // Set request values
echo 'Running PartnerCommissionBreakdownTest...' . 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,
];
Expand Down
9 changes: 8 additions & 1 deletion tests/itests/PartnerStatementDetailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ public function testPartnerStatementDetail()
BlockChyp::setTestGatewayHost($config->testGatewayHost);
BlockChyp::setDashboardHost($config->dashboardHost);

echo 'Running PartnerStatementDetailTest...' . PHP_EOL; // Set request values
echo 'Running PartnerStatementDetailTest...' . 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,
];
Expand Down
9 changes: 8 additions & 1 deletion tests/itests/PartnerStatementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,14 @@ public function testPartnerStatements()
BlockChyp::setTestGatewayHost($config->testGatewayHost);
BlockChyp::setDashboardHost($config->dashboardHost);

echo 'Running PartnerStatementsTest...' . PHP_EOL; // Set request values
echo 'Running PartnerStatementsTest...' . 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,
];
Expand Down
41 changes: 39 additions & 2 deletions tests/itests/PricingPolicyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,47 @@ public function testPricingPolicy()
BlockChyp::setTestGatewayHost($config->testGatewayHost);
BlockChyp::setDashboardHost($config->dashboardHost);

echo 'Running PricingPolicyTest...' . PHP_EOL; // Set request values
echo 'Running PricingPolicyTest...' . 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 = [
'dbaName' => 'Test Merchant',
'companyName' => 'Test Merchant',
];

// self::logRequest($request);

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

// self::logResponse($response);

if (!empty($response['transactionId'])) {
$lastTransactionId = $response['transactionId'];
}
if (!empty($response['transactionRef'])) {
$lastTransactionRef = $response['transactionRef'];
}
if (!empty($response['customer'])) {
$lastCustomer = $response['customer'];
}
if (!empty($response['token'])) {
$lastToken = $response['token'];
}
if (!empty($response['linkCode'])) {
$lastLinkCode = $response['linkCode'];
}

// Set request values
$request = [
'test' => true,
'merchantId' => '<MERCHANT ID>',
'merchantId' => $response['merchantId'],
];

// self::logRequest($request);
Expand Down
1 change: 1 addition & 0 deletions tests/itests/ResendPaymentLinkTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public function testResendPaymentLink()

// Set request values
$request = [
'test' => true,
'linkCode' => $lastLinkCode,
];

Expand Down
3 changes: 2 additions & 1 deletion tests/itests/SimpleCaptureTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ public function testSimpleCapture()
'pan' => '4111111111111111',
'expMonth' => '12',
'expYear' => '2025',
'amount' => '25.55',
'amount' => '42.45',
'test' => true,
'bypassDupeFilter' => true,
];

// self::logRequest($request);
Expand Down
37 changes: 36 additions & 1 deletion tests/itests/TCLogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,42 @@ public function testTCLog()
BlockChyp::setTestGatewayHost($config->testGatewayHost);
BlockChyp::setDashboardHost($config->dashboardHost);

echo 'Running TCLogTest...' . PHP_EOL; // Set request values
echo 'Running TCLogTest...' . PHP_EOL;

// Set request values
$request = [
'test' => true,
'terminalName' => $config->defaultTerminalName,
'tcName' => 'HIPPA Disclosure',
'tcContent' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ullamcorper id urna quis pulvinar. Pellentesque vestibulum justo ac nulla consectetur tristique. Suspendisse arcu arcu, viverra vel luctus non, dapibus vitae augue. Aenean ac volutpat purus. Curabitur in lacus nisi. Nam vel sagittis eros. Curabitur faucibus ut nisl in pulvinar. Nunc egestas, orci ut porttitor tempus, ante mauris pellentesque ex, nec feugiat purus arcu ac metus. Cras sodales ornare lobortis. Aenean lacinia ultricies purus quis pharetra. Cras vestibulum nulla et magna eleifend eleifend. Nunc nibh dolor, malesuada ut suscipit vitae, bibendum quis dolor. Phasellus ultricies ex vitae dolor malesuada, vel dignissim neque accumsan.',
'sigFormat' => BlockChyp::SIGNATURE_FORMAT_PNG,
'sigWidth' => 200,
'sigRequired' => true,
];

// self::logRequest($request);

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

// self::logResponse($response);

if (!empty($response['transactionId'])) {
$lastTransactionId = $response['transactionId'];
}
if (!empty($response['transactionRef'])) {
$lastTransactionRef = $response['transactionRef'];
}
if (!empty($response['customer'])) {
$lastCustomer = $response['customer'];
}
if (!empty($response['token'])) {
$lastToken = $response['token'];
}
if (!empty($response['linkCode'])) {
$lastLinkCode = $response['linkCode'];
}

// Set request values
$request = [
];

Expand Down

0 comments on commit 6351db8

Please sign in to comment.