當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MP::create_custon_payment方法代碼示例

本文整理匯總了PHP中MP::create_custon_payment方法的典型用法代碼示例。如果您正苦於以下問題:PHP MP::create_custon_payment方法的具體用法?PHP MP::create_custon_payment怎麽用?PHP MP::create_custon_payment使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MP的用法示例。


在下文中一共展示了MP::create_custon_payment方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postPago

 public function postPago()
 {
     Mage::helper('mercadopago')->log("init post pago", 'mercadopago-custom.log');
     $core = Mage::getModel('mercadopago/core');
     //seta sdk php mercadopago
     $client_id = Mage::getStoreConfig('payment/mercadopago/client_id');
     $client_secret = Mage::getStoreConfig('payment/mercadopago/client_secret');
     $mp = new MP($client_id, $client_secret);
     //monta a preferencia
     $pref = $this->makePreference();
     Mage::helper('mercadopago')->log("make array", 'mercadopago-custom.log', $pref);
     //faz o post do pagamento
     $response = $mp->create_custon_payment($pref);
     Mage::helper('mercadopago')->log("post pago", 'mercadopago-custom.log', $response);
     if ($response['status'] == 200 || $response['status'] == 201) {
         return $response;
     } else {
         $e = "";
         foreach ($response['response']['cause'] as $error) {
             switch ($error['code']) {
                 case "106":
                     $e .= Mage::helper('mercadopago')->__('You can not make payments to users in other countries.');
                     break;
                 case "109":
                     $e .= Mage::helper('mercadopago')->__('Payment Method selected does not process payments in installments selected. Choose another card or another payment method.');
                     break;
                 case "126":
                     $e .= Mage::helper('mercadopago')->__('We could not process your payment. Error code: 126.');
                     break;
                 case "129":
                     $e .= Mage::helper('mercadopago')->__('Payment Method selected does not process payments for the selected amount. Choose another card or another payment method.');
                     break;
                 case "137":
                     $e .= Mage::helper('mercadopago')->__('The amount is required.');
                     break;
                 case "145":
                     $e .= Mage::helper('mercadopago')->__('We could not process your payment. Error code: 145.');
                     break;
                 case "150":
                     $e .= Mage::helper('mercadopago')->__('You can not make payments. Error code: 150.');
                     break;
                 case "151":
                     $e .= Mage::helper('mercadopago')->__('You can not make payments.');
                     break;
                 case "160":
                     $e .= Mage::helper('mercadopago')->__('We could not process your payment. Error code: 160.');
                     break;
                 case "204":
                     $e .= Mage::helper('mercadopago')->__('Payment Method selected is not available at this time. Choose another card or another payment method.');
                     break;
                 case "801":
                     $e .= Mage::helper('mercadopago')->__('You made a similar payment moments ago. Try again in a few minutes.');
                     break;
                     //validacao do coupon
                 //validacao do coupon
                 case "campaign_code_doesnt_match":
                     $e .= Mage::helper('mercadopago')->__("Doesn't find a campaign with the given code.");
                     break;
                 default:
                     $e .= Mage::helper('mercadopago')->__("We could not process your payment. %s", json_encode($response));
                     break;
             }
         }
         Mage::helper('mercadopago')->log("erro post pago: " . $e, 'mercadopago-custom.log');
         Mage::helper('mercadopago')->log("response post pago: ", 'mercadopago-custom.log', $response);
         Mage::throwException($e);
         return false;
     }
 }
開發者ID:colombinis,項目名稱:cart-magento,代碼行數:69,代碼來源:Payment.php


注:本文中的MP::create_custon_payment方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。