Skip to content

Commit

Permalink
Add custom order for banks and generic payments
Browse files Browse the repository at this point in the history
  • Loading branch information
krzGablo committed Aug 5, 2024
1 parent 0565e1c commit 2f502b8
Show file tree
Hide file tree
Showing 16 changed files with 6 additions and 643 deletions.
88 changes: 2 additions & 86 deletions controllers/admin/TpayConfigurationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -479,91 +479,7 @@ public function formPaymentOptions(): array
'options' => [
'query' => $this->sortPayment('TPAY_CUSTOM_ORDER'),
'id' => 'id',
'name' => 'name'
],
],

[
'type' => 'switch',
'label' => $this->module->l('GooglePay'),
'name' => 'TPAY_GPAY_ACTIVE',
'desc' => $this->module->l('Show the method as a separate payment'),
'is_bool' => true,
'class' => 't',
'values' => [
[
'id' => 'tpay_active_on',
'value' => 1,
'label' => $this->module->l('Yes'),
],
[
'id' => 'tpay_active_off',
'value' => 0,
'label' => $this->module->l('No'),
],
],
],

[
'type' => 'switch',
'label' => $this->module->l('Alior Installment (from 300 PLN to 13 888,00 PLN)'),
'name' => 'TPAY_INSTALLMENTS_ACTIVE',
'desc' => $this->module->l('Show the method as a separate payment'),
'is_bool' => true,
'class' => 't',
'values' => [
[
'id' => 'tpay_installments_on',
'value' => 1,
'label' => $this->module->l('Yes'),
],
[
'id' => 'tpay_installments_off',
'value' => 0,
'label' => $this->module->l('No'),
],
],
],

[
'type' => 'switch',
'label' => $this->module->l('Pekao Installment (from 100 PLN to 20 000 PLN)'),
'name' => 'TPAY_PEKAO_INSTALLMENTS_ACTIVE',
'desc' => $this->module->l('Show the method as a separate payment'),
'is_bool' => true,
'class' => 't',
'values' => [
[
'id' => 'tpay_pekao_installments_on',
'value' => 1,
'label' => $this->module->l('Yes'),
],
[
'id' => 'tpay_pekao_installments_off',
'value' => 0,
'label' => $this->module->l('No'),
],
],
],

[
'type' => 'switch',
'label' => sprintf($this->module->l('Twisto - Buy now, pay later (from 1 PLN to 1 500 PLN)')),
'name' => 'TPAY_TWISTO_ACTIVE',
'desc' => $this->module->l('Show the method as a separate payment'),
'is_bool' => true,
'class' => 't',
'values' => [
[
'id' => 'tpay_installments_on',
'value' => 1,
'label' => $this->module->l('Yes'),
],
[
'id' => 'tpay_installments_off',
'value' => 0,
'label' => $this->module->l('No'),
],
'name' => 'fullName'
],
],
],
Expand Down Expand Up @@ -742,7 +658,7 @@ private function formGenericPaymentOptions(): array
'options' => [
'query' => $result,
'id' => 'id',
'name' => 'name'
'name' => 'fullName'
],
]
],
Expand Down
32 changes: 0 additions & 32 deletions src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,50 +22,18 @@ class Config
public const TPAY_PAYMENT_CARDS = 'cards';
public const TPAY_PAYMENT_BLIK = 'blik';
public const TPAY_PAYMENT_GPAY = 'gpay';
public const TPAY_PAYMENT_INSTALLMENTS = 'installments';
public const TPAY_PAYMENT_GENERIC = 'generic';

public const TPAY_GATEWAY_ALIOR_RATY = 109;
public const TPAY_GATEWAY_PEKAO_RATY = 169;
public const TPAY_GATEWAY_TWISTO = 167;
public const TPAY_GATEWAY_PAYPO = 172;
public const TPAY_GATEWAY_GOOGLE_PAY = 166;

/// IDS to get bank channels
public const GATEWAY_TWISTO = 71; //71

