PluginProbe
PayPlug for WooCommerce (Official) / 2.9.0
PayPlug for WooCommerce (Official) v2.9.0
3.0.0 2.18.0 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.10.0 1.10.1 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 All 101 releases
← All changes | src/Gateway/PayplugIpnResponse.php +20 -3 1.2.52.9.0 View file →
@@ -8,8 +8,9 @@
8 8 }
9 9
10 10 use Payplug\Exception\UnknownAPIResourceException;
11 11 use Payplug\Notification;
12 +use Payplug\PayplugWoocommerce\Model\Lock;
12 13 use Payplug\PayplugWoocommerce\PayplugWoocommerceHelper;
13 14 use Payplug\Resource\IVerifiableAPIResource;
14 15 use WC_Payment_Token_CC;
15 16
@@ -69,10 +70,26 @@
69 70 *
70 71 * @return void
71 72 * @throws \WC_Data_Exception
72 73 */
73 - public function process_payment_resource( $resource ) {
74 - $this->gateway->response->process_payment( $resource );
74 + public function process_payment_resource( $resource, $save_request = true ) {
75 +
76 + $lock_id = \Payplug\PayplugWoocommerce\Helper\Lock::handle_insert($save_request, $resource->id);
77 + if(!$lock_id){
78 + return;
79 + }
80 +
81 + $this->gateway->response->process_payment( $resource, false, "ipn" );
82 +
83 + Lock::delete_lock($lock_id);
84 + $waiting_requests = Lock::get_lock_by_payment_id($resource->id);
85 +
86 + if($waiting_requests){
87 + Lock::delete_lock_by_payment_id($resource->id);
88 + $this->gateway->validate_payment($resource->metadata['order_id'], false, true);
89 + };
90 +
91 +
75 92 }
76 93
77 94 /**
78 95 * Process refund notification.
@@ -81,5 +98,5 @@
81 98 */
82 99 public function process_refund_resource( $resource ) {
83 100 $this->gateway->response->process_refund( $resource );
84 101 }
85 -}
102 +}