PluginProbe
PayPlug for WooCommerce (Official) / 1.5.0
PayPlug for WooCommerce (Official) v1.5.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
payplug / src / Front / PayplugOneyWithFees.php

PayplugOneyWithFees.php in PayPlug for WooCommerce (Official) 1.5.0, at src/Front/PayplugOneyWithFees.php

85 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Payplug\PayplugWoocommerce\Front;
4
5 class PayplugOneyWithFees extends PayplugPayWithOney
6 {
7
8 public function __construct()
9 {
10 parent::__construct();
11
12 $this->setIcon('oney-3x4x');
13 $this->setSimulatedClass('Payplug\\PayplugWoocommerce\\Gateway\\PayplugGatewayOney3x');
14 $this->setOneyType("with_fees");
15
16 add_action( 'wp_ajax_simulate_oney_payment', [ $this, 'simulate_oney_payment' ]);
17 add_action( 'wp_ajax_nopriv_simulate_oney_payment', [ $this, 'simulate_oney_payment' ]);
18 add_action( 'template_redirect', [ $this, 'check_oney_frontend' ] );
19 }
20
21 /**
22 * Simulate Oney Payment
23 *
24 * @return void
25 */
26 public function simulate_oney_payment() {
27 $simulation = $this->handleOneySimulation();
28 wp_send_json_success(
29 array(
30 'popup' => $this->get_simulate_oney_payment_popup($simulation)
31 )
32 );
33
34 wp_die();
35 }
36
37 /**
38 * Show oney simulation details
39 *
40 * @param $oney_response
41 * @return string
42 */
43 public function get_simulate_oney_payment_popup($oney_response) {
44 $cgv = $this->popupfooter();
45
46 if($oney_response) {
47 $popup_content = is_array($oney_response) ? PayplugOney::simulationPopupContent($this, $oney_response['x3_with_fees'], $oney_response['x4_with_fees']) : $oney_response;
48
49 $popup = <<<HTML
50 $popup_content
51 $cgv
52 HTML;
53
54 return $popup;
55 }
56 return "<div class='oney-content oney-cgv-content'></div>";
57 }
58
59 /**
60 * @return string
61 */
62 private function popupfooter()
63 {
64 $f = function($fn) { return $fn; };
65
66 $footer = <<<HTML
67 <div class='oney-cgv-content oney-cgv-footer'>
68 {$f( sprintf(
69 esc_html__("Offre de financement avec apport obligatoire, réservée aux particuliers et valable pour tout achat de %s€ à %s€. Sous réserve d'acceptation par Oney Bank. Vous disposez d'un délai de 14 jours pour renoncer à votre crédit. Oney Bank - SA au capital de 51 286 585€ - 34 Avenue de Flandre 59170 Croix - 546 380 197 RCS Lille Métropole - n° Orias 07 023 261 %s Correspondance : CS 60 006 - 59895 Lille Cedex - %s"),
70 $this->get_min_amount(),
71 $this->get_max_amount(),
72 __("<a href='https://www.orias.fr' target='_empty' > www.orias.fr </a>"),
73 __("<a href=\"https://www.oney.fr\" target=\"_empty\" > www.oney.fr </a>")
74 ))}
75 </div>
76 HTML;
77
78 return $footer;
79
80 }
81
82
83
84 }
85