Skip to content

Commit

Permalink
Adding changes for 12.31.0 upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
mishravinod202 committed Jul 6, 2023
1 parent eabb66d commit 75c84fe
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 92 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
= CnpOnline CHANGELOG

==Version 12.31.0 (Jul 08, 2023)
* Feature: [cnpAPI v12.31] New element foreignRetailerIndicator of type enum added in capture, captureGivenAuth, forceCapture, sale request.
* Change: [cnpAPI v12.31] phpseclib is upgraded to phpseclib3 to support modern ciphers during sftp sessions.

==Version 12.30.0 (Mar 14, 2023)
Note: It contains changes from cnpAPI v12.30 . In case you need any feature supported by cnpAPI v12.30, please use SDK version 12.30.0.

Expand Down
12 changes: 8 additions & 4 deletions cnp/sdk/CnpOnlineRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,8 @@ public function saleRequest($hash_in)
'productEnrolled' => XmlFields::returnArrayValue($hash_in, 'productEnrolled'),
'decisionPurpose' => XmlFields::returnArrayValue($hash_in, 'decisionPurpose'),
'fraudSwitchIndicator' => XmlFields::returnArrayValue($hash_in, 'fraudSwitchIndicator'),
'passengerTransportData' => XmlFields::passengerTransportData(XmlFields::returnArrayValue($hash_in, 'passengerTransportData'))
'passengerTransportData' => XmlFields::passengerTransportData(XmlFields::returnArrayValue($hash_in, 'passengerTransportData')),
'foreignRetailerIndicator' => XmlFields::returnArrayValue($hash_in, 'foreignRetailerIndicator')
);

$choice_hash = array($hash_out['card'], $hash_out['paypal'], $hash_out['token'], $hash_out['paypage'], $hash_out['applepay'], $hash_out['mpos']);
Expand Down Expand Up @@ -430,7 +431,8 @@ public function forceCaptureRequest($hash_in)
'processingType' => XmlFields::returnArrayValue($hash_in, 'processingType'),
'merchantCategoryCode' => XmlFields::returnArrayValue($hash_in, 'merchantCategoryCode'),
'businessIndicator' => XmlFields::returnArrayValue($hash_in, 'businessIndicator'),
'passengerTransportData' => XmlFields::passengerTransportData(XmlFields::returnArrayValue($hash_in, 'passengerTransportData'))
'passengerTransportData' => XmlFields::passengerTransportData(XmlFields::returnArrayValue($hash_in, 'passengerTransportData')),
'foreignRetailerIndicator' => XmlFields::returnArrayValue($hash_in, 'foreignRetailerIndicator')
);

$choice_hash = array(XmlFields::returnArrayValue($hash_out, 'card'), XmlFields::returnArrayValue($hash_out, 'paypal'), XmlFields::returnArrayValue($hash_out, 'token'), XmlFields::returnArrayValue($hash_out, 'paypage'), XmlFields::returnArrayValue($hash_out, 'mpos'));
Expand Down Expand Up @@ -459,7 +461,8 @@ public function captureRequest($hash_in)
'payPalNotes' => XmlFields::returnArrayValue($hash_in, 'payPalNotes'),
'lodgingInfo' => XmlFields::lodgingInfo(XmlFields::returnArrayValue($hash_in, 'lodgingInfo')),
'pin' => XmlFields::returnArrayValue($hash_in, 'pin'),
'passengerTransportData' => XmlFields::passengerTransportData(XmlFields::returnArrayValue($hash_in, 'passengerTransportData'))
'passengerTransportData' => XmlFields::passengerTransportData(XmlFields::returnArrayValue($hash_in, 'passengerTransportData')),
'foreignRetailerIndicator' => XmlFields::returnArrayValue($hash_in, 'foreignRetailerIndicator')
);
$captureResponse = $this->processRequest($hash_out, $hash_in, 'capture');

