-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PIWOO-414 Add bancomat and fix in3, billie
- Loading branch information
Showing
12 changed files
with
252 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mollie\WooCommerce\PaymentMethods; | ||
|
||
class Bancomatpay extends AbstractPaymentMethod implements PaymentMethodI | ||
{ | ||
public function getConfig(): array | ||
{ | ||
return [ | ||
'id' => 'bancomatpay', | ||
'defaultTitle' => __('Bancomat Pay', 'mollie-payments-for-woocommerce'), | ||
'settingsDescription' => '', | ||
'defaultDescription' => '', | ||
'paymentFields' => true, | ||
'instructions' => false, | ||
'supports' => [ | ||
'products', | ||
'refunds', | ||
], | ||
'filtersOnBuild' => false, | ||
'confirmationDelayed' => false, | ||
'errorMessage' => __( | ||
'Required field is empty. Phone field is required.', | ||
'mollie-payments-for-woocommerce' | ||
), | ||
'phonePlaceholder' => __('Please enter your phone here. +00..', 'mollie-payments-for-woocommerce'), | ||
]; | ||
} | ||
|
||
public function getFormFields($generalFormFields): array | ||
{ | ||
return $generalFormFields; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
src/PaymentMethods/PaymentFieldsStrategies/BancomatpayFieldsStrategy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mollie\WooCommerce\PaymentMethods\PaymentFieldsStrategies; | ||
|
||
class BancomatpayFieldsStrategy implements PaymentFieldsStrategyI | ||
{ | ||
const FIELD_PHONE = "billing_phone_bancomatpay"; | ||
|
||
public function execute($gateway, $dataHelper) | ||
{ | ||
$showPhoneField = false; | ||
|
||
if (is_checkout_pay_page()) { | ||
$order = $this->getOrderIdOnPayForOrderPage(); | ||
$showPhoneField = empty($order->get_billing_phone()); | ||
} | ||
|
||
if (is_checkout() && !is_checkout_pay_page()) { | ||
$showPhoneField = true; | ||
} | ||
|
||
if ($showPhoneField) { | ||
$this->phoneNumber(); | ||
} | ||
} | ||
|
||
protected function getOrderIdOnPayForOrderPage() | ||
{ | ||
global $wp; | ||
$orderId = absint($wp->query_vars['order-pay']); | ||
return wc_get_order($orderId); | ||
} | ||
|
||
protected function phoneNumber() | ||
{ | ||
?> | ||
<p class="form-row form-row-wide" id="billing_phone_field"> | ||
<label for="<?= esc_attr(self::FIELD_PHONE); ?>" class=""><?= esc_html__('Phone', 'mollie-payments-for-woocommerce'); ?> | ||
<abbr class="required" title="required">*</abbr> | ||
</label> | ||
<span class="woocommerce-input-wrapper"> | ||
<input type="tel" class="input-text " name="<?= esc_attr(self::FIELD_PHONE); ?>" id="<?= esc_attr(self::FIELD_PHONE); ?>" | ||
placeholder="+00000000000" | ||
value="" autocomplete="phone"> | ||
</span> | ||
</p> | ||
<?php | ||
} | ||
|
||
public function getFieldMarkup($gateway, $dataHelper) | ||
{ | ||
return ""; | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
src/PaymentMethods/PaymentFieldsStrategies/BillieFieldsStrategy.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Mollie\WooCommerce\PaymentMethods\PaymentFieldsStrategies; | ||
|
||
class BillieFieldsStrategy implements PaymentFieldsStrategyI | ||
{ | ||
const FIELD_COMPANY = "billing_company_billie"; | ||
|
||
public function execute($gateway, $dataHelper) | ||
{ | ||
$showCompanyField = false; | ||
|
||
if (is_checkout_pay_page()) { | ||
$order = $this->getOrderIdOnPayForOrderPage(); | ||
$showCompanyField = empty($order->get_billing_company()); | ||
} | ||
|
||
if (is_checkout() && !is_checkout_pay_page()) { | ||
$showCompanyField = true; | ||
} | ||
|
||
if ($showCompanyField) { | ||
$this->company(); | ||
} | ||
} | ||
|
||
protected function getOrderIdOnPayForOrderPage() | ||
{ | ||
global $wp; | ||
$orderId = absint($wp->query_vars['order-pay']); | ||
return wc_get_order($orderId); | ||
} | ||
|
||
protected function company() | ||
{ | ||
?> | ||
<p class="form-row form-row-wide" id="billing_company_field"> | ||
<label for="<?= esc_attr(self::FIELD_COMPANY); ?>" class=""><?= esc_html__('Company', 'mollie-payments-for-woocommerce'); ?> | ||
<abbr class="required" title="required">*</abbr> | ||
</label> | ||
<span class="woocommerce-input-wrapper"> | ||
<input type="tel" class="input-text " name="<?= esc_attr(self::FIELD_COMPANY); ?>" id="<?= esc_attr(self::FIELD_COMPANY); ?>" | ||
placeholder="Company name" | ||
value="" autocomplete="organization"> | ||
</span> | ||
</p> | ||
<?php | ||
} | ||
|
||
public function getFieldMarkup($gateway, $dataHelper) | ||
{ | ||
return ""; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.