| @@ -1,37 +1,44 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | namespace Payplug\PayplugWoocommerce\Controller; |
| 4 | 4 | |
| 5 | +use Payplug\Payplug; | |
| 6 | +use Payplug\Authentication; | |
| 7 | +use Payplug\PayplugWoocommerce\Gateway\PayplugGateway; | |
| 8 | +use Payplug\PayplugWoocommerce\PayplugWoocommerceHelper; | |
| 9 | +use Payplug\Exception\ForbiddenException; | |
| 10 | + | |
| 5 | 11 | class IntegratedPayment |
| 6 | 12 | { |
| 7 | - protected $options; | |
| 13 | + protected $options; | |
| 8 | 14 | |
| 9 | - public function __construct($options) | |
| 10 | - { | |
| 11 | - $this->options = $options; | |
| 12 | - } | |
| 15 | + public function __construct($options) | |
| 16 | + { | |
| 17 | + $this->options = $options; | |
| 18 | + } | |
| 13 | 19 | |
| 14 | - public static function template_form($save_card) | |
| 15 | - { | |
| 16 | - $logo = PAYPLUG_GATEWAY_PLUGIN_URL . '/assets/images/integrated/logo-payplug.png'; | |
| 17 | - $lock = PAYPLUG_GATEWAY_PLUGIN_URL . '/assets/images/integrated/lock.svg'; | |
| 18 | - $privacy_policy_url = __('payplug_integrated_payment_privacy_policy_url', 'payplug'); | |
| 19 | - $f = function ($fn) { | |
| 20 | - return $fn; | |
| 21 | - }; | |
| 20 | + static public function template_form($oneClick){ | |
| 22 | 21 | |
| 23 | - if ($save_card) { | |
| 24 | - $saved = <<<HTML | |
| 22 | + $logo = PAYPLUG_GATEWAY_PLUGIN_URL . '/assets/images/integrated/logo-payplug.png'; | |
| 23 | + $lock = PAYPLUG_GATEWAY_PLUGIN_URL . '/assets/images/integrated/lock.svg'; | |
| 24 | + $privacy_policy_url = __("payplug_integrated_payment_privacy_policy_url", "payplug"); | |
| 25 | + $f = function ($fn) { | |
| 26 | + return $fn; | |
| 27 | + }; | |
| 28 | + | |
| 29 | + if($oneClick) { | |
| 30 | + $saved = <<<HTML | |
| 25 | 31 | <div class="payplug IntegratedPayment_container -saveCard" data-e2e-name="saveCard"> |
| 26 | 32 | <label><input type="checkbox" name="savecard"><span></span>{$f(__('payplug_integrated_payment_oneClick', 'payplug'))}</label> |
| 27 | 33 | </div> |
| 28 | 34 | HTML; |
| 29 | - } else { | |
| 30 | - $saved = ''; | |
| 31 | - } | |
| 35 | + } else { | |
| 36 | + $saved = ""; | |
| 37 | + } | |
| 32 | 38 | |
| 33 | - return <<<HTML | |
| 39 | + | |
| 40 | + return <<<HTML | |
| 34 | 41 | <form class="payplug IntegratedPayment -loaded"> |
| 35 | 42 | <div class="payplug IntegratedPayment_container -cardHolder cardHolder-input-container" data-e2e-name="cardHolder"></div> |
| 36 | 43 | <div class="payplug IntegratedPayment_error -cardHolder -hide"> |
| 37 | 44 | <span class="-hide invalidField" data-e2e-error="invalidField">{$f(__('payplug_integrated_payment_cardHolder_error', 'payplug'))}</span> |
| @@ -39,11 +46,11 @@ | ||
| 39 | 46 | </div> |
| 40 | 47 | <div class="payplug IntegratedPayment_container -scheme"> |
| 41 | 48 | <div>{$f(__('payplug_integrated_payment_your_card', 'payplug'))}</div> |
| 42 | 49 | <div class="payplug IntegratedPayment_schemes"> |
| 43 | - <label class="payplug IntegratedPayment_scheme -cb"><input type="radio" name="schemeOptions" value="cb" /><span></span></label> | |
| 44 | 50 | <label class="payplug IntegratedPayment_scheme -visa"><input type="radio" name="schemeOptions" value="visa"/><span></span></label> |
| 45 | 51 | <label class="payplug IntegratedPayment_scheme -mastercard"><input type="radio" name="schemeOptions" value="mastercard" /><span></span></label> |
| 52 | + <label class="payplug IntegratedPayment_scheme -cb"><input type="radio" name="schemeOptions" value="cb" /><span></span></label> | |
| 46 | 53 | </div> |
| 47 | 54 | </div> |
| 48 | 55 | <div class="payplug IntegratedPayment_container -pan pan-input-container" data-e2e-name="pan"></div> |
| 49 | 56 | <div class="payplug IntegratedPayment_error -pan -hide"> |
| @@ -74,6 +81,7 @@ | ||
| 74 | 81 | <a href="$privacy_policy_url" target="_blank">{$f(__('payplug_integrated_payment_privacy_policy', 'payplug'))}</a> |
| 75 | 82 | </div> |
| 76 | 83 | </form> |
| 77 | 84 | HTML; |
| 78 | - } | |
| 85 | + } | |
| 86 | + | |
| 79 | 87 | } |