From 44cefbf85b6c280e2ff90d079303932b983e6a44 Mon Sep 17 00:00:00 2001 From: SenthilKumar Date: Tue, 18 Aug 2020 17:36:12 +0530 Subject: [PATCH] 20200818 deployment --- src/Builders/AuthorizationBuilder.php | 92 ++++++++++++++++++- src/Builders/Secure3dBuilder.php | 16 +++- .../Enums/Secure3dPaymentDataSource.php | 19 ++++ src/Entities/Transaction.php | 20 ++++ src/Gateways/Gp3DSProvider.php | 7 +- src/Gateways/PorticoConnector.php | 66 ++++++++++--- src/PaymentMethods/CreditCardData.php | 7 ++ src/PaymentMethods/RecurringPaymentMethod.php | 7 ++ .../Gateways/PorticoConnector/AchTest.php | 2 +- .../Certifications/EcommerceTest.php | 31 +++++++ .../Certifications/RecurringTest.php | 76 ++++++++++++--- .../Gateways/PorticoConnector/CreditTest.php | 72 +++++++++++++++ .../RealexConnector/Secure3dServiceTests.php | 13 +-- 13 files changed, 387 insertions(+), 41 deletions(-) create mode 100644 src/Entities/Enums/Secure3dPaymentDataSource.php diff --git a/src/Builders/AuthorizationBuilder.php b/src/Builders/AuthorizationBuilder.php index bb891e47..55eafcba 100644 --- a/src/Builders/AuthorizationBuilder.php +++ b/src/Builders/AuthorizationBuilder.php @@ -3,6 +3,7 @@ namespace GlobalPayments\Api\Builders; use GlobalPayments\Api\Entities\Address; +use GlobalPayments\Api\Entities\AutoSubstantiation; use GlobalPayments\Api\Entities\EcommerceInfo; use GlobalPayments\Api\Entities\HostedPaymentData; use GlobalPayments\Api\Entities\Enums\AddressType; @@ -78,6 +79,9 @@ class AuthorizationBuilder extends TransactionBuilder */ public $authAmount; + /** @var AutoSubstantiation */ + public $autoSubstantiation; + /** * Balance inquiry type * @@ -396,6 +400,38 @@ class AuthorizationBuilder extends TransactionBuilder */ public $verifyAddress; + /** + * For TransIT cash amount for a specified transaction + * Note: If a decimal point is included, the amount reflects a dollar value. + * If a decimal point is not included, the amount reflects a cent value. + * + * @internal + * @var string + */ + public $cashTendered; + + /** + * For TransIT transaction discount details + * + * @internal + * @var string + */ + public $discountDetails; + + /* + * Card on File field + * @var string + * + */ + public $cardBrandTransactionId; + + /* + * Card on File field + * @var string + * + */ + public $transactionInitiator; + /** * {@inheritdoc} * @@ -612,6 +648,19 @@ public function withAuthAmount($authAmount) return $this; } + /** + * Sets the auto substantiation values for the transaction + * + * @param AutoSubstantiation + * + * @return AuthorizationBuilder + */ + public function withAutoSubstantiation($autoSubstantiation) + { + $this->autoSubstantiation = $autoSubstantiation; + return $this; + } + /** * Set the request's balance inquiry type * @@ -1024,7 +1073,7 @@ public function withDccType($value) */ public function withConvenienceAmount($convenienceAmount) { - $this->convenienceAmount = $convenienceAmount ; + $this->convenienceAmount = $convenienceAmount; return $this; } @@ -1114,4 +1163,45 @@ public function withScheduleId($scheduleId) $this->scheduleId = $scheduleId; return $this; } + + /** + * Set the associated schedule ID + * + * @param string $scheduleId + * + * @return AuthorizationBuilder + */ + public function withDiscountDetails($discountDetails) + { + $this->discountDetails = $discountDetails; + return $this; + } + + /** + * Set the cash tendered amount + * + * @param string $cashTendered + * + * @return AuthorizationBuilder + */ + public function withCashTenderedDetails($cashTendered) + { + $this->cashTendered = $cashTendered; + return $this; + } + + /** + * Set the Card on File storage + * + * @param string $transactionInitiator + * @param string $value + * + * @return AuthorizationBuilder + */ + public function withCardBrandStorage($transactionInitiator, $value = '') + { + $this->transactionInitiator = $transactionInitiator; + $this->cardBrandTransactionId = $value; + return $this; + } } diff --git a/src/Builders/Secure3dBuilder.php b/src/Builders/Secure3dBuilder.php index a77fddc2..95c7c791 100644 --- a/src/Builders/Secure3dBuilder.php +++ b/src/Builders/Secure3dBuilder.php @@ -50,6 +50,8 @@ class Secure3dBuilder extends BaseBuilder public $billingAddress; /** @var BrowserData */ public $browserData; + /** @var ChallengeRequestIndicator */ + public $challengeRequestIndicator; /** @var string */ public $currency; /** @var string */ @@ -240,6 +242,11 @@ public function getBrowserData() return $this->browserData; } /** @return string */ + public function getChallengeRequestIndicator() + { + return $this->challengeRequestIndicator; + } + /** @return string */ public function getCurrency() { return $this->currency; @@ -681,6 +688,13 @@ public function withBrowserData($value) return $this; } + /** @return Secure3dBuilder */ + public function withChallengeRequestIndicator($challengeRequestIndicator) + { + $this->challengeRequestIndicator = $challengeRequestIndicator; + return $this; + } + /** @return Secure3dBuilder */ public function withCustomerAccountId($customerAccountId) { @@ -1155,7 +1169,7 @@ public function execute($version = Secure3dVersion::ANY) // check the response if (!empty($response)) { switch ($this->transactionType) { - case TransactionType::VERIFY_ENROLLED: + case TransactionType::VERIFY_ENROLLED: if (!empty($response->threeDSecure)) { $rvalue = $response->threeDSecure; if ((bool)$rvalue->enrolled) { diff --git a/src/Entities/Enums/Secure3dPaymentDataSource.php b/src/Entities/Enums/Secure3dPaymentDataSource.php new file mode 100644 index 00000000..4864f781 --- /dev/null +++ b/src/Entities/Enums/Secure3dPaymentDataSource.php @@ -0,0 +1,19 @@ +maybeSetKey($request, 'merchant_id', $this->merchantId); $request = $this->maybeSetKey($request, 'account_id', $this->accountId); $request = $this->maybeSetKey($request, 'challenge_notification_url', $this->challengeNotificationUrl); + $request = $this->maybeSetKey($request, 'challenge_request_indicator', $builder->getChallengeRequestIndicator()); $request = $this->maybeSetKey($request, 'method_url_completion', $builder->getMethodUrlCompletion()); $request = $this->maybeSetKey($request, 'merchant_contact_url', $this->merchantContactUrl); $request = $this->maybeSetKey($request, 'merchant_initiated_request_type', $builder->getMerchantInitiatedRequestType()); @@ -153,7 +154,8 @@ public function processSecure3d(Secure3dBuilder $builder) $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'number', $cardData->number); $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'scheme', strtoupper($cardData->getCardType())); $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'expiry_month', $cardData->expMonth); - $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'expiry_year', substr($cardData->expYear, 2)); + $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'expiry_year', + substr(str_pad($cardData->expYear, 4, '0', STR_PAD_LEFT), 2, 2)); $request['card_detail'] = $this->maybeSetKey($request['card_detail'], 'full_name', $cardData->cardHolderName); if (!empty($cardData->cardHolderName)) { @@ -310,7 +312,8 @@ public function processSecure3d(Secure3dBuilder $builder) $request['sdk_information'] = []; $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'application_id', $builder->getApplicationId()); $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'ephemeral_public_key', $builder->getEphemeralPublicKey()); - $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'maximum_timeout', $builder->getMaximumTimeout()); + $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'maximum_timeout', + (!empty($builder->getMaximumTimeout())) ? str_pad($builder->getMaximumTimeout(), 2, '0' , STR_PAD_LEFT) : ''); $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'reference_number', $builder->getReferenceNumber()); $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'sdk_trans_id', $builder->getSdkTransactionId()); $request['sdk_information'] = $this->maybeSetKey($request['sdk_information'], 'encoded_data', $builder->getEncodedData()); diff --git a/src/Gateways/PorticoConnector.php b/src/Gateways/PorticoConnector.php index adc44526..d8662239 100644 --- a/src/Gateways/PorticoConnector.php +++ b/src/Gateways/PorticoConnector.php @@ -38,6 +38,7 @@ use GlobalPayments\Api\Entities\Reporting\SearchCriteria; use GlobalPayments\Api\Entities\Reporting\SearchCriteriaBuilder; use GlobalPayments\Api\Services\ReportingService; +use GlobalPayments\Api\Entities\Enums\StoredCredentialInitiator; class PorticoConnector extends XmlGateway implements IPaymentGateway { @@ -203,8 +204,8 @@ public function processAuthorization(AuthorizationBuilder $builder) $propertyName = $isCheck ? 'checkHolderName' : 'cardHolderName'; if ($isCheck - || $builder->billingAddress !== null - || isset($builder->paymentMethod->{$propertyName}) + || $builder->billingAddress !== null + || isset($builder->paymentMethod->{$propertyName}) ) { if ($builder->transactionType !== TransactionType::REVERSAL) { $address = $this->hydrateHolder($xml, $builder, $isCheck); @@ -219,6 +220,18 @@ public function processAuthorization(AuthorizationBuilder $builder) $builder->transactionType === TransactionType::REPLACE ? 'OldCardData' : 'CardData' ); if ($builder->paymentMethod instanceof ICardData) { + if ($builder->transactionInitiator !== null) { + //card on file request + $intiator = ($builder->transactionInitiator === StoredCredentialInitiator::CARDHOLDER) ? 'C' : 'M'; + $cardOnFileData = $xml->createElement('CardOnFileData'); + $cardOnFileData->appendChild($xml->createElement('CardOnFile', $intiator)); + + if (!empty($builder->cardBrandTransactionId)) { + $cardOnFileData->appendChild($xml->createElement('CardBrandTxnId', $builder->cardBrandTransactionId)); + } + $block1->appendChild($cardOnFileData); + } + $cardData->appendChild( $this->hydrateManualEntry( $xml, @@ -349,6 +362,18 @@ public function processAuthorization(AuthorizationBuilder $builder) if ($builder->paymentMethod instanceof RecurringPaymentMethod) { $method = $builder->paymentMethod; + if ($builder->transactionInitiator !== null) { + //card on file request + $intiator = ($builder->transactionInitiator === StoredCredentialInitiator::CARDHOLDER) ? 'C' : 'M'; + $cardOnFileData = $xml->createElement('CardOnFileData'); + $cardOnFileData->appendChild($xml->createElement('CardOnFile', $intiator)); + + if (!empty($builder->cardBrandTransactionId)) { + $cardOnFileData->appendChild($xml->createElement('CardBrandTxnId', $builder->cardBrandTransactionId)); + } + $block1->appendChild($cardOnFileData); + } + if ($method->paymentType === 'ACH') { $block1->appendChild($xml->createElement('CheckAction', 'SALE')); @@ -437,17 +462,20 @@ public function processAuthorization(AuthorizationBuilder $builder) if (!empty($builder->invoiceNumber)) { $direct->appendChild($xml->createElement('DirectMktInvoiceNbr', $builder->invoiceNumber)); } - if (!empty($builder->ecommerceInfo->shipDay)) { - $direct->appendChild($xml->createElement('DirectMktShipDay', $builder->ecommerceInfo->shipDay)); - } + if (!empty($builder->ecommerceInfo->shipMonth)) { $direct->appendChild($xml->createElement('DirectMktShipMonth', $builder->ecommerceInfo->shipMonth)); } + + if (!empty($builder->ecommerceInfo->shipDay)) { + $direct->appendChild($xml->createElement('DirectMktShipDay', $builder->ecommerceInfo->shipDay)); + } + $block1->appendChild($direct); } if (!empty($builder->paymentMethod->threeDSecure)) { $secure = $xml->createElement('SecureECommerce'); if (!empty($builder->paymentMethod->threeDSecure->paymentDataSource)) { - $direct->appendChild( + $secure->appendChild( $xml->createElement( 'PaymentDataSource', $builder->paymentMethod->threeDSecure->paymentDataSource @@ -455,7 +483,7 @@ public function processAuthorization(AuthorizationBuilder $builder) ); } if (!empty($builder->paymentMethod->threeDSecure->paymentDataType)) { - $direct->appendChild( + $secure->appendChild( $xml->createElement( 'TypeOfPaymentData', $builder->paymentMethod->threeDSecure->paymentDataType @@ -463,14 +491,15 @@ public function processAuthorization(AuthorizationBuilder $builder) ); } if (!empty($builder->paymentMethod->threeDSecure->cavv)) { - $direct->appendChild($xml->createElement('PaymentData', $builder->paymentMethod->threeDSecure->cavv)); + $secure->appendChild($xml->createElement('PaymentData', $builder->paymentMethod->threeDSecure->cavv)); } if (!empty($builder->paymentMethod->threeDSecure->eci)) { - $direct->appendChild($xml->createElement('ECommerceIndicator', $builder->paymentMethod->threeDSecure->eci)); + $secure->appendChild($xml->createElement('ECommerceIndicator', $builder->paymentMethod->threeDSecure->eci)); } if (!empty($builder->paymentMethod->threeDSecure->xid)) { - $direct->appendChild($xml->createElement('XID', $builder->paymentMethod->threeDSecure->xid)); + $secure->appendChild($xml->createElement('XID', $builder->paymentMethod->threeDSecure->xid)); } + $block1->appendChild($secure); } } @@ -569,9 +598,6 @@ public function manageTransaction(ManagementBuilder $builder) } } - // Additional Txn Fields - // TODO - // Token Management if ($builder->transactionType === TransactionType::TOKEN_UPDATE || $builder->transactionType === TransactionType::TOKEN_DELETE @@ -597,6 +623,16 @@ public function manageTransaction(ManagementBuilder $builder) } } + // Additional Transaction Fields + if (!empty($builder->customerId) || !empty($builder->description) || !empty($builder->invoiceNumber)) { + $addons = $xml->createElement('AdditionalTxnFields'); + $addons->appendChild($xml->createElement('CustomerID', $builder->customerId)); + $addons->appendChild($xml->createElement('Description', $builder->description)); + $addons->appendChild($xml->createElement('InvoiceNbr', $builder->invoiceNumber)); + + $root->appendChild($addons); + } + if ($builder->transactionType === TransactionType::REVERSAL || $builder->transactionType === TransactionType::REFUND || $builder->paymentMethod->paymentMethodType === PaymentMethodType::GIFT @@ -1068,6 +1104,10 @@ protected function mapResponse($rawResponse, BaseBuilder $builder, $request) $result->batchSummary->totalAmount = (string)$item->TotalAmt; $result->batchSummary->sequenceNumber = (string)$item->BatchSeqNbr; } + + if (isset($item) && isset($item->CardBrandTxnId)) { + $result->cardBrandTransactionId = (string)$item->CardBrandTxnId; + } return $result; } diff --git a/src/PaymentMethods/CreditCardData.php b/src/PaymentMethods/CreditCardData.php index 5d709a13..ae50467c 100644 --- a/src/PaymentMethods/CreditCardData.php +++ b/src/PaymentMethods/CreditCardData.php @@ -84,6 +84,13 @@ class CreditCardData extends Credit implements ICardData 'Discover' => '/^6([045]|22)/', 'Jcb' => '/^35/', ]; + + /** + * Set the Card on File storage + * + * @var bool + */ + public $cardBrandTransactionId; /** * Instantiates a new credit card diff --git a/src/PaymentMethods/RecurringPaymentMethod.php b/src/PaymentMethods/RecurringPaymentMethod.php index 4a0e7b7e..8d920d83 100644 --- a/src/PaymentMethods/RecurringPaymentMethod.php +++ b/src/PaymentMethods/RecurringPaymentMethod.php @@ -113,6 +113,13 @@ class RecurringPaymentMethod extends RecurringEntity implements /** @var ThreeDSecure */ public $threeDSecure; + + /** + * Set the Card on File storage + * + * @var bool + */ + public $cardBrandTransactionId; /** * @param string|IPaymentMethod $customerIdOrPaymentMethod diff --git a/test/Integration/Gateways/PorticoConnector/AchTest.php b/test/Integration/Gateways/PorticoConnector/AchTest.php index f279dd9c..3a5d9589 100644 --- a/test/Integration/Gateways/PorticoConnector/AchTest.php +++ b/test/Integration/Gateways/PorticoConnector/AchTest.php @@ -48,7 +48,7 @@ public function setup() $this->address->state = 'NJ'; $this->address->postalCode = '12345'; - ServicesContainer::configure($this->getConfig()); + ServicesContainer::configure($this->getConfig()); } public function testCheckSale() diff --git a/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.php b/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.php index ec0d09ae..6bbfe235 100644 --- a/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.php +++ b/test/Integration/Gateways/PorticoConnector/Certifications/EcommerceTest.php @@ -19,6 +19,8 @@ use GlobalPayments\Api\ServicesContainer; use GlobalPayments\Api\Tests\Data\TestCards; use PHPUnit\Framework\TestCase; +use GlobalPayments\Api\Entities\ThreeDSecure; +use GlobalPayments\Api\Entities\Enums\Secure3dPaymentDataSource; class EcommerceTest extends TestCase { @@ -1665,4 +1667,33 @@ public function test999CloseBatch() } } } + + public function test100ChargeVisaEcommerceInfo() + { + $address = new Address(); + $address->streetAddress1 = '6860 Dallas Pkwy'; + $address->postalCode = '75024'; + + $secureEcom = new ThreeDSecure(); + $secureEcom->cavv = 'AAACBllleHchZTBWIGV4AAAAAAA='; + $secureEcom->xid = 'crqAeMwkEL9r4POdxpByWJ1/wYg='; + $secureEcom->eci = '5'; + $secureEcom->paymentDataSource = Secure3dPaymentDataSource::VISA_3DSECURE; + $secureEcom->paymentDataType = '3DSecure'; + + $card = TestCards::visaManual(); + $card->threeDSecure = $secureEcom; + + $response = $card->charge() + ->withCurrency('USD') + ->withAmount(13.01) + ->withAddress($address) + ->withEcommerceInfo($this->ecommerceInfo) + ->withInvoiceNumber('12345') + ->withAllowDuplicates(true) + ->execute(); + + $this->assertEquals(true, $response != null); + $this->assertEquals('00', $response->responseCode); + } } diff --git a/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.php b/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.php index c09bd45d..e9d0be0d 100644 --- a/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.php +++ b/test/Integration/Gateways/PorticoConnector/Certifications/RecurringTest.php @@ -20,6 +20,7 @@ use GlobalPayments\Api\PaymentMethods\RecurringPaymentMethod; use GlobalPayments\Api\Services\BatchService; use GlobalPayments\Api\Utils\GenerationUtils; +use GlobalPayments\Api\Entities\Enums\StoredCredentialInitiator; class RecurringTest extends TestCase { @@ -321,7 +322,8 @@ public function test008AddScheduleCreditVisa() static::$scheduleVisa = $schedule; } - public function test009AddScheduleCreditMasterCard() { + public function test009AddScheduleCreditMasterCard() + { if (static::$paymentMethodMasterCard == null) { $this->markTestIncomplete(); } @@ -342,7 +344,8 @@ public function test009AddScheduleCreditMasterCard() { static::$scheduleMasterCard = $schedule; } - public function test010AddScheduleCheckPPD() { + public function test010AddScheduleCheckPPD() + { if (static::$paymentMethodCheckPpd == null) { $this->markTestIncomplete(); } @@ -363,7 +366,8 @@ public function test010AddScheduleCheckPPD() { static::$scheduleCheckPpd = $schedule; } - public function test011AddScheduleCheckCCD() { + public function test011AddScheduleCheckCCD() + { if (static::$paymentMethodCheckCcd == null) { $this->markTestIncomplete(); } @@ -386,7 +390,8 @@ public function test011AddScheduleCheckCCD() { /** * expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException */ - public function test012AddScheduleCreditVisa() { + public function test012AddScheduleCreditVisa() + { if (static::$paymentMethodVisa == null) { $this->markTestIncomplete(); } @@ -406,7 +411,8 @@ public function test012AddScheduleCreditVisa() { /** * expectedException GlobalPayments\Api\Entities\Exceptions\GatewayException */ - public function test013AddScheduleCCheckPPD() { + public function test013AddScheduleCCheckPPD() + { if (static::$paymentMethodCheckPpd == null) { $this->markTestIncomplete(); } @@ -426,7 +432,8 @@ public function test013AddScheduleCCheckPPD() { // Recurring Billing using PayPlan - Managed Schedule - public function test014RecurringBillingVisa() { + public function test014RecurringBillingVisa() + { if (static::$paymentMethodVisa == null || static::$scheduleVisa == null) { $this->markTestIncomplete(); } @@ -440,7 +447,8 @@ public function test014RecurringBillingVisa() { $this->assertEquals('00', $response->responseCode); } - public function test015RecurringBillingMasterCard() { + public function test015RecurringBillingMasterCard() + { if (true || static::$paymentMethodMasterCard == null || static::$scheduleMasterCard == null) { $this->markTestIncomplete(); } @@ -454,7 +462,8 @@ public function test015RecurringBillingMasterCard() { $this->assertEquals('00', $response->responseCode); } - public function test016RecurringBillingCheckPPD() { + public function test016RecurringBillingCheckPPD() + { if (static::$paymentMethodCheckPpd == null || static::$scheduleCheckPpd == null) { $this->markTestIncomplete(); } @@ -468,7 +477,8 @@ public function test016RecurringBillingCheckPPD() { $this->assertEquals('00', $response->responseCode); } - public function test017RecurringBillingCheckCCD() { + public function test017RecurringBillingCheckCCD() + { if (static::$paymentMethodCheckCcd == null || static::$scheduleCheckCcd == null) { $this->markTestIncomplete(); } @@ -484,7 +494,8 @@ public function test017RecurringBillingCheckCCD() { // One time bill payment - public function test018RecurringBillingVisa() { + public function test018RecurringBillingVisa() + { if (static::$paymentMethodVisa == null) { $this->markTestIncomplete(); } @@ -496,7 +507,8 @@ public function test018RecurringBillingVisa() { $this->assertEquals('00', $response->responseCode); } - public function test019RecurringBillingMasterCard() { + public function test019RecurringBillingMasterCard() + { if (static::$paymentMethodMasterCard == null) { $this->markTestIncomplete(); } @@ -508,7 +520,8 @@ public function test019RecurringBillingMasterCard() { $this->assertEquals('00', $response->responseCode); } - public function test020RecurringBillingCheckPPD() { + public function test020RecurringBillingCheckPPD() + { if (static::$paymentMethodCheckPpd == null) { $this->markTestIncomplete(); } @@ -520,7 +533,8 @@ public function test020RecurringBillingCheckPPD() { $this->assertEquals('00', $response->responseCode); } - public function test021RecurringBillingCheckCCD() { + public function test021RecurringBillingCheckCCD() + { if (static::$paymentMethodCheckCcd == null) { $this->markTestIncomplete(); } @@ -534,7 +548,8 @@ public function test021RecurringBillingCheckCCD() { // Onetime bill payment - declined - public function test022RecurringBillingVisa_Decline() { + public function test022RecurringBillingVisa_Decline() + { if (static::$paymentMethodVisa == null) { $this->markTestIncomplete(); } @@ -546,7 +561,8 @@ public function test022RecurringBillingVisa_Decline() { $this->assertEquals('51', $response->responseCode); } - public function test023RecurringBillingCheckPPD_Decline() { + public function test023RecurringBillingCheckPPD_Decline() + { if (true || static::$paymentMethodCheckPpd == null) { $this->markTestIncomplete(); } @@ -557,4 +573,34 @@ public function test023RecurringBillingCheckPPD_Decline() { $this->assertNotNull($response); $this->assertEquals('1', $response->responseCode); } + + public function test024RecurringBillingVisaWithCOF() + { + if (static::$paymentMethodVisa == null || static::$scheduleVisa == null) { + $this->markTestIncomplete(); + } + + $response = static::$paymentMethodVisa->charge(20.01) + ->withCurrency('USD') + ->withScheduleId(static::$scheduleVisa->key) + ->withOneTimePayment(false) + ->withAllowDuplicates(true) + ->withCardBrandStorage(StoredCredentialInitiator::CARDHOLDER) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertNotNull($response->cardBrandTransactionId); + + $nextResponse = static::$paymentMethodVisa->charge(20.01) + ->withCurrency('USD') + ->withScheduleId(static::$scheduleVisa->key) + ->withOneTimePayment(false) + ->withAllowDuplicates(true) + ->withCardBrandStorage(StoredCredentialInitiator::MERCHANT, $response->cardBrandTransactionId) + ->execute(); + + $this->assertNotNull($nextResponse); + $this->assertEquals('00', $nextResponse->responseCode); + } } diff --git a/test/Integration/Gateways/PorticoConnector/CreditTest.php b/test/Integration/Gateways/PorticoConnector/CreditTest.php index 01539b1b..b0ffd081 100644 --- a/test/Integration/Gateways/PorticoConnector/CreditTest.php +++ b/test/Integration/Gateways/PorticoConnector/CreditTest.php @@ -9,6 +9,7 @@ use GlobalPayments\Api\ServicesConfig; use GlobalPayments\Api\ServicesContainer; use PHPUnit\Framework\TestCase; +use GlobalPayments\Api\Entities\Enums\StoredCredentialInitiator; class CreditTest extends TestCase { @@ -267,4 +268,75 @@ protected function getConfig() 'https://cert.api2.heartlandportico.com'; return $config; } + + public function testCreditSaleWithCOF() + { + $response = $this->card->charge(15) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->withCardBrandStorage(StoredCredentialInitiator::CARDHOLDER) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertNotNull($response->cardBrandTransactionId); + + $nextResponse = $this->card->charge(15) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->withCardBrandStorage(StoredCredentialInitiator::MERCHANT, $response->cardBrandTransactionId) + ->execute(); + + $this->assertNotNull($nextResponse); + $this->assertEquals('00', $nextResponse->responseCode); + } + + public function testCreditVerifyWithCOF() + { + $response = $this->card->verify() + ->withAllowDuplicates(true) + ->withCardBrandStorage(StoredCredentialInitiator::CARDHOLDER) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertNotNull($response->cardBrandTransactionId); + + $nextResponse = $this->card->verify() + ->withAllowDuplicates(true) + ->withCardBrandStorage(StoredCredentialInitiator::MERCHANT, $response->cardBrandTransactionId) + ->execute(); + + $this->assertNotNull($nextResponse); + $this->assertEquals('00', $nextResponse->responseCode); + } + + public function testCreditAuthorizationWithCOF() + { + $response = $this->card->authorize(14) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->withCardBrandStorage(StoredCredentialInitiator::CARDHOLDER) + ->execute(); + + $this->assertNotNull($response); + $this->assertEquals('00', $response->responseCode); + $this->assertNotNull($response->cardBrandTransactionId); + + $nextResponse = $this->card->authorize(14) + ->withCurrency('USD') + ->withAllowDuplicates(true) + ->withCardBrandStorage(StoredCredentialInitiator::MERCHANT, $response->cardBrandTransactionId) + ->execute(); + + $this->assertNotNull($nextResponse); + $this->assertEquals('00', $nextResponse->responseCode); + + $captureResponse = $nextResponse->capture(16) + ->withGratuity(2) + ->execute(); + + $this->assertNotNull($captureResponse); + $this->assertEquals('00', $captureResponse->responseCode); + } } diff --git a/test/Integration/Gateways/RealexConnector/Secure3dServiceTests.php b/test/Integration/Gateways/RealexConnector/Secure3dServiceTests.php index 421a27c3..50e6e543 100644 --- a/test/Integration/Gateways/RealexConnector/Secure3dServiceTests.php +++ b/test/Integration/Gateways/RealexConnector/Secure3dServiceTests.php @@ -33,6 +33,7 @@ use GlobalPayments\Api\Entities\Enums\CustomerAuthenticationMethod; use GlobalPayments\Api\Entities\Enums\SdkInterface; use GlobalPayments\Api\Entities\Enums\SdkUiType; +use GlobalPayments\Api\Entities\Enums\ChallengeRequestIndicator; class Secure3dServiceTests extends TestCase { @@ -87,7 +88,6 @@ public function setup() : void $this->browserData->challengWindowSize = ChallengeWindowSize::WINDOWED_600X400; $this->browserData->timeZone = '0'; $this->browserData->userAgent = 'Mozilla/5.0 (Windows NT 6.1; Win64, x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36'; - } protected function getConfig() @@ -162,6 +162,7 @@ public function testFullCycle_v2() ->withAddress($this->shippingAddress, AddressType::SHIPPING) ->withBrowserData($this->browserData) ->withMethodUrlCompletion(MethodUrlCompletion::NO) + ->withChallengeRequestIndicator(ChallengeRequestIndicator::NO_PREFERENCE) ->execute(); $this->assertNotNull($initAuth); @@ -251,7 +252,6 @@ public function testFullCycle_Any() } else { $this->fail('Card not enrolled'); } - } public function testFullCycle_v2_StoredCard() @@ -292,7 +292,6 @@ public function testFullCycle_v2_StoredCard() } else { $this->fail('Signature verification failed.'); } - } else { $this->fail('Card not enrolled'); } @@ -336,7 +335,6 @@ public function testFullCycle_v2_OTB() } else { $this->fail('Signature verification failed.'); } - } else { $this->fail('Card not enrolled'); } @@ -380,7 +378,6 @@ public function testFullCycle_v2_OTB_StoredCard() } else { $this->fail('Signature verification failed.'); } - } else { $this->fail('Card not enrolled'); } @@ -575,7 +572,7 @@ public function testOptionalPriorAuthenticationData() // optionals ->withPriorAuthenticationMethod(PriorAuthenticationMethod::FRICTIONLESS_AUTHENTICATION) ->withPriorAuthenticationTransactionId('26c3f619-39a4-4040-bf1f-6fd433e6d615') - ->withPriorAuthenticationTimestamp((new \DateTime('2019-01-10T12:57:33.333Z'))->format(\DateTime::RFC3339_EXTENDED)) + ->withPriorAuthenticationTimestamp((new \DateTime('2019-01-10T12:57:33.333Z'))->format(\DateTime::RFC3339_EXTENDED)) ->execute(); $this->assertNotNull($initAuth); @@ -723,7 +720,7 @@ public function testOptionalMobileFields() ->withReferenceNumber('3DS_LOA_SDK_PPFU_020100_00007') ->withSdkTransactionId('b2385523-a66c-4907-ac3c-91848e8c0067') ->withEncodedData('ew0KCSJEViI6ICIxLjAiLA0KCSJERCI6IHsNCgkJIkMwMDEiOiAiQW5kcm9pZCIsDQoJCSJDMDAyIjogIkhUQyBPbmVfTTgiLA0KCQkiQzAwNCI6ICI1LjAuMSIsDQoJCSJDMDA1IjogImVuX1VTIiwNCgkJIkMwMDYiOiAiRWFzdGVybiBTdGFuZGFyZCBUaW1lIiwNCgkJIkMwMDciOiAiMDY3OTc5MDMtZmI2MS00MWVkLTk0YzItNGQyYjc0ZTI3ZDE4IiwNCgkJIkMwMDkiOiAiSm9obidzIEFuZHJvaWQgRGV2aWNlIg0KCX0sDQoJIkRQTkEiOiB7DQoJCSJDMDEwIjogIlJFMDEiLA0KCQkiQzAxMSI6ICJSRTAzIg0KCX0sDQoJIlNXIjogWyJTVzAxIiwgIlNXMDQiXQ0KfQ0K') - + ->withMaximumTimeout(5) ->execute(); $this->assertNotNull($initAuth); @@ -769,4 +766,4 @@ public function testCheckVersion_Not_Enrolled() // ->execute(Secure3dVersion::ANY); // $this->assertNotNull($secureEcom); // } -} \ No newline at end of file +}