Plugin Directory

Changeset 2744264


Ignore:
Timestamp:
06/17/2022 06:13:39 PM (4 years ago)
Author:
usedrip
Message:

update to v1.1.2

  • not redirect when connection is from our servers
Location:
drip-payments/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • drip-payments/trunk/drip-payments.php

    r2736503 r2744264  
    44 * Description: Forneça a Drip como opção de pagamento para pedidos do WooCommerce.
    55 * Author: Drip
    6  * Version: 1.2.1
     6 * Version: 1.2.2
    77 */
    88
     
    353353            }
    354354
     355            $headers = $this->getRequestHeaders();
     356
     357            $accept_json = str_contains($headers["Accept"], "json");
     358
    355359            if ($checkout->status === 'OK') {
    356360                self::log("Order #{$order_id} approved. (Drip Checkout #{$checkout_id}).");
     
    362366                    $order->save();
    363367                }
     368                if ($accept_json) {
     369                    exit;
     370                }
    364371
    365372                if (wp_redirect($this->get_return_url($order))) {
     
    373380                    $order->update_status('failed');
    374381                }
     382                if ($accept_json) {
     383                    exit;
     384                }
    375385
    376386                wc_add_notice('Sua requisição de pagamento foi rejeitada pela Drip. Por favor tente com outro método de pagamento.', 'error');
     
    381391                self::log("Order #{$order_id} checkout not completed. (Drip Checkout #{$checkout_id}).");
    382392
     393                if ($accept_json) {
     394                    exit;
     395                }
     396
    383397                if (wp_redirect($order->get_checkout_payment_url())) {
    384398                    exit;
     
    395409            }
    396410
    397             $checkout_id_on_order = get_post_meta($order->ID, 'drip_paid_checkout_id', true);
     411            $checkout_id_on_order = get_post_meta($order->get_id(), 'drip_paid_checkout_id', true);
    398412
    399413            if (empty($checkout_id_on_order)) {
     
    533547            return self::$instance;
    534548        }
     549
     550        private function getRequestHeaders()
     551        {
     552            $headers = array();
     553            foreach ($_SERVER as $key => $value) {
     554                if (substr($key, 0, 5) <> 'HTTP_') {
     555                    continue;
     556                }
     557                $header = str_replace(' ', '-', ucwords(str_replace('_', ' ', strtolower(substr($key, 5)))));
     558                $headers[$header] = $value;
     559            }
     560            return $headers;
     561        }
    535562    }
    536563
  • drip-payments/trunk/readme.txt

    r2736503 r2744264  
    55Tested up to: 6.0
    66Requires PHP: 7.0
    7 Stable tag: 1.2.1
     7Stable tag: 1.2.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • drip-payments/trunk/src/DripUtils.php

    r2736503 r2744264  
    1111    const DRIP_PAYMENTS_BASE_URI_PRODUCTION = 'https://drip-be.usedrip.com.br/api/';
    1212
    13     const DRIP_PAYMENTS_ACTUAL_PLUGIN_VERSION = '1.2.1';
     13    const DRIP_PAYMENTS_ACTUAL_PLUGIN_VERSION = '1.2.2';
    1414}
    1515
Note: See TracChangeset for help on using the changeset viewer.