Expand Down Expand Up @@ -505,7 +508,8 @@ public function captureGivenAuthRequest($hash_in)
'merchantCategoryCode' => XmlFields::returnArrayValue($hash_in, 'merchantCategoryCode'),
'businessIndicator' => XmlFields::returnArrayValue($hash_in, 'businessIndicator'),
'crypto' => XmlFields::returnArrayValue($hash_in, 'crypto'),
'passengerTransportData' => XmlFields::passengerTransportData(XmlFields::returnArrayValue($hash_in, 'passengerTransportData'))
'passengerTransportData' => XmlFields::passengerTransportData(XmlFields::returnArrayValue($hash_in, 'passengerTransportData')),
'foreignRetailerIndicator' => XmlFields::returnArrayValue($hash_in, 'foreignRetailerIndicator')
);

$choice_hash = array($hash_out['card'], $hash_out['token'], $hash_out['paypage'], $hash_out['mpos']);
Expand Down
39 changes: 2 additions & 37 deletions cnp/sdk/Test/functional/AuthFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ public function test_simple_auth_with_amount()
$this->assertEquals('sandbox', $location);
}

public function test_simple_auth_with_authIndicatorenum_estimated()
public function test_simple_auth_with_authIndicatorEnum_estimated()
{
$hash_in = array(
'id' => 'id',
Expand Down Expand Up @@ -1259,7 +1259,7 @@ public function test_simple_auth_with_authIndicatorenum_estimated()
$this->assertEquals('sandbox', $location);
}

public function test_simple_auth_with_authIndicator_increamental()
public function test_simple_auth_with_authIndicator_incremental()
{
$hash_in = array(
'id' => 'id',
Expand Down Expand Up @@ -1290,39 +1290,4 @@ public function test_simple_auth_with_authIndicator_increamental()
$location = XmlParser::getNode($authorizationResponse, 'location');
$this->assertEquals('sandbox', $location);
}

public function test_simple_auth_with_foreignRetailerIndicatorEnum()
{
$hash_in = array(
'id' => 'id',
'orderId' => 'OnlineCust01',
'amount' => '1001',
'orderSource' => 'telephone',
'billToAddress' => array(
'name' => 'Jonathan Ross',
'addressLine1' => '10th Floor',
'addressLine2' => 'Tower 2',
'addressLine3' => '900 Chelmsford Street',
'city' => 'Lowell',
'state' => 'MA',
'zip' => '01851',
'country' => 'USA',
'email' => 'jross@litle.com<',
'phone' => '800-548-5326'),
'card' => array(
'type' => 'VI',
'number' => '4003002345678903',
'expDate' => '1199'),
'authIndicator' => 'Estimated',
'foreignRetailerIndicator' => 'F'

);
$initialize = new CnpOnlineRequest();
$authorizationResponse = $initialize->authorizationRequest($hash_in);
$message = XmlParser::getAttribute($authorizationResponse, 'cnpOnlineResponse', 'message');
$this->assertEquals("Valid Format", $message);
$location = XmlParser::getNode($authorizationResponse, 'location');
$this->assertEquals('sandbox', $location);
}

}
6 changes: 3 additions & 3 deletions cnp/sdk/Test/functional/BatchRequestFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1811,7 +1811,7 @@ public function test_mechaBatchSFTP()
'orderId'=> '2111',
'orderSource'=>'ecommerce',
'id'=>'654',
'amount'=>'123');
'amount'=>'1123');
$batch->addAuth($hash_in);

$hash_in = array(
Expand All @@ -1822,7 +1822,7 @@ public function test_mechaBatchSFTP()
'id'=>'654',
'orderId'=> '2111',
'orderSource'=>'ecommerce',
'amount'=>'123');
'amount'=>'1123');
$batch->addSale($hash_in);
$request->addBatchRequest($batch);

