当前位置: 首页>>代码示例>>PHP>>正文


PHP MP::get_payment_info方法代码示例

本文整理汇总了PHP中MP::get_payment_info方法的典型用法代码示例。如果您正苦于以下问题:PHP MP::get_payment_info方法的具体用法?PHP MP::get_payment_info怎么用?PHP MP::get_payment_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MP的用法示例。


在下文中一共展示了MP::get_payment_info方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: MP

<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once "lib/mercadopago.php";
$mp = new MP("3821444876288488", "1MsZwpHqFP2MDPh1d4IaXsIrUAbIXbjt");
$arquivo = fopen('result_ipn.php', 'a');
fwrite($arquivo, "\n POST <? echo('<pre>'); ?> " . $_SERVER['REQUEST_URI'] . "<? echo('</pre>'); ?><br><br>");
fclose($arquivo);
switch ($_GET["topic"]) {
    case "payment":
        $payment_info = $mp->get_payment_info($_GET["id"]);
        if ($payment_info["status"] == 200) {
            $arquivo = fopen('result_ipn.php', 'a');
            fwrite($arquivo, "\n<? echo('<pre>'); ?> " . json_encode($payment_info) . "<? echo('</pre>'); ?><br><hr><br>");
            fclose($arquivo);
        }
        break;
    case "preapproval":
        $payment_info = $mp->get_preapproval_payment($_GET["id"]);
        if ($payment_info["status"] == 200) {
            $arquivo = fopen('result_ipn.php', 'a');
            fwrite($arquivo, "\n<pre> " . json_encode($payment_info) . "</pre><br><hr><br>");
            fclose($arquivo);
        }
        break;
    case "authorized_payment":
        $payment_info = $mp->get_authorized_payment($_GET["id"]);
        if ($payment_info["status"] == 200) {
            $arquivo = fopen('result_ipn.php', 'a');
            fwrite($arquivo, "\n<pre> " . json_encode($payment_info) . "</pre><br><hr><br>");
开发者ID:vvasconcellos,项目名称:mp2,代码行数:31,代码来源:ipn.php

示例2: retorno

 public function retorno()
 {
     if (isset($_REQUEST['id'])) {
         $id = $_REQUEST['id'];
         $client_id = $this->config->get('mercadopago2_client_id');
         $client_secret = $this->config->get('mercadopago2_client_secret');
         $sandbox = $this->config->get('mercadopago2_sandbox') == 1 ? true : null;
         //$checkdata = New Shop($client_id,$client_secret);
         $mp = new MP($client_id, $client_secret);
         $mp->sandbox_mode($sandbox);
         //$dados = $checkdata->GetStatus($id);
         $dados = $mp->get_payment_info($id);
         $dados = $dados['response'];
         $order_id = $dados['collection']['external_reference'];
         $order_status = $dados['collection']['status'];
         $this->load->model('checkout/order');
         $order = $this->model_checkout_order->getOrder($order_id);
         if ($order['order_status_id'] == '0') {
             $this->model_checkout_order->confirm($order_id, $this->config->get('mercadopago_order_status_id'));
         }
         switch ($order_status) {
             case 'approved':
                 $this->model_checkout_order->update($order_id, $this->config->get('mercadopago2_order_status_id_completed'));
                 break;
             case 'pending':
                 $this->model_checkout_order->update($order_id, $this->config->get('mercadopago2_order_status_id_pending'));
                 break;
             case 'in_process':
                 $this->model_checkout_order->update($order_id, $this->config->get('mercadopago2_order_status_id_process'));
                 break;
             case 'reject':
                 $this->model_checkout_order->update($order_id, $this->config->get('mercadopago2_order_status_id_rejected'));
                 break;
             case 'refunded':
                 $this->model_checkout_order->update($order_id, $this->config->get('mercadopago2_order_status_id_refunded'));
                 break;
             case 'cancelled':
                 $this->model_checkout_order->update($order_id, $this->config->get('mercadopago2_order_status_id_cancelled'));
                 break;
             case 'in_metiation':
                 $this->model_checkout_order->update($order_id, $this->config->get('mercadopago2_order_status_id_in_mediation'));
                 break;
             default:
                 $this->model_checkout_order->update($order_id, $this->config->get('mercadopago2_order_status_id_pending'));
                 break;
         }
         echo "ID: " . $id . " - Status: " . $order_status;
     }
 }
开发者ID:BrunoCodeman,项目名称:cart-opencart,代码行数:49,代码来源:mercadopago2.php

示例3: MP

<?php

include_once '../../../config/config.inc.php';
include_once 'mercadopago.php';
if (isset($_REQUEST['topic']) && isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
    $client_id = Db::getInstance()->getRow("SELECT value FROM " . _DB_PREFIX_ . "configuration WHERE name = 'mercadopago_CLIENT_ID'");
    $client_secret = Db::getInstance()->getRow("SELECT value FROM " . _DB_PREFIX_ . "configuration WHERE name = 'mercadopago_CLIENT_SECRET'");
    $sandbox = Db::getInstance()->getRow("SELECT value FROM " . _DB_PREFIX_ . "configuration WHERE name = 'mercadopago_SANDBOX'");
    $mp = new MP($client_id['value'], $client_secret['value']);
    $mp->sandbox_mode($sandbox['value'] == "active" ? true : false);
    $dados = $mp->get_payment_info($id);
    $dados = $dados['response'];
    $order_id = $dados['collection']['external_reference'];
    $order_status = $dados["collection"]["status"];
    switch ($order_status) {
        case 'approved':
            $nomestatus = "mercadopago_STATUS_1";
            break;
        case 'pending':
            $nomestatus = "mercadopago_STATUS_0";
            break;
        case 'in_process':
            $nomestatus = "mercadopago_STATUS_0";
            break;
        case 'reject':
            $nomestatus = "mercadopago_STATUS_2";
            break;
        case 'refunded':
            $nomestatus = "mercadopago_STATUS_2";
            break;
开发者ID:mercadeoweb,项目名称:cart-prestashop,代码行数:31,代码来源:retorno.php

示例4: retorno

 public function retorno()
 {
     if (isset($this->request->get['collection_id'])) {
         if ($this->request->get['collection_id'] == 'null') {
             $order_id = $this->request->get['external_reference'];
             $this->load->model('checkout/order');
             $this->model_checkout_order->addOrderHistory($order_id, $this->config->get('mp_standard_order_status_id_' . $this->request->get['status']), date('d/m/Y h:i'));
             return;
         }
         $ids = explode(',', $this->request->get['collection_id']);
         $client_id = $this->config->get('mp_standard_client_id');
         $client_secret = $this->config->get('mp_standard_client_secret');
         $sandbox = $this->config->get('mp_standard_sandbox') == 1 ? true : null;
         $mp = new MP($client_id, $client_secret);
         $mp->sandbox_mode($sandbox);
         foreach ($ids as $id) {
             $resposta = $mp->get_payment_info($id);
             $dados = $resposta['response'];
             $order_id = $dados['collection']['external_reference'];
             $order_status = $dados['collection']['status'];
             $this->load->model('checkout/order');
             $order = $this->model_checkout_order->getOrder($order_id);
             if ($order['order_status_id'] == '0') {
                 $this->model_checkout_order->addOrderHistory($order_id, $this->config->get('mp_standard_order_status_id'));
             }
             switch ($order_status) {
                 case 'approved':
                     $this->model_checkout_order->addOrderHistory($order_id, $this->config->get('mp_standard_order_status_id_completed'), date('d/m/Y h:i') . ' - ' . $dados['collection']['payment_method_id'] . ' - ' . $dados['collection']['net_received_amount']);
                     break;
                 case 'pending':
                     $this->model_checkout_order->addOrderHistory($order_id, $this->config->get('mp_standard_order_status_id_pending'), date('d/m/Y h:i') . ' - ' . $dados['collection']['payment_method_id'] . ' - ' . $dados['collection']['net_received_amount']);
                     break;
                 case 'in_process':
                     $this->model_checkout_order->addOrderHistory($order_id, $this->config->get('mp_standard_order_status_id_process'), date('d/m/Y h:i') . ' - ' . $dados['collection']['payment_method_id'] . ' - ' . $dados['collection']['net_received_amount']);
                     break;
                 case 'reject':
                     $this->model_checkout_order->addOrderHistory($order_id, $this->config->get('mp_standard_order_status_id_rejected'), date('d/m/Y h:i') . ' - ' . $dados['collection']['payment_method_id'] . ' - ' . $dados['collection']['net_received_amount']);
                     break;
                 case 'refunded':
                     $this->model_checkout_order->addOrderHistory($order_id, $this->config->get('mp_standard_order_status_id_refunded'), date('d/m/Y h:i') . ' - ' . $dados['collection']['payment_method_id'] . ' - ' . $dados['collection']['net_received_amount']);
                     break;
                 case 'cancelled':
                     $this->model_checkout_order->addOrderHistory($order_id, $this->config->get('mp_standard_order_status_id_cancelled'), date('d/m/Y h:i') . ' - ' . $dados['collection']['payment_method_id'] . ' - ' . $dados['collection']['net_received_amount']);
                     break;
                 case 'in_metiation':
                     $this->model_checkout_order->addOrderHistory($order_id, $this->config->get('mp_standard_order_status_id_in_mediation'), date('d/m/Y h:i') . ' - ' . $dados['collection']['payment_method_id'] . ' - ' . $dados['collection']['net_received_amount']);
                     break;
                 default:
                     $this->model_checkout_order->addOrderHistory($order_id, $this->config->get('mp_standard_order_status_id_pending'), date('d/m/Y h:i') . ' - ' . $dados['collection']['payment_method_id'] . ' - ' . $dados['collection']['net_received_amount']);
                     break;
             }
         }
     } else {
         error_log('id não setado na compra!!!');
     }
 }
开发者ID:BrunoCodeman,项目名称:cart-opencart,代码行数:56,代码来源:mp_standard.php


注:本文中的MP::get_payment_info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。