public const GATEWAY_PAYPO = 83;
public const GATEWAY_ALIOR_RATY = 49; // 49
public const GATEWAY_CARD = 53;
public const GATEWAY_BLIK = 64;
public const GATEWAY_BLIK_0 = 150;
public const GATEWAY_GOOGLE_PAY = 68;

public const GATEWAY_TRANSFER = 999;

public const GATEWAY_APPLE_PAY = 9999;
public const GATEWAYS_PEKAO_RATY_3x0 = 78;
public const GATEWAYS_PEKAO_RATY_10x0 = 80;

public const GATEWAYS_PEKAO_RATY_50 = 81;
public const GATEWAYS_PEKAO_RATY = 77;

public const CARD_GROUP_ID = 103;

public const TPAY_VIEW_REDIRECT = 0;
public const TPAY_SURCHARGE_AMOUNT = 0;
public const TPAY_SURCHARGE_PERCENT = 1;
public const TPAY_PATH = 'module:tpay/views/templates/front';

public const TWISTO_MIN = 1.00;
public const TWISTO_MAX = 1500;
public const ALIOR_RATY_MIN = 300;
public const ALIOR_RATY_MAX = 13888.00;

public const PEKAO_RATY_MIN = 100;
public const PEKAO_RATY_MAX = 20000;

public const PAYPO_MIN = 40;

public const PAYPO_MAX = 3000;
}
1 change: 0 additions & 1 deletion src/Factory/PaymentFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public static function getPaymentMethod(string $type)
{
switch ($type) {
case Config::TPAY_PAYMENT_BASIC:
case Config::TPAY_PAYMENT_INSTALLMENTS:
case Config::TPAY_PAYMENT_GPAY:
case Config::TPAY_PAYMENT_BLIK:
return new BasicPaymentHandler();
Expand Down
20 changes: 0 additions & 20 deletions src/Factory/PaymentOptionsFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,7 @@
use Tpay\Service\PaymentOptions\Blik;
use Tpay\Service\PaymentOptions\Card;
use Tpay\Service\PaymentOptions\GatewayType;
use Tpay\Service\PaymentOptions\Generic;
use Tpay\Service\PaymentOptions\GooglePay;
use Tpay\Service\PaymentOptions\AliorInstallment;
use Tpay\Service\PaymentOptions\PekaoInstallment;
use Tpay\Service\PaymentOptions\Transfer;
use Tpay\Service\PaymentOptions\Twisto;

class PaymentOptionsFactory
{
Expand All @@ -40,27 +35,12 @@ public static function getOptionById(int $id)
case Config::GATEWAY_TRANSFER:
$paymentMethod = new Transfer();
break;
case Config::GATEWAY_ALIOR_RATY:
$paymentMethod = new AliorInstallment();
break;
case Config::GATEWAY_CARD:
$paymentMethod = new Card();
break;
case Config::GATEWAY_TWISTO:
$paymentMethod = new Twisto();
break;
case Config::GATEWAY_BLIK:
$paymentMethod = new Blik();
break;
case Config::GATEWAY_GOOGLE_PAY:
$paymentMethod = new GooglePay();
break;
case Config::GATEWAYS_PEKAO_RATY:
case Config::GATEWAYS_PEKAO_RATY_50:
case Config::GATEWAYS_PEKAO_RATY_10x0:
case Config::GATEWAYS_PEKAO_RATY_3x0:
$paymentMethod = new PekaoInstallment();
break;
default:
$paymentMethod = '';
}
Expand Down
64 changes: 0 additions & 64 deletions src/Service/PaymentOptions/AliorInstallment.php

This file was deleted.

57 changes: 0 additions & 57 deletions src/Service/PaymentOptions/ApplePay.php

This file was deleted.

63 changes: 0 additions & 63 deletions src/Service/PaymentOptions/GooglePay.php

This file was deleted.

Loading

0 comments on commit 2f502b8

Please sign in to comment.