in eCommerce platforms/Adobe Magento/src/code/local/Microsoft/Dfp/controllers/Checkout/OnepageController.php [223:269]
private function GetPaymentInstrumentDetails($order)
{
$paymentData = $order->getPayment()->getData();
$billingAddress = $order->getBillingAddress();
$billingData = $billingAddress->getData();
$billingStreet = $billingAddress->getStreet();
$paymentInstrumentList = array();
$billingAddress = array(
"firstName" => $billingData['firstname'],
"lastName" => $billingData['lastname'],
"phoneNumber" => $billingAddress->telephone,
"street1" => $billingStreet[0],
"street2" => count($billingStreet) > 1 ? $billingStreet[1] : null,
"city" => $billingAddress->city,
"state" => $billingAddress->region,
"zipCode" => $billingAddress->postcode,
"country" => $billingAddress->countryId
);
switch ($paymentData['method']) {
case 'ccsave':
$expirationDate = new DateTime($paymentData['cc_exp_year'] . '-' . $paymentData['cc_exp_month']);
$expirationDateISO = $expirationDate->format(DateTime::ATOM);
$paymentInstrumentList[] = array(
'type' => Microsoft_Dfp_Helper_Data::PI_TYPE_CREDIT,
'cardType' => $this->GetCardType($paymentData['cc_type']),
'holderName' => $paymentData['cc_owner'],
'expirationDate' => $expirationDateISO,
'lastFourDigits' => $paymentData['cc_last4'],
'purchaseAmount' => $order->getGrandTotal(),
'billingAddress' => $billingAddress
);
break;
case 'checkmo':
$paymentInstrumentList[] = array(
'type' => Microsoft_Dfp_Helper_Data::PI_TYPE_INVOICE,
'purchaseAmount' => $order->getGrandTotal(),
'billingAddress' => $billingAddress
);
break;
}
return $paymentInstrumentList;
}