Skip to content

Commit

Permalink
20200225 deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Feb 25, 2021
1 parent 01c24bf commit 30b7762
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 19 deletions.
30 changes: 17 additions & 13 deletions src/Gateways/PorticoConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ public function processAuthorization(AuthorizationBuilder $builder)
$block1->appendChild($xml->createElement('ShippingAmtInfo', $builder->shippingAmount));
}

if ($builder->surchargeAmount !== null) {
$block1->appendChild($xml->createElement('SurchargeAmtInfo', $builder->surchargeAmount));
}

if ($builder->cashBackAmount !== null) {
$block1->appendChild(
$xml->createElement(
Expand All @@ -205,7 +209,7 @@ public function processAuthorization(AuthorizationBuilder $builder)
$block1->appendChild($xml->createElement('Action', AliasAction::validate($builder->aliasAction)));
$block1->appendChild($xml->createElement('Alias', $builder->alias));
}

$isCheck = ($builder->paymentMethod->paymentMethodType === PaymentMethodType::ACH)
|| ($builder->paymentMethod instanceof RecurringPaymentMethod
&& $builder->paymentMethod->paymentType === 'ACH');
Expand Down Expand Up @@ -233,13 +237,13 @@ public function processAuthorization(AuthorizationBuilder $builder)
$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,
Expand Down Expand Up @@ -375,13 +379,13 @@ public function processAuthorization(AuthorizationBuilder $builder)
$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'));
Expand Down Expand Up @@ -470,11 +474,11 @@ public function processAuthorization(AuthorizationBuilder $builder)
if (!empty($builder->invoiceNumber)) {
$direct->appendChild($xml->createElement('DirectMktInvoiceNbr', $builder->invoiceNumber));
}

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));
}
Expand Down Expand Up @@ -516,7 +520,7 @@ public function processAuthorization(AuthorizationBuilder $builder)
$xml->createElement('TxnDescriptor', $builder->dynamicDescriptor)
);
}

if ($builder->commercialData !== null) {
$commercialDataNode = $xml->createElement('CPCData');

Expand All @@ -526,7 +530,7 @@ public function processAuthorization(AuthorizationBuilder $builder)

$block1->appendChild($commercialDataNode);
}

// auto substantiation
if ($builder->autoSubstantiation !== null) {
$autoSubstantiationNode = $xml->createElement('AutoSubstantiation');
Expand All @@ -548,7 +552,7 @@ public function processAuthorization(AuthorizationBuilder $builder)
$i++;
}
}

$autoSubstantiationNode->appendChild($xml->createElement("MerchantVerificationValue", $builder->autoSubstantiation->merchantVerificationValue));
$autoSubstantiationNode->appendChild($xml->createElement("RealTimeSubstantiation", $builder->autoSubstantiation->realTimeSubstantiation ? "Y" : "N"));

Expand Down Expand Up @@ -1165,7 +1169,7 @@ 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;
}
Expand Down Expand Up @@ -1742,7 +1746,7 @@ protected function hydrateHolder(DOMDocument $xml, BaseBuilder $builder, $isChec
if ($isCheck && $builder->paymentMethod instanceof RecurringPaymentMethod) {
return null;
}

if ($builder->billingAddress !== null) {
$holder->appendChild(
$xml->createElement($isCheck ? 'Address1' : 'CardHolderAddr', $builder->billingAddress->streetAddress1)
Expand Down Expand Up @@ -1981,7 +1985,7 @@ protected function hydrateTrackData(DOMDocument $xml, BaseBuilder $builder, $has

return $trackData;
}

public function supportsHostedPayments()
{
return $this->supportsHostedPayments;
Expand Down
32 changes: 26 additions & 6 deletions test/Integration/Gateways/PorticoConnector/CreditTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use GlobalPayments\Api\Entities\Enums\StoredCredentialInitiator;
use GlobalPayments\Api\Entities\Transaction;
use GlobalPayments\Api\ServiceConfigs\Gateways\PorticoConfig;
use GlobalPayments\Api\Services\ReportingService;
use GlobalPayments\Api\Tests\Data\TestCards;

class CreditTest extends TestCase
Expand Down Expand Up @@ -139,6 +140,25 @@ public function testCreditVerify()
$this->assertEquals('00', $response->responseCode);
}

public function testCreditSaleWithSurchargeAmount()
{
$amount = 10;
$surcharge = $amount * .35;
$response = $this->card->charge($amount + $surcharge)
->withCurrency('USD')
->withAllowDuplicates(true)
->withSurchargeAmount($surcharge)
->execute();

$this->assertNotNull($response);
$this->assertEquals('00', $response->responseCode);

$report = ReportingService::transactionDetail($response->transactionId)->execute();

$this->assertNotNull($report);
$this->assertEquals($surcharge, $report->surchargeAmount);
}

public function testCreditSwipeAuthorization()
{
$authorization = $this->track->authorize(14)
Expand Down Expand Up @@ -270,7 +290,7 @@ protected function getConfig()
'https://cert.api2.heartlandportico.com';
return $config;
}

public function testCreditSaleWithCOF()
{
$response = $this->card->charge(15)
Expand All @@ -292,7 +312,7 @@ public function testCreditSaleWithCOF()
$this->assertNotNull($nextResponse);
$this->assertEquals('00', $nextResponse->responseCode);
}

public function testCreditVerifyWithCOF()
{
$response = $this->card->verify()
Expand All @@ -312,7 +332,7 @@ public function testCreditVerifyWithCOF()
$this->assertNotNull($nextResponse);
$this->assertEquals('00', $nextResponse->responseCode);
}

public function testCreditAuthorizationWithCOF()
{
$response = $this->card->authorize(14)
Expand All @@ -333,11 +353,11 @@ public function testCreditAuthorizationWithCOF()

$this->assertNotNull($nextResponse);
$this->assertEquals('00', $nextResponse->responseCode);

$captureResponse = $nextResponse->capture(16)
->withGratuity(2)
->execute();

$this->assertNotNull($captureResponse);
$this->assertEquals('00', $captureResponse->responseCode);
}
Expand All @@ -358,7 +378,7 @@ public function testCreditReverseViaClientTxnId()
$reverse = Transaction::fromClientTransactionId($clientTxnId)
->reverse(420.69)
->execute();

$this->assertNotNull($reverse);
$this->assertEquals('00', $reverse->responseCode);
}
Expand Down

0 comments on commit 30b7762

Please sign in to comment.