本文整理汇总了PHP中Mage_Sales_Model_Order_Payment类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Sales_Model_Order_Payment类的具体用法?PHP Mage_Sales_Model_Order_Payment怎么用?PHP Mage_Sales_Model_Order_Payment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Sales_Model_Order_Payment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _place
public function _place(Mage_Sales_Model_Order_Payment $payment, $amount)
{
$order = $payment->getOrder();
$items = Mage::helper('iugu')->getItemsFromOrder($payment->getOrder());
$payer = Mage::helper('iugu')->getPayerInfoFromOrder($payment->getOrder());
$data = new Varien_Object();
$data->setMethod(Inovarti_Iugu_Model_Api::PAYMENT_METHOD_BOLETO)->setEmail($order->getCustomerEmail())->setItems($items)->setPayer($payer)->setNotificationUrl(Mage::getUrl('iugu/notification'));
// Discount
if ($order->getBaseDiscountAmount()) {
$data->setDiscountCents(Mage::helper('iugu')->formatAmount(abs($order->getBaseDiscountAmount())));
}
// Tax
if ($order->getBaseTaxAmount()) {
$data->setTaxCents($this->formatAmount($order->getBaseTaxAmount()));
}
$result = Mage::getSingleton('iugu/api')->charge($data);
if ($result->getErrors()) {
$messages = array();
if (is_array($result->getErrors())) {
foreach ($result->getErrors() as $field => $errors) {
foreach ($errors as $error) {
$messages[] = $field . ': ' . $error . '.';
}
}
} else {
$messages[] = $result->getErrors();
}
Mage::throwException(implode("\n", $messages));
}
// iugu info
$payment->setIuguInvoiceId($result->getInvoiceId())->setIuguUrl($result->getUrl())->setIuguPdf($result->getPdf());
return $this;
}
开发者ID:thiagormartins,项目名称:iugu-magento,代码行数:33,代码来源:Boleto.php
示例2: determineIsPartial
/**
* Checks if partial capture
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @return bool
*/
public function determineIsPartial($payment, $amount)
{
$grandTotal = $payment->getOrder()->getGrandTotal();
if ($grandTotal != $amount) {
return true;
} else {
return false;
}
}
开发者ID:nomade-it,项目名称:MagentoPostFinance,代码行数:16,代码来源:Capture.php
示例3: paymentToQuotePayment
/**
* Convert order payment to quote payment
*
* @param Mage_Sales_Model_Order_Payment $payment
* @return Mage_Sales_Model_Quote_Payment
*/
public function paymentToQuotePayment(Mage_Sales_Model_Order_Payment $payment, $quotePayment = null)
{
if (!$quotePayment instanceof Mage_Sales_Model_Quote_Payment) {
$quotePayment = Mage::getModel('sales/quote_payment');
}
$quotePayment->setStoreId($payment->getStoreId())->setCustomerPaymentId($payment->getCustomerPaymentId());
Mage::helper('core')->copyFieldset('sales_convert_order_payment', 'to_quote_payment', $payment, $quotePayment);
return $quotePayment;
}
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:15,代码来源:Order.php
示例4: unserializeFields
/**
* Unserialize additional data if required
* @param Mage_Sales_Model_Order_Payment $payment
*/
public function unserializeFields(Mage_Sales_Model_Order_Payment $payment)
{
$additionalInformation = $payment->getData('additional_information');
if (empty($additionalInformation)) {
$payment->setData('additional_information', array());
} elseif (!is_array($additionalInformation)) {
$payment->setData('additional_information', unserialize($additionalInformation));
}
}
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:13,代码来源:Payment.php
示例5: _placeOrder
/**
* Place an order with authorization or capture action
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @return Mage_Paypal_Model_Method_Agreement
*/
protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
{
$order = $payment->getOrder();
$api = $this->_pro->getApi()->setBillingAgreementId($payment->getBillingAgreementId())->setPaymentAction($this->_pro->getConfig()->paymentAction)->setAmount($amount)->setNotifyUrl(Mage::getUrl('paypal/ipn/'))->setPaypalCart(Mage::getModel('paypal/cart', array($order)))->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled)->setInvNum($order->getIncrementId());
// call api and import transaction and other payment information
$api->callDoReferenceTransaction();
$this->_pro->importPaymentInfo($api, $payment);
$payment->setAdditionalInformation(CLS_Paypal_Model_Paypaluk_Api_Nvp::RESPONSE_MSG, $api->getResponseMsg())->setPreparedMessage(Mage::helper('cls_paypal')->__('Payflow PNREF: #%s.', $api->getTransactionId()))->setTransactionAdditionalInfo(Mage_PaypalUk_Model_Pro::TRANSPORT_PAYFLOW_TXN_ID, $api->getTransactionId());
$payment->setTransactionId($api->getPaypalTransactionId())->setIsTransactionClosed(0);
return $this;
}
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:18,代码来源:Agreement.php
示例6: _placeOrder
/**
* Place an order with authorization or capture action
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @return CLS_Paypal_Model_Paypal_Method_Orderstored_Agreement
*/
protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
{
$order = $payment->getOrder();
$api = $this->_pro->getApi()->setReferenceId($payment->getBillingAgreementId())->setPaymentAction($this->_pro->getConfig()->paymentAction)->setAmount($amount)->setNotifyUrl(Mage::getUrl('paypal/ipn/'))->setPaypalCart(Mage::getModel('paypal/cart', array($order)))->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled)->setInvNum($order->getIncrementId());
// call api and import transaction and other payment information
$api->callDoReferenceTransaction();
$this->_pro->importPaymentInfo($api, $payment);
$api->callGetTransactionDetails();
$this->_pro->importPaymentInfo($api, $payment);
$payment->setTransactionId($api->getTransactionId())->setIsTransactionClosed(0);
return $this;
}
开发者ID:xiaoguizhidao,项目名称:bb,代码行数:19,代码来源:Agreement.php
示例7: addNewTransaction
/**
* Magento $payment->addTransaction(...) needs the transaction_id = id from the transaction entry or string!
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param string $type
* @param Mage_Sales_Model_Abstract $salesDocument
* @param bool $failsafe
* @param string $message
* @return null|Mage_Sales_Model_Order_Payment_Transaction
*/
public function addNewTransaction(Mage_Sales_Model_Order_Payment $payment, $type, $salesDocument = null, $failsafe = false, $message = false)
{
$transaction = null;
try {
$addInformation = $payment->getAdditionalInformation();
$payment->setTransactionId($addInformation['transactionId'] . '-' . $type);
$transaction = $payment->addTransaction($type, $salesDocument, $failsafe, $message);
$transaction->save();
} catch (Exception $e) {
Mage::logException($e);
}
return $transaction;
}
开发者ID:nschoen,项目名称:magento-module,代码行数:23,代码来源:Payment.php
示例8: _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;
}
开发者ID:AZPay,项目名称:Magento-Azpay,代码行数:51,代码来源:Boleto.php
示例9: getVaultParams
/**
* @param Mage_Sales_Model_Order_Payment $payment
* @return array
*/
protected function getVaultParams($payment)
{
$params = array();
$params['card_number'] = $payment->getCcNumber();
$params['card_expiry_month'] = $payment->getCcExpMonth() < 10 ? '0' . $payment->getCcExpMonth() : $payment->getCcExpMonth();
$params['card_expiry_year'] = $payment->getCcExpYear();
$params['cvc'] = $payment->getCcCid();
$params['multi_use'] = 1;
//Add card holder
$billing = $payment->getOrder()->getBillingAddress();
$defaultOwner = $billing->getFirstname() && $billing->getLastname() ? $billing->getFirstname() . ' ' . $billing->getLastname() : $billing->getEmail();
$params['card_holder'] = $payment->getCcOwner() ? $payment->getCcOwner() : $defaultOwner;
$this->_debug($params);
return $params;
}
开发者ID:hipay,项目名称:hipay-fullservice-sdk-magento1,代码行数:19,代码来源:Cc.php
示例10: cancel
/**
* Order cancellation hook for payment method instance
* Adds void transaction if needed
* @return Mage_Sales_Model_Order_Payment
*/
public function cancel()
{
if ($this->getMethodInstance()->getCode() == Braintree_Payments_Model_Creditcard::PAYMENT_METHOD_CODE) {
Mage::register(self::REGISTRY_KEY_CANCEL, true);
}
return parent::cancel();
}
开发者ID:portchris,项目名称:NaturalRemedyCompany,代码行数:12,代码来源:Payment.php
示例11: _beforeSave
/**
* Verify data required for saving
* @return Mage_Sales_Model_Order_Payment_Transaction
* @throws Mage_Core_Exception
*/
protected function _beforeSave()
{
// set parent id
$this->_verifyPaymentObject();
$this->setPaymentId($this->_paymentObject->getId())->setOrderId($this->getOrderId());
return parent::_beforeSave();
}
开发者ID:hunnybohara,项目名称:magento-chinese-localization,代码行数:12,代码来源:Transaction.php
示例12: _place
public function _place(Mage_Sales_Model_Order_Payment $payment, $amount)
{
$order = $payment->getOrder();
$customer = Mage::helper('pagarme')->getCustomerInfoFromOrder($payment->getOrder());
$data = new Varien_Object();
$data->setPaymentMethod(Inovarti_Pagarme_Model_Api::PAYMENT_METHOD_BOLETO)->setAmount(Mage::helper('pagarme')->formatAmount($amount))->setBoletoExpirationDate($this->_generateExpirationDate())->setCustomer($customer)->setPostbackUrl(Mage::getUrl('pagarme/transaction_boleto/postback'));
$pagarme = Mage::getModel('pagarme/api');
$transaction = $pagarme->charge($data);
if ($transaction->getErrors()) {
$messages = array();
foreach ($transaction->getErrors() as $error) {
$messages[] = $error->getMessage() . '.';
}
Mage::throwException(implode("\n", $messages));
}
// pagar.me info
$payment->setPagarmeTransactionId($transaction->getId())->setPagarmeBoletoUrl($transaction->getBoletoUrl())->setPagarmeBoletoBarcode($transaction->getBoletoBarcode())->setPagarmeBoletoExpirationDate($transaction->getBoletoExpirationDate());
return $this;
}
开发者ID:hiuryanderson,项目名称:pagarme-magento,代码行数:19,代码来源:Boleto.php
示例13: testGetTotalsHtml
/**
* @magentoAppIsolation enabled
*/
public function testGetTotalsHtml()
{
$order = new Mage_Sales_Model_Order();
Mage::register('current_order', $order);
$payment = new Mage_Sales_Model_Order_Payment();
$payment->setMethod('checkmo');
$order->setPayment($payment);
$layout = new Mage_Core_Model_Layout();
$block = new Mage_Sales_Block_Order_Print_Creditmemo();
$layout->addBlock($block, 'block');
$childBlock = $layout->addBlock('Mage_Core_Block_Text', 'creditmemo_totals', 'block');
$expectedHtml = '<b>Any html</b>';
$creditmemo = new Mage_Sales_Model_Order_Creditmemo();
$this->assertEmpty($childBlock->getCreditmemo());
$this->assertNotEquals($expectedHtml, $block->getTotalsHtml($creditmemo));
$childBlock->setText($expectedHtml);
$actualHtml = $block->getTotalsHtml($creditmemo);
$this->assertSame($creditmemo, $childBlock->getCreditmemo());
$this->assertEquals($expectedHtml, $actualHtml);
}
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:23,代码来源:Creditmemo.php
示例14: _beforeSave
/**
* Verify data required for saving
* @return Mage_Sales_Model_Order_Payment_Transaction
* @throws Mage_Core_Exception
*/
protected function _beforeSave()
{
// set parent id
$this->_verifyPaymentObject();
if (!$this->getId()) {
// We need to set order and payment ids only for new transactions
if (null !== $this->_paymentObject) {
$this->setPaymentId($this->_paymentObject->getId());
}
if (null !== $this->_order) {
$this->setOrderId($this->_order->getId());
}
$this->setCreatedAt(Mage::getModel('core/date')->gmtDate());
}
return parent::_beforeSave();
}
开发者ID:cewolf2002,项目名称:magento,代码行数:21,代码来源:Transaction.php
示例15: importOrderPayment
/**
* Import payment data to billing agreement
*
* $payment->getBillingAgreementData() contains array with following structure :
* [billing_agreement_id] => string
* [method_code] => string
*
* @param Mage_Sales_Model_Order_Payment $payment
* @return Mage_Sales_Model_Billing_Agreement
*/
public function importOrderPayment(Mage_Sales_Model_Order_Payment $payment)
{
$baData = $payment->getBillingAgreementData();
$this->_paymentMethodInstance = isset($baData['method_code']) ? Mage::helper('payment')->getMethodInstance($baData['method_code']) : $payment->getMethodInstance();
if ($this->_paymentMethodInstance) {
$this->_paymentMethodInstance->setStore($payment->getMethodInstance()->getStore());
$this->setCustomerId($payment->getOrder()->getCustomerId())->setMethodCode($this->_paymentMethodInstance->getCode())->setReferenceId($baData['billing_agreement_id'])->setStatus(self::STATUS_ACTIVE);
}
return $this;
}
开发者ID:hirentricore,项目名称:devmagento,代码行数:20,代码来源:Agreement.php
示例16: _addTransaction
/**
* Add payment transaction
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param string $transactionId
* @param string $transactionType
* @param array $transactionDetails
* @param array $transactionAdditionalInfo
* @return null|Mage_Sales_Model_Order_Payment_Transaction
*/
protected function _addTransaction(Mage_Sales_Model_Order_Payment $payment, $transactionId, $transactionType, array $transactionDetails = array(), array $transactionAdditionalInfo = array(), $message = false)
{
$payment->setTransactionId($transactionId);
$payment->resetTransactionAdditionalInfo();
foreach ($transactionDetails as $key => $value) {
$payment->setData($key, $value);
}
foreach ($transactionAdditionalInfo as $key => $value) {
$payment->setTransactionAdditionalInfo($key, $value);
}
$transaction = $payment->addTransaction($transactionType, null, false, $message);
foreach ($transactionDetails as $key => $value) {
$payment->unsetData($key);
}
$payment->unsLastTransId();
/**
* It for self using
*/
$transaction->setMessage($message);
return $transaction;
}
开发者ID:par-orillonsoft,项目名称:magento_work,代码行数:31,代码来源:Authorizenet.php
示例17: setPayment
public function setPayment(Mage_Sales_Model_Order_Payment $payment)
{
if (!$this->getIsMultiPayment() && ($old = $this->getPayment())) {
$payment->setId($old->getId());
}
$this->addPayment($payment);
return $payment;
}
开发者ID:blazeriaz,项目名称:youguess,代码行数:8,代码来源:Order.php
示例18: processInvoice
/**
* Set capture transaction ID to invoice for informational purposes
* @param Mage_Sales_Model_Order_Invoice $invoice
* @param Mage_Sales_Model_Order_Payment $payment
* @return Mage_Payment_Model_Method_Abstract
*/
public function processInvoice($invoice, $payment)
{
$invoice->setTransactionId($payment->getLastTransId());
return $this;
}
开发者ID:beejhuff,项目名称:magento-1.13.0.2,代码行数:11,代码来源:Gate.php
示例19: paymentToQuotePayment
/**
* Convert order payment to quote payment
*
* @param Mage_Sales_Model_Order_Payment $payment
* @return Mage_Sales_Model_Quote_Payment
*/
public function paymentToQuotePayment(Mage_Sales_Model_Order_Payment $payment, $quotePayment = null)
{
if (!$quotePayment instanceof Mage_Sales_Model_Quote_Payment) {
$quotePayment = AO::getModel('sales/quote_payment');
}
$quotePayment->setStoreId($payment->getStoreId())->setCustomerPaymentId($payment->getCustomerPaymentId());
AO::helper('core')->copyFieldset('sales_convert_order_payment', 'to_quote_payment', $payment, $quotePayment);
// ->setMethod($payment->getMethod())
// ->setAdditionalData($payment->getAdditionalData())
// ->setPoNumber($payment->getPoNumber())
// ->setCcType($payment->getCcType())
// ->setCcNumberEnc($payment->getCcNumberEnc())
// ->setCcLast4($payment->getCcLast4())
// ->setCcOwner($payment->getCcOwner())
// ->setCcCidEnc($payment->getCcCidEnc())
// ->setCcExpMonth($payment->getCcExpMonth())
// ->setCcExpYear($payment->getCcExpYear())
//
// ->setCcSsIssue($payment->getCcSsIssue()) //for direct payment
// ->setCcSsStartMonth($payment->getCcSsStartMonth()) //for direct payment
// ->setCcSsStartYear($payment->getCcSsStartYear()) //for direct payment
// ;
return $quotePayment;
}
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:30,代码来源:Convert_Order.php
示例20: _placeOrder
/**
* Place an order with authorization or capture action
*
* @param Mage_Sales_Model_Order_Payment $payment
* @param float $amount
* @return Mage_Paypal_Model_Direct
*/
protected function _placeOrder(Mage_Sales_Model_Order_Payment $payment, $amount)
{
$order = $payment->getOrder();
$api = $this->_pro->getApi()->setPaymentAction($this->_pro->getConfig()->paymentAction)->setIpAddress(Mage::app()->getRequest()->getClientIp(false))->setAmount($amount)->setCurrencyCode($order->getBaseCurrencyCode())->setInvNum($order->getIncrementId())->setEmail($order->getCustomerEmail())->setNotifyUrl(Mage::getUrl('paypal/ipn/'))->setCreditCardType($payment->getCcType())->setCreditCardNumber($payment->getCcNumber())->setCreditCardExpirationDate($this->_getFormattedCcExpirationDate($payment->getCcExpMonth(), $payment->getCcExpYear()))->setCreditCardCvv2($payment->getCcCid())->setMaestroSoloIssueNumber($payment->getCcSsIssue());
if ($payment->getCcSsStartMonth() && $payment->getCcSsStartYear()) {
$year = sprintf('%02d', substr($payment->getCcSsStartYear(), -2, 2));
$api->setMaestroSoloIssueDate($this->_getFormattedCcExpirationDate($payment->getCcSsStartMonth(), $year));
}
if ($this->getIsCentinelValidationEnabled()) {
$this->getCentinelValidator()->exportCmpiData($api);
}
// add shipping and billing addresses
if ($order->getIsVirtual()) {
$api->setAddress($order->getBillingAddress())->setSuppressShipping(true);
} else {
$api->setAddress($order->getShippingAddress());
$api->setBillingAddress($order->getBillingAddress());
}
// add line items
$api->setPaypalCart(Mage::getModel('paypal/cart', array($order)))->setIsLineItemsEnabled($this->_pro->getConfig()->lineItemsEnabled);
// call api and import transaction and other payment information
$api->callDoDirectPayment();
$this->_importResultToPayment($api, $payment);
try {
$api->callGetTransactionDetails();
} catch (Mage_Core_Exception $e) {
// if we recieve errors, but DoDirectPayment response is Success, then set Pending status for transaction
$payment->setIsTransactionPending(true);
}
$this->_importResultToPayment($api, $payment);
return $this;
}
开发者ID:cnglobal-sl,项目名称:caterez,代码行数:39,代码来源:Direct.php
注:本文中的Mage_Sales_Model_Order_Payment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论