Plugin Directory

Changeset 2963879


Ignore:
Timestamp:
09/07/2023 03:56:18 AM (3 years ago)
Author:
felixmp
Message:

Remove use of iframe to process payment. Update order status to completed.

Location:
metrepay/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • metrepay/trunk/includes/shortcode.php

    r2962760 r2963879  
    66    $mg = new WC_Metrepay_Gateway;
    77
    8     if (isset($_GET['metrepayid'])) {
    9         // ID del link de pago generado
    10         $metrepayid = sanitize_text_field($_GET['metrepayid']);
    11         // Slug predefinido del comercio
    12         $slug = $mg->get_provider_slug();
    13         // Sitio de MetrePay dependiendo del ambiente
    14         $site = ($mg->get_staging() === "yes")
    15             ? "test"
    16             : "portal";
     8    if (isset($_GET['order_id'])) {
     9        $order_id = sanitize_text_field($_GET['order_id']);
     10        $order = new WC_Order($order_id);
     11        $order->update_status('completed', 'order_note');
    1712        ?>
    18         <iframe class='metrepayiframe' src='https://<?php echo esc_attr( $site ); ?>.metrepay.com/pay/<?php echo esc_attr( $slug ); ?>/item/<?php echo esc_attr( $metrepayid ); ?>'></iframe>
    19             <?php
    20         echo '<style>
    21                 .metrepayiframe{
    22                     width: 100%;
    23                     height: 950px;
    24                     border: unset;
    25                 }
    26                 </style>';
     13        <h2>¡Gracias por realizar su compra!</h2>
     14        <?php
    2715    } else {
    2816?>
  • metrepay/trunk/metrepay.php

    r2963323 r2963879  
    44Plugin URI: https://wordpress.org/plugins/metrepay
    55Description: Pasarela de pago para integracion con MetrePay y Woocomerce
    6 Version: 1.1.2
     6Version: 1.2.0
    77Author: Rugertek
    88Author URI: https://rugertek.com/
     
    151151                    'default'     => 'yes'
    152152                ),
    153                 'purchase_page' => array(
    154                     'title'       => 'Página de fin de compra',
    155                     'type'        => 'text'
    156                 ),
    157153            );
    158154        }
     
    168164                $data = array(
    169165                    "label" => "Pago a " . get_bloginfo("name"),
    170                     "amount" => $order->get_total(),
     166                    "amount" => intval($order->get_total()),
    171167                    "handleValue" => $order->get_billing_email(),
    172168                    "handleLabel" => "{$order->get_billing_first_name()} {$order->get_billing_last_name()}",
     
    174170                    "singlePayment" => true,
    175171                    "creditAndDebitCard" => true,
     172                    "redirectUrl" => get_bloginfo("url") . "/pago-metrepay/?order_id=" . $order_id,
    176173                );
    177174            } else {
     
    196193                    "monthForSecondInstallment" => 1,
    197194                    "payWaitHours" => 96,
     195                    "redirectUrl" => get_bloginfo("url") . "/pago-metrepay/?order_id=" . $order_id,
    198196                );
    199197            }
     
    211209            error_log(json_encode($result));
    212210
    213             // Finish shopping process
    214             $woocommerce->cart->empty_cart();
    215211            // Delete the cookie
    216212            $this->mpay_local_delete_cookie('mp_installments_quantity');
     
    218214            return array(
    219215                'result' => 'success',
    220                 'redirect' => get_bloginfo("url") . "/pago-metrepay/?metrepayid={$result['slug']}"
     216                'redirect' => $result['publicPayUrl']
    221217            );
    222218        }
  • metrepay/trunk/readme.txt

    r2963323 r2963879  
    44Requires at least: 5.3
    55Tested up to: 6.3.1
    6 Stable tag: 1.1.2
     6Stable tag: 1.2.0
    77Requires PHP: 7.3.5
    88License: GPLv3
     
    3131= 1.1.2 =
    3232* Improve texts into configuration form fields
     33
     34= 1.2.0 =
     35* Remove use of iframe to process payment
     36* Update correctly the order status to "completed"
Note: See TracChangeset for help on using the changeset viewer.