/** * Preapare basic paramters for transaction * * @param Varien_Object $payment * @param decimal $amount * @return array */ protected function _prepareTxnDetails(Varien_Object $payment, $amount) { if ($payment->getParentTransactionId()) { $txnDetails = array('txn_type' => self::TRANSACTION_TYPE_CAPTURE, 'capture_transaction_id' => $payment->getParentTransactionId()); } else { $billingAddress = $payment->getOrder()->getBillingAddress(); if ($payment->getOrder()->getCustomerEmail()) { $customerEmail = $payment->getOrder()->getCustomerEmail(); } elseif ($billingAddress->getEmail()) { $customerEmail = $billingAddress->getEmail(); } else { $customerEmail = ''; } $txnDetails = array('card_holder_name' => $payment->getCcOwner(), 'card_number' => $payment->getCcNumber(), 'card_type' => $this->_convertCcType($payment->getCcType()), 'card_expiry' => sprintf('%02d', $payment->getCcExpMonth()) . substr($payment->getCcExpYear(), 2, 2), 'card_csc' => $payment->getCcCid(), 'customer_email' => $customerEmail); if ($this->getConfigData('payment_action') == self::ACTION_AUTHORIZE) { $txnDetails['txn_type'] = self::TRANSACTION_TYPE_AUTHORISE; } else { $txnDetails['txn_type'] = self::TRANSACTION_TYPE_PURCHASE; } } $accountId = $payment->getFlo2cashAccountId(); //if transaction type is authorize & capture or only authorize if (is_null($accountId)) { $accountId = $this->getAccountId(); } $txnDetails = array_merge($txnDetails, array('merchant_reference' => $payment->getOrder()->getIncrementId(), 'paynz_account_id' => $accountId, 'amount' => sprintf('%.2f', $amount))); return $txnDetails; }