/** * Make prepaid credit card payloads for any payments * remaining in the list * @param Mage_Sales_Model_Order $order * @param IPaymentContainer $paymentContainer * @param SplObjectStorage $processedPayments */ public function addPaymentsToPayload(Mage_Sales_Model_Order $order, IPaymentContainer $paymentContainer, SplObjectStorage $processedPayments) { foreach ($order->getAllPayments() as $payment) { if ($this->_shouldIgnorePayment($payment, $processedPayments)) { continue; } $iterable = $paymentContainer->getPayments(); $payload = $iterable->getEmptyCreditCardPayment(); $additionalInfo = new Varien_Object($payment->getAdditionalInformation()); $payload->setOrderId($order->getIncrementId())->setTenderType($additionalInfo->getTenderType())->setAccountUniqueId($this->_getAccountUniqueId($payment))->setPanIsToken($additionalInfo->getPanIsToken())->setPaymentRequestId($additionalInfo->getRequestId())->setCreateTimestamp($this->_getAsDateTime($payment->getCreatedAt()))->setAmount($payment->getAmountAuthorized())->setBankAuthorizationCode($additionalInfo->getBankAuthorizationCode())->setResponseCode($additionalInfo->getResponseCode())->setCVV2ResponseCode($additionalInfo->getCvv2ResponseCode())->setAVSResponseCode($additionalInfo->getAvsResponseCode())->setPhoneResponseCode($additionalInfo->getPhoneResponseCode())->setNameResponseCode($additionalInfo->getNameResponseCode())->setEmailResponseCode($additionalInfo->getEmailResponseCode())->setAmountAuthorized($additionalInfo->getAmountAuthorized())->setExpirationDate($this->_getExpirationDateTime($payment))->setExtendedAuthDescription($additionalInfo->getExtendedAuthDescription())->setExtendedAuthReasonCode($additionalInfo->getExtendedAuthReasonCode())->setIssueNumber($additionalInfo->getIssueNumber())->setAuthenticationAvailable($additionalInfo->getAuthenticationAvailable())->setAuthenticationStatus($additionalInfo->getAuthenticationStatus())->setCavvUcaf($additionalInfo->getCavvUcaf())->setTransactionId($additionalInfo->getTransactionId())->setECI($additionalInfo->getECI())->setPayerAuthenticationResponse($additionalInfo->getPayerAuthenticationResponse())->setPurchasePlanCode($additionalInfo->getPurchasePlanCode())->setPurchasePlanDescription($additionalInfo->getPurchasePlanDescription()); if ($additionalInfo->getStartDate()) { // prevent death by type error if getStartDate returns null $payload->setStartDate($this->_getAsDateTime($additionalInfo->getStartDate())); } // add the new payload $iterable->OffsetSet($payload, $payload); // put the payment in the processed payments set $processedPayments->attach($payment); } }