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

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