Expand Down Expand Up @@ -2010,7 +2010,7 @@ public function test_auth_with_additionalCOFData_batch()
$hash_in = array(
'id'=>'0001',
'orderId' => '82364_cnpApiAuth',
'amount' => '2870',
'amount' => '1870',
'orderSource' => 'telephone',
'billToAddress' => array(
'name' => 'David Berman A',
Expand Down
8 changes: 4 additions & 4 deletions cnp/sdk/Test/functional/CnpRequestFunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public function test_addBatch()
$this->assertFalse(file_exists($fn2));


$expected = '<batchRequestmerchantId="0180-xml10"merchantSdk="PHP;12.30.0"authAmount="0"numAuths="0"saleAmount="123"numSales="1"creditAmount="0"numCredits="0"giftCardCreditAmount="0"numGiftCardCredits="0"numTokenRegistrations="0"numTranslateToLowValueTokenRequests="0"depositTransactionReversalAmount="0"numDepositTransactionReversals="0"refundTransactionReversalAmount="0"numRefundTransactionReversals="0"captureGivenAuthAmount="0"numCaptureGivenAuths="0"forceCaptureAmount="0"numForceCaptures="0"authReversalAmount="0"numAuthReversals="0"giftCardAuthReversalOriginalAmount="0"numGiftCardAuthReversals="0"captureAmount="0"numCaptures="0"giftCardCaptureAmount="0"numGiftCardCaptures="0"echeckVerificationAmount="0"numEcheckVerification="0"echeckCreditAmount="0"numEcheckCredit="0"numEcheckRedeposit="0"echeckSalesAmount="0"numEcheckSales="0"numUpdateCardValidationNumOnTokens="0"numUpdateSubscriptions="0"numCancelSubscriptions="0"numCreatePlans="0"numUpdatePlans="0"numActivates="0"activateAmount="0"numDeactivates="0"numLoads="0"loadAmount="0"numUnloads="0"unloadAmount="0"numBalanceInquirys="0"numAccountUpdates="0"numEcheckPreNoteSale="0"numEcheckPreNoteCredit="0"submerchantCreditAmount="0"numSubmerchantCredit="0"payFacCreditAmount="0"numPayFacCredit="0"payoutOrgCreditAmount="0"numPayoutOrgCredit="0"reserveCreditAmount="0"numReserveCredit="0"vendorCreditAmount="0"numVendorCredit="0"customerCreditAmount="0"numCustomerCredit="0"physicalCheckCreditAmount="0"numPhysicalCheckCredit="0"submerchantDebitAmount="0"numSubmerchantDebit="0"payFacDebitAmount="0"numPayFacDebit="0"payoutOrgDebitAmount="0"numPayoutOrgDebit="0"reserveDebitAmount="0"numReserveDebit="0"vendorDebitAmount="0"numVendorDebit="0"customerDebitAmount="0"numCustomerDebit="0"physicalCheckDebitAmount="0"numPhysicalCheckDebit="0"numFundingInstructionVoid="0"numFastAccessFunding="0"fastAccessFundingAmount="0">
$expected = '<batchRequestmerchantId="0180-xml10"merchantSdk="PHP;12.31.0"authAmount="0"numAuths="0"saleAmount="123"numSales="1"creditAmount="0"numCredits="0"giftCardCreditAmount="0"numGiftCardCredits="0"numTokenRegistrations="0"numTranslateToLowValueTokenRequests="0"depositTransactionReversalAmount="0"numDepositTransactionReversals="0"refundTransactionReversalAmount="0"numRefundTransactionReversals="0"captureGivenAuthAmount="0"numCaptureGivenAuths="0"forceCaptureAmount="0"numForceCaptures="0"authReversalAmount="0"numAuthReversals="0"giftCardAuthReversalOriginalAmount="0"numGiftCardAuthReversals="0"captureAmount="0"numCaptures="0"giftCardCaptureAmount="0"numGiftCardCaptures="0"echeckVerificationAmount="0"numEcheckVerification="0"echeckCreditAmount="0"numEcheckCredit="0"numEcheckRedeposit="0"echeckSalesAmount="0"numEcheckSales="0"numUpdateCardValidationNumOnTokens="0"numUpdateSubscriptions="0"numCancelSubscriptions="0"numCreatePlans="0"numUpdatePlans="0"numActivates="0"activateAmount="0"numDeactivates="0"numLoads="0"loadAmount="0"numUnloads="0"unloadAmount="0"numBalanceInquirys="0"numAccountUpdates="0"numEcheckPreNoteSale="0"numEcheckPreNoteCredit="0"submerchantCreditAmount="0"numSubmerchantCredit="0"payFacCreditAmount="0"numPayFacCredit="0"payoutOrgCreditAmount="0"numPayoutOrgCredit="0"reserveCreditAmount="0"numReserveCredit="0"vendorCreditAmount="0"numVendorCredit="0"customerCreditAmount="0"numCustomerCredit="0"physicalCheckCreditAmount="0"numPhysicalCheckCredit="0"submerchantDebitAmount="0"numSubmerchantDebit="0"payFacDebitAmount="0"numPayFacDebit="0"payoutOrgDebitAmount="0"numPayoutOrgDebit="0"reserveDebitAmount="0"numReserveDebit="0"vendorDebitAmount="0"numVendorDebit="0"customerDebitAmount="0"numCustomerDebit="0"physicalCheckDebitAmount="0"numPhysicalCheckDebit="0"numFundingInstructionVoid="0"numFastAccessFunding="0"fastAccessFundingAmount="0">
<sale reportGroup="Planets" id="1211"><orderId>2111</orderId><amount>123</amount><orderSource>ecommerce</orderSource>
<card><type>VI</type><number>4100000000000000</number><expDate>1213</expDate><cardValidationNum>1213</cardValidationNum></card></sale>
</batchRequest>';
Expand Down Expand Up @@ -117,7 +117,7 @@ public function test_addRFRRequest()
'cnpSessionId' => '8675309'
));

