當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。