Skip to content

Commit 41baab4

Browse files
committed
Adding sample test for decrypt - VCO
1 parent 1c3eda8 commit 41baab4

4 files changed

Lines changed: 54 additions & 19 deletions

File tree

classmap.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@
249249
'net\authorize\api\contract\v1\BankAccountType' => $libDir . 'net/authorize/api/contract/v1/Bank`AccountType.php',
250250
'net\authorize\api\contract\v1\BatchDetailsType' => $libDir . 'net/authorize/api/contract/v1/BatchDetailsType.php',
251251
'net\authorize\api\contract\v1\BatchStatisticType' => $libDir . 'net/authorize/api/contract/v1/BatchStatisticType.php',
252+
'net\authorize\api\contract\v1\CardArtType' => $libDir . 'net/authorize/api/contract/v1/CardArtType.php',
252253
'net\authorize\api\contract\v1\CcAuthenticationType' => $libDir . 'net/authorize/api/contract/v1/CcAuthenticationType.php',
253254
'net\authorize\api\contract\v1\CreateCustomerPaymentProfileRequest' => $libDir . 'net/authorize/api/contract/v1/CreateCustomerPaymentProfileRequest.php',
254255
'net\authorize\api\contract\v1\CreateCustomerPaymentProfileResponse' => $libDir . 'net/authorize/api/contract/v1/CreateCustomerPaymentProfileResponse.php',
@@ -259,8 +260,6 @@
259260
'net\authorize\api\contract\v1\CreateCustomerProfileTransactionResponse' => $libDir . 'net/authorize/api/contract/v1/CreateCustomerProfileTransactionResponse.php',
260261
'net\authorize\api\contract\v1\CreateCustomerShippingAddressRequest' => $libDir . 'net/authorize/api/contract/v1/CreateCustomerShippingAddressRequest.php',
261262
'net\authorize\api\contract\v1\CreateCustomerShippingAddressResponse' => $libDir . 'net/authorize/api/contract/v1/CreateCustomerShippingAddressResponse.php',
262-
'net\authorize\api\contract\v1\CreateFingerPrintRequest' => $libDir . 'net/authorize/api/contract/v1/CreateFingerPrintRequest.php',
263-
'net\authorize\api\contract\v1\CreateFingerPrintResponse' => $libDir . 'net/authorize/api/contract/v1/CreateFingerPrintResponse.php',
264263
'net\authorize\api\contract\v1\CreateProfileResponseType' => $libDir . 'net/authorize/api/contract/v1/CreateProfileResponseType.php',
265264
'net\authorize\api\contract\v1\CreateTransactionRequest' => $libDir . 'net/authorize/api/contract/v1/CreateTransactionRequest.php',
266265
'net\authorize\api\contract\v1\CreateTransactionResponse' => $libDir . 'net/authorize/api/contract/v1/CreateTransactionResponse.php',
@@ -282,6 +281,8 @@
282281
'net\authorize\api\contract\v1\CustomerProfileSummaryType' => $libDir . 'net/authorize/api/contract/v1/CustomerProfileSummaryType.php',
283282
'net\authorize\api\contract\v1\CustomerProfileType' => $libDir . 'net/authorize/api/contract/v1/CustomerProfileType.php',
284283
'net\authorize\api\contract\v1\CustomerType' => $libDir . 'net/authorize/api/contract/v1/CustomerType.php',
284+
'net\authorize\api\contract\v1\DecryptPaymentDataRequest' => $libDir . 'net/authorize/api/contract/v1/DecryptPaymentDataRequest.php',
285+
'net\authorize\api\contract\v1\DecryptPaymentDataResponse' => $libDir . 'net/authorize/api/contract/v1/DecryptPaymentDataResponse.php',
285286
'net\authorize\api\contract\v1\DeleteCustomerPaymentProfileRequest' => $libDir . 'net/authorize/api/contract/v1/DeleteCustomerPaymentProfileRequest.php',
286287
'net\authorize\api\contract\v1\DeleteCustomerPaymentProfileResponse' => $libDir . 'net/authorize/api/contract/v1/DeleteCustomerPaymentProfileResponse.php',
287288
'net\authorize\api\contract\v1\DeleteCustomerProfileRequest' => $libDir . 'net/authorize/api/contract/v1/DeleteCustomerProfileRequest.php',
@@ -296,7 +297,6 @@
296297
'net\authorize\api\contract\v1\ErrorResponse' => $libDir . 'net/authorize/api/contract/v1/ErrorResponse.php',
297298
'net\authorize\api\contract\v1\ExtendedAmountType' => $libDir . 'net/authorize/api/contract/v1/ExtendedAmountType.php',
298299
'net\authorize\api\contract\v1\FDSFilterType' => $libDir . 'net/authorize/api/contract/v1/FDSFilterType.php',
299-
'net\authorize\api\contract\v1\FingerPrintSupportInformationType' => $libDir . 'net/authorize/api/contract/v1/FingerPrintSupportInformationType.php',
300300
'net\authorize\api\contract\v1\FingerPrintType' => $libDir . 'net/authorize/api/contract/v1/FingerPrintType.php',
301301
'net\authorize\api\contract\v1\GetBatchStatisticsRequest' => $libDir . 'net/authorize/api/contract/v1/GetBatchStatisticsRequest.php',
302302
'net\authorize\api\contract\v1\GetBatchStatisticsResponse' => $libDir . 'net/authorize/api/contract/v1/GetBatchStatisticsResponse.php',
@@ -340,6 +340,7 @@
340340
'net\authorize\api\contract\v1\OrderExType' => $libDir . 'net/authorize/api/contract/v1/OrderExType.php',
341341
'net\authorize\api\contract\v1\OrderType' => $libDir . 'net/authorize/api/contract/v1/OrderType.php',
342342
'net\authorize\api\contract\v1\PagingType' => $libDir . 'net/authorize/api/contract/v1/PagingType.php',
343+
'net\authorize\api\contract\v1\PaymentDetailsType' => $libDir . 'net/authorize/api/contract/v1/PaymentDetailsType.php',
343344
'net\authorize\api\contract\v1\PaymentMaskedType' => $libDir . 'net/authorize/api/contract/v1/PaymentMaskedType.php',
344345
'net\authorize\api\contract\v1\PaymentProfileType' => $libDir . 'net/authorize/api/contract/v1/PaymentProfileType.php',
345346
'net\authorize\api\contract\v1\PaymentScheduleType' => $libDir . 'net/authorize/api/contract/v1/PaymentScheduleType.php',
@@ -410,8 +411,8 @@
410411
'net\authorize\api\controller\CreateCustomerProfileFromTransactionController' => $libDir . 'net/authorize/api/controller/CreateCustomerProfileFromTransactionController.php',
411412
'net\authorize\api\controller\CreateCustomerProfileTransactionController' => $libDir . 'net/authorize/api/controller/CreateCustomerProfileTransactionController.php',
412413
'net\authorize\api\controller\CreateCustomerShippingAddressController' => $libDir . 'net/authorize/api/controller/CreateCustomerShippingAddressController.php',
413-
'net\authorize\api\controller\CreateFingerPrintController' => $libDir . 'net/authorize/api/controller/CreateFingerPrintController.php',
414414
'net\authorize\api\controller\CreateTransactionController' => $libDir . 'net/authorize/api/controller/CreateTransactionController.php',
415+
'net\authorize\api\controller\DecryptPaymentDataController' => $libDir . 'net/authorize/api/controller/DecryptPaymentDataController.php',
415416
'net\authorize\api\controller\DeleteCustomerPaymentProfileController' => $libDir . 'net/authorize/api/controller/DeleteCustomerPaymentProfileController.php',
416417
'net\authorize\api\controller\DeleteCustomerProfileController' => $libDir . 'net/authorize/api/controller/DeleteCustomerProfileController.php',
417418
'net\authorize\api\controller\DeleteCustomerShippingAddressController' => $libDir . 'net/authorize/api/controller/DeleteCustomerShippingAddressController.php',