$expected = '<cnpRequest numBatchRequests="0" version="12.30" xmlns="http://www.vantivcnp.com/schema">
$expected = '<cnpRequest numBatchRequests="0" version="12.31" xmlns="http://www.vantivcnp.com/schema">
<authentication><user>XXXXXX</user><password>XXXXXX</password></authentication>
<RFRRequest><cnpSessionId>8675309</cnpSessionId></RFRRequest>
</cnpRequest>';
Expand Down Expand Up @@ -169,10 +169,10 @@ public function test_closeRequest()
$this->assertFalse(file_exists($fn1));
$this->assertTrue(file_exists($request->request_file));

$expected = '<cnpRequest numBatchRequests="1" version="12.30" xmlns="http://www.vantivcnp.com/schema">
$expected = '<cnpRequest numBatchRequests="1" version="12.31" xmlns="http://www.vantivcnp.com/schema">
<authentication><user>XXXXX</user><password>XXXXX</password></authentication>
<batchRequestmerchantId="0180-xml10"merchantSdk="PHP;12.30.0"authAmount="0"numAuths="0"saleAmount="123"numSales="1"creditAmount="0"numCredits="0"giftCardCreditAmount="0"numGiftCardCredits="0"numTokenRegistrations="0"numTranslateToLowValueTokenRequests="0"depositTransactionReversalAmount="0"numDepositTransactionReversals="0"refundTransactionReversalAmount="0"numRefundTransactionReversals="0"captureGivenAuthAmount="0"numCaptureGivenAuths="0"forceCaptureAmount="0"numForceCaptures="0"authReversalAmount="0"numAuthReversals="0"giftCardAuthReversalOriginalAmount="0"numGiftCardAuthReversals="0"captureAmount="0"numCaptures="0"giftCardCaptureAmount="0"numGiftCardCaptures="0"echeckVerificationAmount="0"numEcheckVerification="0"echeckCreditAmount="0"numEcheckCredit="0"numEcheckRedeposit="0"echeckSalesAmount="0"numEcheckSales="0"numUpdateCardValidationNumOnTokens="0"numUpdateSubscriptions="0"numCancelSubscriptions="0"numCreatePlans="0"numUpdatePlans="0"numActivates="0"activateAmount="0"numDeactivates="0"numLoads="0"loadAmount="0"numUnloads="0"unloadAmount="0"numBalanceInquirys="0"numAccountUpdates="0"numEcheckPreNoteSale="0"numEcheckPreNoteCredit="0"submerchantCreditAmount="0"numSubmerchantCredit="0"payFacCreditAmount="0"numPayFacCredit="0"payoutOrgCreditAmount="0"numPayoutOrgCredit="0"reserveCreditAmount="0"numReserveCredit="0"vendorCreditAmount="0"numVendorCredit="0"customerCreditAmount="0"numCustomerCredit="0"physicalCheckCreditAmount="0"numPhysicalCheckCredit="0"submerchantDebitAmount="0"numSubmerchantDebit="0"payFacDebitAmount="0"numPayFacDebit="0"payoutOrgDebitAmount="0"numPayoutOrgDebit="0"reserveDebitAmount="0"numReserveDebit="0"vendorDebitAmount="0"numVendorDebit="0"customerDebitAmount="0"numCustomerDebit="0"physicalCheckDebitAmount="0"numPhysicalCheckDebit="0"numFundingInstructionVoid="0"numFastAccessFunding="0"fastAccessFundingAmount="0">
<batchRequestmerchantId="0180-xml10"merchantSdk="PHP;12.31.0"authAmount="0"numAuths="0"saleAmount="123"numSales="1"creditAmount="0"numCredits="0"giftCardCreditAmount="0"numGiftCardCredits="0"numTokenRegistrations="0"numTranslateToLowValueTokenRequests="0"depositTransactionReversalAmount="0"numDepositTransactionReversals="0"refundTransactionReversalAmount="0"numRefundTransactionReversals="0"captureGivenAuthAmount="0"numCaptureGivenAuths="0"forceCaptureAmount="0"numForceCaptures="0"authReversalAmount="0"numAuthReversals="0"giftCardAuthReversalOriginalAmount="0"numGiftCardAuthReversals="0"captureAmount="0"numCaptures="0"giftCardCaptureAmount="0"numGiftCardCaptures="0"echeckVerificationAmount="0"numEcheckVerification="0"echeckCreditAmount="0"numEcheckCredit="0"numEcheckRedeposit="0"echeckSalesAmount="0"numEcheckSales="0"numUpdateCardValidationNumOnTokens="0"numUpdateSubscriptions="0"numCancelSubscriptions="0"numCreatePlans="0"numUpdatePlans="0"numActivates="0"activateAmount="0"numDeactivates="0"numLoads="0"loadAmount="0"numUnloads="0"unloadAmount="0"numBalanceInquirys="0"numAccountUpdates="0"numEcheckPreNoteSale="0"numEcheckPreNoteCredit="0"submerchantCreditAmount="0"numSubmerchantCredit="0"payFacCreditAmount="0"numPayFacCredit="0"payoutOrgCreditAmount="0"numPayoutOrgCredit="0"reserveCreditAmount="0"numReserveCredit="0"vendorCreditAmount="0"numVendorCredit="0"customerCreditAmount="0"numCustomerCredit="0"physicalCheckCreditAmount="0"numPhysicalCheckCredit="0"submerchantDebitAmount="0"numSubmerchantDebit="0"payFacDebitAmount="0"numPayFacDebit="0"payoutOrgDebitAmount="0"numPayoutOrgDebit="0"reserveDebitAmount="0"numReserveDebit="0"vendorDebitAmount="0"numVendorDebit="0"customerDebitAmount="0"numCustomerDebit="0"physicalCheckDebitAmount="0"numPhysicalCheckDebit="0"numFundingInstructionVoid="0"numFastAccessFunding="0"fastAccessFundingAmount="0">
<sale reportGroup="Planets" id="1211"><orderId>2111</orderId><amount>123</amount><orderSource>ecommerce</orderSource>
<card><type>VI</type><number>4100000000000000</number><expDate>1213</expDate><cardValidationNum>1213</cardValidationNum></card></sale>
</batchRequest>
Expand Down
36 changes: 0 additions & 36 deletions cnp/sdk/Test/unit/AuthUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -552,40 +552,4 @@ public function test_auth_amount()
$cnpTest->newXML = $mock;
$cnpTest->authorizationRequest($hash_in);
}
public function test_auth_foreignRetailerIndicatorEnum()
{
$hash_in = array(
'id' => 'id',
'orderId' => 'OnlineCust01',
'amount' => '1001',
'orderSource' => 'telephone',
'billToAddress' => array(
'name' => 'Jonathan Ross',
'addressLine1' => '10th Floor',
'addressLine2' => 'Tower 2',
'addressLine3' => '900 Chelmsford Street',
'city' => 'Lowell',
'state' => 'MA',
'zip' => '01851',
'country' => 'USA',
'email' => 'jross@litle.com<',
'phone' => '800-548-5326'),
'card' => array(
'type' => 'VI',
'number' => '4003002345678903',
'expDate' => '1199'),
'authIndicator' => 'Estimated',
'foreignRetailerIndicator' => 'F'

);
$mock = $this->getMock('cnp\sdk\CnpXmlMapper');
$mock->expects($this->once())
->method('request')
->with($this->matchesRegularExpression('/.*<authIndicator>Estimated.*/'));

$cnpTest = new CnpOnlineRequest();
$cnpTest->newXML = $mock;
$cnpTest->authorizationRequest($hash_in);
}

}
4 changes: 1 addition & 3 deletions cnp/sdk/Test/unit/CaptureGivenAuthUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,14 +550,12 @@ public function test_capture_given_auth_with_foreignRetailerIndicator()
'originCity' =>'BOS')
),
'foreignRetailerIndicator' => 'F'

);

