PluginProbe
PayPlug for WooCommerce (Official) / 2.18.0
PayPlug for WooCommerce (Official) v2.18.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) 2.18.0, at src/Front/Layout/OneyFR.php

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