← All changes
|
app/Modules/PaymentMethods/Core/AbstractPaymentGateway.php
+16
-5
1.6.0
→
1.6.5
View file →
| @@ -67,10 +67,18 @@ | ||
| 67 | 67 | if (isset($gatewaySettings['checkout_logo']) && !empty($gatewaySettings['checkout_logo'])) { |
| 68 | 68 | $meta['logo'] = $gatewaySettings['checkout_logo']; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if (isset($gatewaySettings['checkout_instructions']) && !empty($gatewaySettings['checkout_instructions'])) { | |
| 72 | - $meta['instructions'] = $gatewaySettings['checkout_instructions']; | |
| 71 | + if (!empty($gatewaySettings['checkout_instructions'])) { | |
| 72 | + $instructionsText = trim(wp_strip_all_tags(html_entity_decode($gatewaySettings['checkout_instructions'], ENT_QUOTES))); | |
| 73 | + // Nbsp survives strip_tags/html_entity_decode as a literal | |
| 74 | + // non-breaking space, so a rich-text editor can save "<p> </p>" | |
| 75 | + // and still look non-empty to a bare !empty() check. | |
| 76 | + $instructionsText = str_replace("\xC2\xA0", '', $instructionsText); | |
| 77 | + | |
| 78 | + if (trim($instructionsText) !== '') { | |
| 79 | + $meta['instructions'] = $gatewaySettings['checkout_instructions']; | |
| 80 | + } | |
| 73 | 81 | } |
| 74 | 82 | |
| 75 | 83 | if ($key !== '') { |
| 76 | 84 | return Arr::get($meta, $key, ''); |
| @@ -148,12 +156,15 @@ | ||
| 148 | 156 | |
| 149 | 157 | return $settings; |
| 150 | 158 | } |
| 151 | 159 | |
| 160 | + /** | |
| 161 | + * Back-compat wrapper — the canonical entry point is | |
| 162 | + * OrderTransaction::getSuccessUrl(); call that directly. | |
| 163 | + */ | |
| 152 | 164 | public function getSuccessUrl($transaction, $args = []) |
| 153 | 165 | { |
| 154 | - $paymentHelper = new PaymentHelper($this->getMeta('route')); | |
| 155 | - return $paymentHelper->successUrl($transaction->uuid, $args); | |
| 166 | + return $transaction->getSuccessUrl($args); | |
| 156 | 167 | } |
| 157 | 168 | |
| 158 | 169 | public static function getCancelUrl(): string |
| 159 | 170 | { |
| @@ -314,8 +325,9 @@ | ||
| 314 | 325 | if ($oldGateway && $oldGateway->has('subscriptions') && $oldGateway->subscriptions) { |
| 315 | 326 | $cancelResult = $oldGateway->subscriptions->cancel($subscription->vendor_subscription_id, [ |
| 316 | 327 | 'subscription_id' => $subscription->id, |
| 317 | 328 | 'parent_order_id' => $subscription->parent_order_id, |
| 329 | + 'mode' => $subscription->order ? $subscription->order->mode : 'current', | |
| 318 | 330 | ]); |
| 319 | 331 | if (is_wp_error($cancelResult)) { |
| 320 | 332 | fluent_cart_error_log( |
| 321 | 333 | 'Failed to cancel vendor subscription during conversion to manual', |
| @@ -544,9 +556,8 @@ | ||
| 544 | 556 | { |
| 545 | 557 | $this->beforeRenderPaymentMethod($hasSubscription); |
| 546 | 558 | $this->render($mode); |
| 547 | 559 | $route = $this->getMeta('route'); |
| 548 | - do_action_deprecated('fluent-cart/after_render_payment_method_' . $route, [], '1.3.16', 'fluent_cart/after_render_payment_method_' . $route, 'Use fluent_cart/after_render_payment_method_' . $route . ' instead of fluent-cart/after_render_payment_method_' . $route . '. It will be removed in v1.4.3.'); | |
| 549 | 560 | do_action('fluent_cart/after_render_payment_method_' . $route); |
| 550 | 561 | } |
| 551 | 562 | |
| 552 | 563 | public function render($mode = 'logo') |