$mock = $this->getMock('cnp\sdk\CnpXmlMapper');
$mock ->expects($this->once())
->method('request')
->with($this->matchesRegularExpression('/.*<passengerName>Mrs. Huxley234567890123456789.*<ticketNumber>ATL456789012345.*<exchangeAmount>500046.*<serviceClass>First.*<originCity>BOS.*/'));

->with($this->matchesRegularExpression('/.*<foreignRetailerIndicator>F.*/'));
$cnpTest = new CnpOnlineRequest();
$cnpTest->newXML = $mock;
$cnpTest->captureGivenAuthRequest($hash_in);
Expand Down
3 changes: 1 addition & 2 deletions cnp/sdk/Test/unit/CaptureUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,10 @@ public function test_capture_with_foreignRetailerIndicator()
$mock = $this->getMock('cnp\sdk\CnpXmlMapper');
$mock ->expects($this->once())
->method('request')
->with($this->matchesRegularExpression('/.*<passengerName>Mrs. Huxley234567890123456789.*<ticketNumber>ATL456789012345.*<exchangeAmount>500046.*<serviceClass>First.*<originCity>BOS.*/'));
->with($this->matchesRegularExpression('/.*<foreignRetailerIndicator>F.*/'));

$cnpTest = new CnpOnlineRequest();
$cnpTest->newXML = $mock;
$cnpTest->captureRequest($hash_in);
}

}
2 changes: 1 addition & 1 deletion cnp/sdk/Test/unit/ForceCaptureUnitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,7 @@ public function test_forceCapture_with_foreignRetailerIndicator()
$mock = $this->getMock('cnp\sdk\CnpXmlMapper');
$mock ->expects($this->once())
->method('request')
->with($this->matchesRegularExpression('/.*<passengerName>Mrs. Huxley234567890123456789.*<ticketNumber>ATL456789012345.*<exchangeAmount>500046.*<serviceClass>First.*<originCity>BOS.*/'));
->with($this->matchesRegularExpression('/.*<foreignRetailerIndicator>F.*/'));

$cnpTest = new CnpOnlineRequest();
$cnpTest->newXML = $mock;
Expand Down
Loading

0 comments on commit 75c84fe

Please sign in to comment.