genclass.sh

100755100644
File mode changed.

lib/net/authorize/api/controller/CreateFingerPrintController.php renamed to lib/net/authorize/api/controller/DecryptPaymentDataController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
use net\authorize\api\contract\v1\AnetApiRequestType;
55
use net\authorize\api\controller\base\ApiOperationBase;
66

7-
class CreateFingerPrintController extends ApiOperationBase
7+
class DecryptPaymentDataController extends ApiOperationBase
88
{
99
public function __construct(AnetApiRequestType $request)
1010
{
11-
$responseType = 'net\authorize\api\contract\v1\CreateFingerPrintResponse';
11+
$responseType = 'net\authorize\api\contract\v1\DecryptPaymentDataResponse';
1212
parent::__construct($request, $responseType);
1313
}
1414

tests/Controller_Test.php

Lines changed: 47 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
require_once __DIR__ . '/../autoload.php';
55
//include if tests/bootstrap.php is not loaded automatically
6-
//require_once __DIR__ . '/bootstrap.php';
6+
require_once __DIR__ . '/bootstrap.php';
77

88
class Controller_Test extends PHPUnit_Framework_TestCase
99
{
1010
public function testARBGetSubscriptionList()
1111
{
12-
$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
12+
//$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
1313

1414
$name = (defined('AUTHORIZENET_API_LOGIN_ID') && ''!=AUTHORIZENET_API_LOGIN_ID) ? AUTHORIZENET_API_LOGIN_ID : getenv("api_login_id");
1515
$transactionKey = (defined('AUTHORIZENET_TRANSACTION_KEY') && ''!=AUTHORIZENET_TRANSACTION_KEY) ? AUTHORIZENET_TRANSACTION_KEY : getenv("transaction_key");
@@ -37,7 +37,7 @@ public function testARBGetSubscriptionList()
3737
$request->setMerchantAuthentication($merchantAuthentication);
3838

3939
//$controller = new ApiOperationBase($request, 'net\authorize\api\contract\v1\ARBGetSubscriptionListResponse');
40-
$controller = new TestController( $request);
40+
$controller = new net\authorize\api\controller\ARBGetSubscriptionListController( $request);
4141
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
4242

4343
// Handle the response.
@@ -53,18 +53,52 @@ public function testARBGetSubscriptionList()
5353
$this->assertEquals("Successful.", $response->getText());
5454
}
5555
}
56-
}
5756

