Skip to content

Commit

Permalink
20210406 deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
securesubmit-buildmaster committed Apr 5, 2021
1 parent 94bffec commit 196cfd2
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/Gateways/PorticoConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ public function manageTransaction(ManagementBuilder $builder)
// }

if (count($builder->commercialData->lineItems) > 0) {
$linetItemsNode = $xml->createElement('LineItems');
$lineItemsNode = $xml->createElement('LineItems');

foreach ($builder->commercialData->lineItems as $lineItem) {
$linetItemNode = $xml->createElement('LineItemDetail');
Expand Down Expand Up @@ -784,18 +784,21 @@ public function manageTransaction(ManagementBuilder $builder)
// $visaCorporateDataNode->appendChild($xml->createElement('LineItemTreatmentCode', $builder->commercialData->somethingsome));
// }

$linetItemsNode->appendChild($linetItemNode);
$lineItemsNode->appendChild($linetItemNode);
};
}

$visaCorporateDataNode->appendChild($linetItemsNode);
if (!empty($lineItemsNode)) {
$visaCorporateDataNode->appendChild($lineItemsNode);
}

$commercialDataNode->appendChild($visaCorporateDataNode);
$root->appendChild($commercialDataNode);
} elseif ($builder->cardType == 'MC') {
$mastercardCorporateDataNode = $xml->createElement('MC');

if (count($builder->commercialData->lineItems) > 0) {
$linetItemsNode = $xml->createElement('LineItems');
$lineItemsNode = $xml->createElement('LineItems');

foreach ($builder->commercialData->lineItems as $lineItem) {
$linetItemNode = $xml->createElement('LineItemDetail');
Expand All @@ -820,11 +823,11 @@ public function manageTransaction(ManagementBuilder $builder)
$linetItemNode->appendChild($xml->createElement('UnitOfMeasure', $lineItem->unitOfMeasure));
}

$linetItemsNode->appendChild($linetItemNode);
$lineItemsNode->appendChild($linetItemNode);
};
}

$mastercardCorporateDataNode->appendChild($linetItemsNode);
$mastercardCorporateDataNode->appendChild($lineItemsNode);
$commercialDataNode->appendChild($mastercardCorporateDataNode);
$root->appendChild($commercialDataNode);
}
Expand Down
42 changes: 42 additions & 0 deletions test/Integration/Gateways/PorticoConnector/CommercialCardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,48 @@ public function test02VisaLevel3() {
}
}

// test w/o line items, which seem to be optional
public function test02aVisaLevel3() {
$response = $this->getVisaManual()->charge(112.34) // amount results in commercialIndicator val of 'B'
->withCurrency('USD')
->withAllowDuplicates(true)
->withCommercialRequest(true)
->withAddress($this->getAddy())
->execute();

if ($response->commercialIndicator === 'B') {
$commercialData = new CommercialData(TaxType::SALES_TAX, CommercialIndicator::LEVEL_III);
$commercialData->poNumber = 1784951399984509620;
$commercialData->taxAmount = 0;
$commercialData->destinationPostalCode = '85212';
$commercialData->destinationCountryCode = "USA";
$commercialData->originPostalCode = "22193";
$commercialData->summaryCommodityCode = "SCC";
$commercialData->customerVatNumber = "123456789";
$commercialData->vatInvoiceNumber = "UVATREF162";
$datetime = new DateTime();
$formattedDateTime = str_replace(",", "T", date_format($datetime, 'Y-m-d,H:i:s'));
$commercialData->orderDate = $formattedDateTime;
$commercialData->freightAmount = 0.01;
$commercialData->dutyAmount = 0.01;
$commercialData->additionalTaxDetails = new AdditionalTaxDetails(
.01,
TaxCategory::VAT,
.04,
"VAT"
);

$cpcEditResponse = $response->edit()
->withCommercialData($commercialData)
->withTaxType(TaxType::NOT_USED)
->execute();

$this->assertEquals('00', $cpcEditResponse->responseCode);
} else {
$this->assertTrue(false);
}
}

public function test03MasterCardLevel3() {
$response = $this->getMasterCardManual()->charge(111.06) // amount results in commercialIndicator val of 'S'
->withCurrency('USD')
Expand Down

0 comments on commit 196cfd2

Please sign in to comment.