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


PHP MP::get_payment方法代码示例

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


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

示例1: dirname

<?php

//define( 'SHORTINIT', true );
require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/wp-load.php';
$payments_others = unserialize(get_option('carrental_available_payments_others'));
if (is_file(dirname(dirname(__FILE__)) . '/carrental-payments-mercadopago/mercadopago.php') && $payments_others && !empty($payments_others) && isset($payments_others['eway']) && $payments_others['eway']['enabled'] == 'yes') {
    require_once dirname(dirname(__FILE__)) . '/carrental-payments-mercadopago/mercadopago.php';
    $mp = new MP($payments_others['mercadopago']['client-id'], $payments_others['mercadopago']['client-secret']);
    $mp->sandbox_mode(false);
    try {
        $response = $mp->get_payment($_GET['id']);
        file_put_contents('mercadopago_ipn.log', print_r($response, true) . "\n\n-------------------------------------\n\n", FILE_APPEND);
    } catch (Exception $e) {
        file_put_contents('mercadopago_ipn.log', print_r($response, true) . "\n\n-------------------------------------\n\n", FILE_APPEND);
        file_put_contents('mercadopago_ipn.log', 'ERROR: ' . $e->getMessage() . "\n\n-------------------------------------\n\n", FILE_APPEND);
        exit;
    }
    //file_put_contents('mercadopago_ipn.log', print_r($response, true), FILE_APPEND . "\n\n-------------------------------------\n\n");
    if ($response) {
        if (isset($response['response']) && isset($response['response']['collection']) && isset($response['response']['collection']['status']) && $response['response']['collection']['status'] == 'approved') {
            // IPN response was "VERIFIED"
            list($payment_id, $lang) = explode('#', $response['response']['collection']['external_reference']);
            $wpdb->query($wpdb->prepare('UPDATE ' . CarRental::$db['booking'] . ' SET `paid_online` = ' . (double) $response['response']['collection']['total_paid_amount'] . ', `status` = 1 WHERE MD5(CONCAT(`id_order`, %s, `email`)) = %s', CarRental::$hash_salt, $payment_id));
            file_put_contents('mercadopago_ipn.log', '***VERIFIED*** - ' . $wpdb->prepare('UPDATE ' . CarRental::$db['booking'] . ' SET `paid_online` = ' . (double) $response['response']['collection']['total_paid_amount'] . ', `status` = 1 WHERE MD5(CONCAT(`id_order`, %s, `email`)) = %s', CarRental::$hash_salt, $payment_id), FILE_APPEND);
            // Send e-mail
            if (isset($lang) && !empty($lang)) {
                $emailBody = get_option('carrental_reservation_email_' . $lang);
                if ($emailBody == '') {
                    $emailBody = get_option('carrental_reservation_email_en_GB');
                }
                $emailSubject = get_option('carrental_reservation_email_subject_' . $lang);
开发者ID:g14studio,项目名称:hmo,代码行数:31,代码来源:mercadopago_ipn.php

示例2: getPayment

 public function getPayment($payment_id)
 {
     $model = $this;
     $this->client_id = Mage::getStoreConfig('payment/mercadopago/client_id');
     $this->client_secret = Mage::getStoreConfig('payment/mercadopago/client_secret');
     $mp = new MP($this->client_id, $this->client_secret);
     return $mp->get_payment($payment_id);
 }
开发者ID:colombinis,项目名称:cart-magento,代码行数:8,代码来源:Core.php


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