diff --git a/README.md b/README.md index 7f74a62..ec7df43 100644 --- a/README.md +++ b/README.md @@ -4690,6 +4690,54 @@ echo 'Response: ' . print_r($response, true) . PHP_EOL; ``` +#### Merchant Credential Generation + + + +* **API Credential Types:** Partner +* **Required Role:** Partner API Access + +This API allows partners to generate API credentials for a merchant. + +The `merchantId` is required and must be the id of a valid merchant. + +Credentials are not delete protected by default. Pass in `deleteProtected` to enable delete protection. + +The optional `notes` field will populate the notes in the credentials. + +By default no roles will be assigned unless valid, comma-delimited, role codes are passed in the `roles` field. + + + + +```php +setHttpStatus($httpStatus); $instance->setHttpBody($httpBody); - $instance->setJsonBody(json_decode($httpBody, true)); - + if (isset($httpBody)) { + $httpBody = json_decode($httpBody, true); + } + $instance->setJsonBody($httpBody); + return $instance; } diff --git a/tests/itests/CancelPaymentLinkTest.php b/tests/itests/CancelPaymentLinkTest.php index d3b67b9..a79b0ea 100644 --- a/tests/itests/CancelPaymentLinkTest.php +++ b/tests/itests/CancelPaymentLinkTest.php @@ -75,6 +75,7 @@ public function testCancelPaymentLink() // Set request values $request = [ + 'test' => true, 'linkCode' => $lastLinkCode, ]; diff --git a/tests/itests/MerchantCredentialGenerationTest.php b/tests/itests/MerchantCredentialGenerationTest.php new file mode 100644 index 0000000..37da93b --- /dev/null +++ b/tests/itests/MerchantCredentialGenerationTest.php @@ -0,0 +1,87 @@ +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 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' => $response['merchantId'], + ]; + + // self::logRequest($request); + + try { + + $response = BlockChyp::merchantCredentialGeneration($request); + + // self::logResponse($response); + + // Response assertions + + $this->assertTrue($response['success']); + + } catch (Exception $ex) { + + echo $ex->getTraceAsString(); + $this->assertEmpty($ex); + + } + $this->processResponseDelay($request); + } +} diff --git a/tests/itests/PANPreauthTest.php b/tests/itests/PANPreauthTest.php index aea138c..cca38cf 100644 --- a/tests/itests/PANPreauthTest.php +++ b/tests/itests/PANPreauthTest.php @@ -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); @@ -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) { diff --git a/tests/itests/PartnerCommissionBreakdownTest.php b/tests/itests/PartnerCommissionBreakdownTest.php index 22821c9..c970894 100644 --- a/tests/itests/PartnerCommissionBreakdownTest.php +++ b/tests/itests/PartnerCommissionBreakdownTest.php @@ -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, ]; diff --git a/tests/itests/PartnerStatementDetailTest.php b/tests/itests/PartnerStatementDetailTest.php index 2116f8d..dc77b89 100644 --- a/tests/itests/PartnerStatementDetailTest.php +++ b/tests/itests/PartnerStatementDetailTest.php @@ -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, ]; diff --git a/tests/itests/PartnerStatementsTest.php b/tests/itests/PartnerStatementsTest.php index 6d5bd8b..f5ba992 100644 --- a/tests/itests/PartnerStatementsTest.php +++ b/tests/itests/PartnerStatementsTest.php @@ -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, ]; diff --git a/tests/itests/PricingPolicyTest.php b/tests/itests/PricingPolicyTest.php index bb756b8..eb6477d 100644 --- a/tests/itests/PricingPolicyTest.php +++ b/tests/itests/PricingPolicyTest.php @@ -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' => '', + 'merchantId' => $response['merchantId'], ]; // self::logRequest($request); diff --git a/tests/itests/ResendPaymentLinkTest.php b/tests/itests/ResendPaymentLinkTest.php index be9ead0..334d632 100644 --- a/tests/itests/ResendPaymentLinkTest.php +++ b/tests/itests/ResendPaymentLinkTest.php @@ -75,6 +75,7 @@ public function testResendPaymentLink() // Set request values $request = [ + 'test' => true, 'linkCode' => $lastLinkCode, ]; diff --git a/tests/itests/SimpleCaptureTest.php b/tests/itests/SimpleCaptureTest.php index 396e333..bb6e34a 100644 --- a/tests/itests/SimpleCaptureTest.php +++ b/tests/itests/SimpleCaptureTest.php @@ -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); diff --git a/tests/itests/TCLogTest.php b/tests/itests/TCLogTest.php index 544aa32..6fcb5a8 100644 --- a/tests/itests/TCLogTest.php +++ b/tests/itests/TCLogTest.php @@ -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 = [ ]; diff --git a/tests/itests/Test.php b/tests/itests/Test.php new file mode 100644 index 0000000..b394132 --- /dev/null +++ b/tests/itests/Test.php @@ -0,0 +1,46 @@ +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 Test...' . PHP_EOL; // Set request values + $request = [ + ]; + + // self::logRequest($request); + + try { + + $response = BlockChyp::merchantCredentialGeneration($request); + + // self::logResponse($response); + + // Response assertions + + } catch (Exception $ex) { + + echo $ex->getTraceAsString(); + $this->assertEmpty($ex); + + } + $this->processResponseDelay($request); + } +}