58-
class TestController extends ApiOperationBase
59-
{
60-
public function __construct(\net\authorize\api\contract\v1\AnetApiRequestType $request)
57+
public function testDecryptPaymentData()
6158
{
62-
$responseType = 'net\authorize\api\contract\v1\ARBGetSubscriptionListResponse';
63-
parent::__construct($request, $responseType);
64-
}
59+
//$this->markTestSkipped('Ignoring for Travis. Will fix after release.'); //TODO
6560

66-
protected function validateRequest()
67-
{
68-
//empty
61+
//using sandbox account log in to mint and enable visa checkout
62+
//You'll get a VCO api key.
63+
//on web page you can create and grab (from the JS console) Visa Checkout Payment Data
64+
//http://brianmc.github.io/checkout.html
65+
66+
$name = (defined('AUTHORIZENET_API_LOGIN_ID') && ''!=AUTHORIZENET_API_LOGIN_ID) ? AUTHORIZENET_API_LOGIN_ID : getenv("api_login_id");
67+
$transactionKey = (defined('AUTHORIZENET_TRANSACTION_KEY') && ''!=AUTHORIZENET_TRANSACTION_KEY) ? AUTHORIZENET_TRANSACTION_KEY : getenv("transaction_key");
68+
69+
$merchantAuthentication = new net\authorize\api\contract\v1\MerchantAuthenticationType();
70+
$merchantAuthentication->setName($name);
71+
$merchantAuthentication->setTransactionKey($transactionKey);
72+
73+
$refId = 'ref' . time();
74+
$callId = "8880580142324354001";
75+
76+
$opaqueData = new net\authorize\api\contract\v1\OpaqueDataType();
77+
$opaqueData->setDataDescriptor("COMMON.VCO.ON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Stkci7tglkDLFKV/IG7cRtEZ0wEYVVIcX/HzL8M8IoaNQKVkRGb7/cnIiE8zi1uUZjnTXrNIKf0PdIVrr2JHgfw5az2tj921O7v/BwP8vyEl2IoCD5fYZpwBU8JAmGLhtMTFExOBDsQsJWp5w+cdJJ8VJg1w1bXt6NxcZ9U9qfkpf4wJ8TYROF349Zgcl0gjBjCRlTaQnisySXcZBfpweYCVuwKKHXw=");
80+
//"partialShippingAddress":{"countryCode":"US","postalCode":"98103"},"callid":"8880580142324354001","vInitRequest":{"apikey":"GY3CQNLRHKE63GWCVLHH13Ff12umyj4ZglGhGdCM6y6Liy0YE","paymentRequest":{"currencyCode":"USD","total":"16.00"},"parentUrl":"http://brianmc.github.io/checkout.html","browserLocale":"en_US","clientId":"848a93dc-8d84-48fe-9d88-e7d1e9e50abb","allowEnrollment":true,"settings":{}}}
81+
82+
$request = new net\authorize\api\contract\v1\DecryptPaymentDataRequest();
83+
$request->setRefId( $refId);
84+
$request->setMerchantAuthentication($merchantAuthentication);
85+
$request->setOpaqueData($opaqueData);
86+
$request->setCallId($callId);
87+
88+
$controller = new net\authorize\api\controller\DecryptPaymentDataController( $request);
89+
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);
90+
91+
// Handle the response.
92+
$this->assertNotNull($response, "null response");
93+
$this->assertNotNull($response->getMessages());
94+
95+
$this->assertEquals("Ok", $response->getMessages()->getResultCode());
96+
//$this->assertEquals($response->getRefId(), $refId);
97+
$this->assertTrue(0 < count($response->getMessages()));
98+
foreach ($response->getMessages() as $message)
99+
{
100+
$this->assertEquals("I00001", $message->getCode());
101+
$this->assertEquals("Successful.", $response->getText());
102+
}
69103
}
70104
}

0 commit comments

Comments
 (0)