本文整理汇总了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;
}
}