本文整理汇总了PHP中Mage_Sales_Model_Order_Payment::setAdditionalData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Payment::setAdditionalData方法的具体用法?PHP Mage_Sales_Model_Order_Payment::setAdditionalData怎么用?PHP Mage_Sales_Model_Order_Payment::setAdditionalData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Sales_Model_Order_Payment
的用法示例。
在下文中一共展示了Mage_Sales_Model_Order_Payment::setAdditionalData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _place
public function _place(Mage_Sales_Model_Order_Payment $payment, $amount)
{
try {
$order = $payment->getOrder();
$azpay = new AZPay($this->_merchantId, $this->_merchantKey);
$azpay->curl_timeout = 60;
$azpay->config_order['reference'] = $order->getRealOrderId();
$azpay->config_order['totalAmount'] = Mage::helper('azpay')->formatAmount($amount);
$azpay->config_options['urlReturn'] = Mage::getUrl('azpay/transaction_boleto/postback');
/*$azpay->config_boleto['acquirer'] = $this->getConfigData('operator');
$azpay->config_boleto['expire'] = $this->_generateExpirationDate();
$azpay->config_boleto['nrDocument'] = substr($order->getRealOrderId(), 1);
$azpay->config_boleto['amount'] = Mage::helper('azpay')->formatAmount($amount);
$azpay->config_boleto['instructions'] = $this->getConfigData('instructions');*/
$azpay->config_online_debit['acquirer'] = $this->getConfigData('operator');
$billingAddress = $order->getBillingAddress();
if ($order->getCustomerTaxvat()) {
$azpay->config_billing['customerIdentity'] = $order->getCustomerTaxvat();
} else {
$azpay->config_billing['customerIdentity'] = $order->getRealOrderId();
}
$azpay->config_billing['name'] = $order->getCustomerName();
$azpay->config_billing['address'] = $billingAddress->getStreet(1) . ',' . $billingAddress->getStreet(2);
$azpay->config_billing['address2'] = $billingAddress->getStreet(3) ? $billingAddress->getStreet(3) : '';
$azpay->config_billing['city'] = $billingAddress->getCity();
$azpay->config_billing['state'] = $billingAddress->getRegionCode();
$azpay->config_billing['postalCode'] = Zend_Filter::filterStatic($billingAddress->getPostcode(), 'Digits');
$azpay->config_billing['phone'] = Mage::helper('azpay')->splitTelephone($billingAddress->getTelephone());
$azpay->config_billing['email'] = $order->getCustomerEmail();
$azpay->config_options['urlReturn'] = Mage::getUrl('azpay/transaction_boleto/postback');
// Execute
$azpay->online_debit()->execute();
$azpay->getXml();
// usado para salvar o XML gerado no log
// Log
if ($this->getConfigData('log')) {
Mage::log($azpay, null, "azpay_boleto.log");
}
} catch (AZPay_Error $e) {
Mage::log($e->getMessage(), null, "azpay_boleto_error.log");
$error = $azpay->responseError();
return Mage::throwException("Ocorreu um problema com o seu pedido. Tente novamente ou entre em contato conosco informando este código: " . $error['status_message']);
}
// Response
$gateway_response = $azpay->response();
$paymentDetails['azpayboletourl'] = (string) $gateway_response->processor->Transfer->urlTransfer;
$payment->setAdditionalData(serialize($paymentDetails));
// azpay info
$payment->setAzpayTransactionId($gateway_response->transactionId)->setAzpayBoletoUrl((string) $gateway_response->processor->Transfer->urlTransfer);
return $this;
}