PluginProbe
PayPlug for WooCommerce (Official) / 3.0.0
PayPlug for WooCommerce (Official) v3.0.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 / Layout / OneyFR.php

OneyFR.php in PayPlug for WooCommerce (Official) 3.0.0, at src/Front/Layout/OneyFR.php

216 lines 9.4 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\Layout;
4
5 use function is_cart;
6
7 use Payplug\PayplugWoocommerce\Front\PayplugOney\Requests\OneyWithFees;
8 use Payplug\PayplugWoocommerce\Front\PayplugOney\Requests\OneyWithoutFees;
9 use Payplug\PayplugWoocommerce\Gateway\PayplugGatewayOney3x;
10
11 class OneyFR extends OneyBase implements InterfaceOneyLayout
12 {
13 public function __construct()
14 {
15 parent::__construct();
16 }
17
18 /**
19 * @param OneyWithoutFees $oney
20 *
21 * @return string
22 */
23 public static function simulationPopupContentWithoutFees($oney)
24 {
25 $simulationResponse = $oney->getSimulation();
26
27 $x4 = $simulationResponse['x4_without_fees'];
28 $x3 = $simulationResponse['x3_without_fees'];
29
30 $financing_cost_3x = intval($x3['total_cost']) / 100;
31 $financing_cost_4x = intval($x4['total_cost']) / 100;
32
33 $f = fn ($fn) => $fn;
34
35 return <<<HTML
36 <div id='oney-popup-close'>
37 <div class='oney-popup-close-mdiv'>
38 <div class='oney-popup-close-md'></div>
39 </div>
40 </div>
41 <div class='oney-img oney-logo no-margin'></div>
42 <div class='oney-title'>
43 <p class='no-margin oney-color'>{$f(__('PAYMENT', 'payplug'))} <span class='underline'>{$f(__('WITHOUT FEES', 'payplug'))}</span> </p>
44 <p class='no-margin bold oney-color'>{$f(__('BY CREDIT CARD', 'payplug'))}</p>
45 </div>
46 <div class='oney-content oney-3x-content'>
47 <div class='oney-img oney-3x no-margin'></div>
48 <div class='oney-details'>
49 <p class='bold no-margin'> {$f(__('Bring', 'payplug'))}: {$x3['down_payment_amount']}</p>
50 <p class='bold no-margin'>+2 {$f(__('monthly payment of', 'payplug'))}: {$x3['installments'][0]['amount']}</p>
51 <p class='no-margin'> {$f(__('Of which financing cost', 'payplug'))}: {$financing_cost_3x}</p>
52 <p class='no-margin'> {$f(__('TAEG', 'payplug'))}: {$x3['effective_annual_percentage_rate']} % </p>
53 </div>
54 </div>
55 <div class='oney-separator'></div>
56 <div class='oney-content oney-4x-content'>
57 <div class='oney-img oney-4x no-margin'></div>
58 <div class='oney-details'>
59 <p class='bold no-margin'> {$f(__('Bring', 'payplug'))}: {$x4['down_payment_amount']}</p>
60 <p class='bold no-margin'>+3 {$f(__('monthly payment of', 'payplug'))}: {$x4['installments'][0]['amount']}</p>
61 <p class='no-margin'> {$f(__('Of which financing cost', 'payplug'))}: {$financing_cost_4x}</p>
62 <p class='no-margin'> {$f(__('TAEG', 'payplug'))}: {$x4['effective_annual_percentage_rate']} % </p>
63 </div>
64 </div>
65 HTML;
66 }
67
68 /**
69 * @param OneyWithFees $oney
70 *
71 * @return string
72 */
73 public static function simulationPopupContent($oney)
74 {
75 $simulationResponse = $oney->getSimulation();
76
77 $x4 = $simulationResponse['x4_with_fees'];
78 $x3 = $simulationResponse['x3_with_fees'];
79
80 $financing_cost_3x = intval($x3['total_cost']) / 100;
81 $financing_cost_4x = intval($x4['total_cost']) / 100;
82
83 $f = fn ($fn) => $fn;
84
85 return <<<HTML
86 <div id='oney-popup-close'>
87 <div class='oney-popup-close-mdiv'>
88 <div class='oney-popup-close-md'></div>
89 </div>
90 </div>
91 <div class='oney-img oney-logo no-margin'></div>
92 <div class='oney-title'>
93 <p class='no-margin oney-color'>{$f(__('PAYMENT', 'payplug'))} </p>
94 <p class='no-margin bold oney-color'>{$f(__('BY CREDIT CARD', 'payplug'))}</p>
95 </div>
96 <div class='oney-content oney-3x-content'>
97 <div class='oney-img oney-3x no-margin'></div>
98 <div class='oney-details'>
99 <p class='bold no-margin'> {$f(__('Bring', 'payplug'))}: {$x3['down_payment_amount']}</p>
100 <p class='bold no-margin'>+2 {$f(__('monthly payment of', 'payplug'))}: {$x3['installments'][0]['amount']}</p>
101 <p class='no-margin'> {$f(__('Of which financing cost', 'payplug'))}: {$financing_cost_3x}</p>
102 <p class='no-margin'> {$f(__('TAEG', 'payplug'))}: {$x3['effective_annual_percentage_rate']} % </p>
103 </div>
104 </div>
105 <div class='oney-separator'></div>
106 <div class='oney-content oney-4x-content'>
107 <div class='oney-img oney-4x no-margin'></div>
108 <div class='oney-details'>
109 <p class='bold no-margin'> {$f(__('Bring', 'payplug'))}: {$x4['down_payment_amount']}</p>
110 <p class='bold no-margin'>+3 {$f(__('monthly payment of', 'payplug'))}: {$x4['installments'][0]['amount']}</p>
111 <p class='no-margin'> {$f(__('Of which financing cost', 'payplug'))}: {$financing_cost_4x}</p>
112 <p class='no-margin'> {$f(__('TAEG', 'payplug'))}: {$x4['effective_annual_percentage_rate']} % </p>
113 </div>
114 </div>
115 HTML;
116 }
117
118 /**
119 * @param $min
120 * @param $max
121 *
122 * @return string
123 */
124 public static function footerOneyWithoutFees($min, $max)
125 {
126 $f = fn ($fn) => $fn;
127
128 $footer = <<<HTML
129 <div class='oney-cgv-content oney-cgv-footer'>
130 {$f(sprintf(
131 esc_html__('Offre de financement sans assurance 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 51286585€ - 34 Avenue de Flandre 59 170 Croix - 546 380 197 RCS Lille Métropole - n° Orias 07023 261 %s . Correspondance : CS 60 006 - 59895 Lille Cedex - %s', 'payplug'),
132 $min,
133 $max,
134 __("<a href='https://www.orias.fr' target='_empty' > www.orias.fr </a>"),
135 __('<a href="https://www.oney.fr" target="_empty" > www.oney.fr </a>')
136 ))}
137 </div>
138 HTML;
139
140 return $footer;
141 }
142
143 /**
144 * @param $min
145 * @param $max
146 *
147 * @return string
148 */
149 public static function footerOneyWithFees($min, $max)
150 {
151 $f = fn ($fn) => $fn;
152
153 return <<<HTML
154 <div class='oney-cgv-content oney-cgv-footer'>
155 {$f(sprintf(
156 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"),
157 $min,
158 $max,
159 __("<a href='https://www.orias.fr' target='_empty' > www.orias.fr </a>"),
160 __('<a href="https://www.oney.fr" target="_empty" > www.oney.fr </a>')
161 ))}
162 </div>
163 HTML;
164 }
165
166 /**
167 * disabled oney popup
168 *
169 * @param \Payplug\PayplugWoocommerce\Front\PayplugOney\Country\Oney $oney
170 *
171 * @return string
172 */
173 public static function disabledOneyPopup($oney)
174 {
175 return '<div class="payplug-oney ' . $oney->isDisable() . '" id="oney-popup">
176 <div class="payplug-lds-roller"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div>
177 <div id="oney-popup-error">
178 <div class="oney-error range"> ' . sprintf(__('The total amount of your order should be between %s€ and %s€ to pay with Oney.', 'payplug'), $oney->get_min_amount(), $oney->get_max_amount()) . '</div>
179 <div class="oney-error qty">' . sprintf(__('The payment with Oney is unavailable because you have more than %s items in your cart.', 'payplug'), PayplugGatewayOney3x::ONEY_PRODUCT_QUANTITY_MAXIMUM) . '</div>
180 </div>
181 </div>';
182 }
183
184 /**
185 * header for cart oney
186 *
187 * @return string
188 */
189 public static function payWithOney($oney)
190 {
191 $variations = $oney->getVariations();
192
193 $html = '
194 <div class="payplug-oney ' . $oney->isDisable() . '"
195 data-is-cart="' . (is_cart() ? 1 : 0) . '"
196 data-total-products="' . $oney->getTotalProducts() . '"
197 data-price="' . $oney->getTotalPrice() . '"
198 data-max-oney-qty="' . PayplugGatewayOney3x::ONEY_PRODUCT_QUANTITY_MAXIMUM . '"
199 data-min-oney="' . $oney->get_min_amount() . '"
200 data-max-oney="' . $oney->get_max_amount() . '" >';
201 $html .= __('OR PAY IN', 'payplug');
202 if (!empty($variations)) {
203 foreach ($variations as $id => $price) {
204 $html .= '<input type="hidden" name="variation_' . $id . '" value = "' . $price . '" />';
205 }
206 }
207 $html .= '<div class="payplug-oney-popup">
208 <div class="oney-img ' . $oney->getIcon() . '"></div>
209 <div id="oney-show-popup" class="bold oney-color">?</div>
210 </div>
211 </div>';
212
213 return $html;
214 }
215 }
216