Merge branch 'trunk'

# Conflicts:
#	modules/ppcp-admin-notices/src/AdminNotices.php
#	modules/ppcp-local-alternative-payment-methods/src/LocalAlternativePaymentMethodsModule.php
#	modules/ppcp-paylater-configurator/src/PayLaterConfiguratorModule.php
#	modules/ppcp-wc-gateway/src/WCGatewayModule.php
This commit is contained in:
Philipp Stracker 2024-08-30 15:16:20 +02:00
commit 7509f914ab
No known key found for this signature in database
67 changed files with 3811 additions and 126 deletions

View file

@ -0,0 +1,18 @@
import { registerPaymentMethod } from '@woocommerce/blocks-registry';
import { APM } from './apm-block';
const config = wc.wcSettings.getSetting( 'ppcp-multibanco_data' );
registerPaymentMethod( {
name: config.id,
label: <div dangerouslySetInnerHTML={ { __html: config.title } } />,
content: <APM config={ config } />,
edit: <div></div>,
ariaLabel: config.title,
canMakePayment: () => {
return true;
},
supports: {
features: config.supports,
},
} );

View file

@ -60,6 +60,11 @@ return array(
'countries' => array( 'AT', 'DE', 'DK', 'EE', 'ES', 'FI', 'GB', 'LT', 'LV', 'NL', 'NO', 'SE' ),
'currencies' => array( 'EUR', 'DKK', 'SEK', 'GBP', 'NOK' ),
),
'multibanco' => array(
'id' => MultibancoGateway::ID,
'countries' => array( 'PT' ),
'currencies' => array( 'EUR' ),
),
);
},
'ppcp-local-apms.bancontact.wc-gateway' => static function ( ContainerInterface $container ): BancontactGateway {
@ -118,6 +123,14 @@ return array(
$container->get( 'wcgateway.transaction-url-provider' )
);
},
'ppcp-local-apms.multibanco.wc-gateway' => static function ( ContainerInterface $container ): MultibancoGateway {
return new MultibancoGateway(
$container->get( 'api.endpoint.orders' ),
$container->get( 'api.factory.purchase-unit' ),
$container->get( 'wcgateway.processor.refunds' ),
$container->get( 'wcgateway.transaction-url-provider' )
);
},
'ppcp-local-apms.bancontact.payment-method' => static function( ContainerInterface $container ): BancontactPaymentMethod {
return new BancontactPaymentMethod(
$container->get( 'ppcp-local-apms.url' ),
@ -167,4 +180,11 @@ return array(
$container->get( 'ppcp-local-apms.trustly.wc-gateway' )
);
},
'ppcp-local-apms.multibanco.payment-method' => static function( ContainerInterface $container ): MultibancoPaymentMethod {
return new MultibancoPaymentMethod(
$container->get( 'ppcp-local-apms.url' ),
$container->get( 'ppcp.asset-version' ),
$container->get( 'ppcp-local-apms.multibanco.wc-gateway' )
);
},
);

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -72,7 +73,7 @@ class BancontactGateway extends WC_Payment_Gateway {
'products',
);
$this->method_title = __( 'Bancontact', 'woocommerce-paypal-payments' );
$this->method_title = __( 'Bancontact (via PayPal)', 'woocommerce-paypal-payments' );
$this->method_description = __( 'A popular and trusted electronic payment method in Belgium, used by Belgian customers with Bancontact cards issued by local banks. Transactions are processed in EUR.', 'woocommerce-paypal-payments' );
$this->title = $this->get_option( 'title', __( 'Bancontact', 'woocommerce-paypal-payments' ) );
@ -177,6 +178,9 @@ class BancontactGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -91,7 +91,7 @@ class BancontactPaymentMethod extends AbstractPaymentMethodType {
'id' => $this->name,
'title' => $this->gateway->title,
'description' => $this->gateway->description,
'icon' => esc_url( 'https://www.paypalobjects.com/images/checkout/alternative_payments/paypal_bancontact_color.svg' ),
'icon' => 'bancontact',
);
}
}

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -72,7 +73,7 @@ class BlikGateway extends WC_Payment_Gateway {
'products',
);
$this->method_title = __( 'Blik', 'woocommerce-paypal-payments' );
$this->method_title = __( 'Blik (via PayPal)', 'woocommerce-paypal-payments' );
$this->method_description = __( 'A widely used mobile payment method in Poland, allowing Polish customers to pay directly via their banking apps. Transactions are processed in PLN.', 'woocommerce-paypal-payments' );
$this->title = $this->get_option( 'title', __( 'Blik', 'woocommerce-paypal-payments' ) );
@ -178,6 +179,9 @@ class BlikGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -91,7 +91,7 @@ class BlikPaymentMethod extends AbstractPaymentMethodType {
'id' => $this->name,
'title' => $this->gateway->title,
'description' => $this->gateway->description,
'icon' => esc_url( 'https://www.paypalobjects.com/images/checkout/alternative_payments/paypal_blik_color.svg' ),
'icon' => 'blik',
);
}
}

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -72,7 +73,7 @@ class EPSGateway extends WC_Payment_Gateway {
'products',
);
$this->method_title = __( 'EPS', 'woocommerce-paypal-payments' );
$this->method_title = __( 'EPS (via PayPal)', 'woocommerce-paypal-payments' );
$this->method_description = __( 'An online payment method in Austria, enabling Austrian buyers to make secure payments directly through their bank accounts. Transactions are processed in EUR.', 'woocommerce-paypal-payments' );
$this->title = $this->get_option( 'title', __( 'EPS', 'woocommerce-paypal-payments' ) );
@ -177,6 +178,9 @@ class EPSGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -91,7 +91,7 @@ class EPSPaymentMethod extends AbstractPaymentMethodType {
'id' => $this->name,
'title' => $this->gateway->title,
'description' => $this->gateway->description,
'icon' => esc_url( 'https://www.paypalobjects.com/images/checkout/alternative_payments/paypal_eps_color.svg' ),
'icon' => 'eps',
);
}
}

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -72,7 +73,7 @@ class IDealGateway extends WC_Payment_Gateway {
'products',
);
$this->method_title = __( 'iDeal', 'woocommerce-paypal-payments' );
$this->method_title = __( 'iDeal (via PayPal)', 'woocommerce-paypal-payments' );
$this->method_description = __( 'The most common payment method in the Netherlands, allowing Dutch buyers to pay directly through their preferred bank. Transactions are processed in EUR.', 'woocommerce-paypal-payments' );
$this->title = $this->get_option( 'title', __( 'iDeal', 'woocommerce-paypal-payments' ) );
@ -134,16 +135,13 @@ class IDealGateway extends WC_Payment_Gateway {
$purchase_unit = $this->purchase_unit_factory->from_wc_order( $wc_order );
$amount = $purchase_unit->amount()->to_array();
$payment_source = array(
'country_code' => $wc_order->get_billing_country(),
'name' => $wc_order->get_billing_first_name() . ' ' . $wc_order->get_billing_last_name(),
);
// TODO get "bic" from gateway settings.
$request_body = array(
'intent' => 'CAPTURE',
'payment_source' => array(
'ideal' => $payment_source,
'ideal' => array(
'country_code' => $wc_order->get_billing_country(),
'name' => $wc_order->get_billing_first_name() . ' ' . $wc_order->get_billing_last_name(),
),
),
'processing_instruction' => 'ORDER_COMPLETE_ON_PAYMENT_APPROVAL',
'purchase_units' => array(
@ -179,6 +177,9 @@ class IDealGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -91,7 +91,7 @@ class IDealPaymentMethod extends AbstractPaymentMethodType {
'id' => $this->name,
'title' => $this->gateway->title,
'description' => $this->gateway->description,
'icon' => esc_url( 'https://www.paypalobjects.com/images/checkout/alternative_payments/paypal_ideal_color.svg' ),
'icon' => 'ideal',
);
}
}

View file

@ -16,6 +16,8 @@ use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ExtendingModule;
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ModuleClassNameIdTrait;
use WooCommerce\PayPalCommerce\Vendor\Inpsyde\Modularity\Module\ServiceModule;
use WooCommerce\PayPalCommerce\Vendor\Psr\Container\ContainerInterface;
use WooCommerce\PayPalCommerce\WcGateway\Helper\FeesUpdater;
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
/**
* Class LocalAlternativePaymentMethodsModule
@ -37,11 +39,17 @@ class LocalAlternativePaymentMethodsModule implements ServiceModule, ExtendingMo
return require __DIR__ . '/../extensions.php';
}
/**
* {@inheritDoc}
*/
public function run( ContainerInterface $c ) : bool {
public function run( ContainerInterface $c ): bool {
$settings = $c->get( 'wcgateway.settings' );
assert( $settings instanceof Settings );
if ( ! $settings->has( 'allow_local_apm_gateways' ) || $settings->get( 'allow_local_apm_gateways' ) !== true ) {
return true;
}
add_filter(
'woocommerce_payment_gateways',
/**
@ -158,6 +166,37 @@ class LocalAlternativePaymentMethodsModule implements ServiceModule, ExtendingMo
}
);
add_action(
'woocommerce_paypal_payments_payment_capture_completed_webhook_handler',
function( WC_Order $wc_order, string $order_id ) use ( $c ) {
$payment_methods = $c->get( 'ppcp-local-apms.payment-methods' );
if (
! $this->is_local_apm( $wc_order->get_payment_method(), $payment_methods )
) {
return;
}
$fees_updater = $c->get( 'wcgateway.helper.fees-updater' );
assert( $fees_updater instanceof FeesUpdater );
$fees_updater->update( $order_id, $wc_order );
},
10,
2
);
add_filter(
'woocommerce_paypal_payments_allowed_refund_payment_methods',
function( array $payment_methods ) use ( $c ): array {
$local_payment_methods = $c->get( 'ppcp-local-apms.payment-methods' );
foreach ( $local_payment_methods as $payment_method ) {
$payment_methods[] = $payment_method['id'];
}
return $payment_methods;
}
);
return true;
}

View file

@ -0,0 +1,236 @@
<?php
/**
* The Multibanco payment gateway.
*
* @package WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods
*/
declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods;
use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
/**
* Class MultibancoGateway
*/
class MultibancoGateway extends WC_Payment_Gateway {
const ID = 'ppcp-multibanco';
/**
* PayPal Orders endpoint.
*
* @var Orders
*/
private $orders_endpoint;
/**
* Purchase unit factory.
*
* @var PurchaseUnitFactory
*/
private $purchase_unit_factory;
/**
* The Refund Processor.
*
* @var RefundProcessor
*/
private $refund_processor;
/**
* Service able to provide transaction url for an order.
*
* @var TransactionUrlProvider
*/
protected $transaction_url_provider;
/**
* MultibancoGateway constructor.
*
* @param Orders $orders_endpoint PayPal Orders endpoint.
* @param PurchaseUnitFactory $purchase_unit_factory Purchase unit factory.
* @param RefundProcessor $refund_processor The Refund Processor.
* @param TransactionUrlProvider $transaction_url_provider Service providing transaction view URL based on order.
*/
public function __construct(
Orders $orders_endpoint,
PurchaseUnitFactory $purchase_unit_factory,
RefundProcessor $refund_processor,
TransactionUrlProvider $transaction_url_provider
) {
$this->id = self::ID;
$this->supports = array(
'refunds',
'products',
);
$this->method_title = __( 'Multibanco (via PayPal)', 'woocommerce-paypal-payments' );
$this->method_description = __( 'An online payment method in Portugal, enabling Portuguese buyers to make secure payments directly through their bank accounts. Transactions are processed in EUR.', 'woocommerce-paypal-payments' );
$this->title = $this->get_option( 'title', __( 'Multibanco', 'woocommerce-paypal-payments' ) );
$this->description = $this->get_option( 'description', '' );
$this->icon = esc_url( 'https://www.paypalobjects.com/images/checkout/alternative_payments/paypal_multibanco_color.svg' );
$this->init_form_fields();
$this->init_settings();
add_action( 'woocommerce_update_options_payment_gateways_' . $this->id, array( $this, 'process_admin_options' ) );
$this->orders_endpoint = $orders_endpoint;
$this->purchase_unit_factory = $purchase_unit_factory;
$this->refund_processor = $refund_processor;
$this->transaction_url_provider = $transaction_url_provider;
}
/**
* Initialize the form fields.
*/
public function init_form_fields() {
$this->form_fields = array(
'enabled' => array(
'title' => __( 'Enable/Disable', 'woocommerce-paypal-payments' ),
'type' => 'checkbox',
'label' => __( 'Multibanco', 'woocommerce-paypal-payments' ),
'default' => 'no',
'desc_tip' => true,
'description' => __( 'Enable/Disable Multibanco payment gateway.', 'woocommerce-paypal-payments' ),
),
'title' => array(
'title' => __( 'Title', 'woocommerce-paypal-payments' ),
'type' => 'text',
'default' => $this->title,
'desc_tip' => true,
'description' => __( 'This controls the title which the user sees during checkout.', 'woocommerce-paypal-payments' ),
),
'description' => array(
'title' => __( 'Description', 'woocommerce-paypal-payments' ),
'type' => 'text',
'default' => $this->description,
'desc_tip' => true,
'description' => __( 'This controls the description which the user sees during checkout.', 'woocommerce-paypal-payments' ),
),
);
}
/**
* Processes the order.
*
* @param int $order_id The WC order ID.
* @return array
*/
public function process_payment( $order_id ) {
$wc_order = wc_get_order( $order_id );
$wc_order->update_status( 'pending', __( 'Awaiting for the buyer to complete the payment.', 'woocommerce-paypal-payments' ) );
$purchase_unit = $this->purchase_unit_factory->from_wc_order( $wc_order );
$amount = $purchase_unit->amount()->to_array();
$request_body = array(
'intent' => 'CAPTURE',
'purchase_units' => array(
array(
'reference_id' => $purchase_unit->reference_id(),
'amount' => array(
'currency_code' => $amount['currency_code'],
'value' => $amount['value'],
),
'custom_id' => $purchase_unit->custom_id(),
'invoice_id' => $purchase_unit->invoice_id(),
),
),
);
try {
$response = $this->orders_endpoint->create( $request_body );
$body = json_decode( $response['body'] );
$request_body = array(
'payment_source' => array(
'multibanco' => array(
'country_code' => $wc_order->get_billing_country(),
'name' => $wc_order->get_billing_first_name() . ' ' . $wc_order->get_billing_last_name(),
),
),
'processing_instruction' => 'ORDER_COMPLETE_ON_PAYMENT_APPROVAL',
'application_context' => array(
'locale' => 'en-PT',
'return_url' => $this->get_return_url( $wc_order ),
'cancel_url' => add_query_arg( 'cancelled', 'true', $this->get_return_url( $wc_order ) ),
),
);
$response = $this->orders_endpoint->confirm_payment_source( $request_body, $body->id );
$body = json_decode( $response['body'] );
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {
$payer_action = $link->href;
}
}
WC()->cart->empty_cart();
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
return array(
'result' => 'success',
'redirect' => esc_url( $payer_action ),
);
} catch ( RuntimeException $exception ) {
$wc_order->update_status(
'failed',
$exception->getMessage()
);
return array(
'result' => 'failure',
'redirect' => wc_get_checkout_url(),
);
}
}
/**
* Process refund.
*
* If the gateway declares 'refunds' support, this will allow it to refund.
* a passed in amount.
*
* @param int $order_id Order ID.
* @param float $amount Refund amount.
* @param string $reason Refund reason.
* @return boolean True or false based on success, or a WP_Error object.
*/
public function process_refund( $order_id, $amount = null, $reason = '' ) {
$order = wc_get_order( $order_id );
if ( ! is_a( $order, \WC_Order::class ) ) {
return false;
}
return $this->refund_processor->process( $order, (float) $amount, (string) $reason );
}
/**
* Return transaction url for this gateway and given order.
*
* @param \WC_Order $order WC order to get transaction url by.
*
* @return string
*/
public function get_transaction_url( $order ): string {
$this->view_transaction_url = $this->transaction_url_provider->get_transaction_url_base( $order );
return parent::get_transaction_url( $order );
}
}

View file

@ -0,0 +1,97 @@
<?php
/**
* Multibanco payment method.
*
* @package WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods
*/
declare(strict_types=1);
namespace WooCommerce\PayPalCommerce\LocalAlternativePaymentMethods;
use Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType;
/**
* Class MultibancoPaymentMethod
*/
class MultibancoPaymentMethod extends AbstractPaymentMethodType {
/**
* The URL of this module.
*
* @var string
*/
private $module_url;
/**
* The assets version.
*
* @var string
*/
private $version;
/**
* Multibanco WC gateway.
*
* @var MultibancoGateway
*/
private $gateway;
/**
* MultibancoPaymentMethod constructor.
*
* @param string $module_url The URL of this module.
* @param string $version The assets version.
* @param MultibancoGateway $gateway Multibanco WC gateway.
*/
public function __construct(
string $module_url,
string $version,
MultibancoGateway $gateway
) {
$this->module_url = $module_url;
$this->version = $version;
$this->gateway = $gateway;
$this->name = MultibancoGateway::ID;
}
/**
* {@inheritDoc}
*/
public function initialize() {}
/**
* {@inheritDoc}
*/
public function is_active() {
return true;
}
/**
* {@inheritDoc}
*/
public function get_payment_method_script_handles() {
wp_register_script(
'ppcp-multibanco-payment-method',
trailingslashit( $this->module_url ) . 'assets/js/multibanco-payment-method.js',
array(),
$this->version,
true
);
return array( 'ppcp-multibanco-payment-method' );
}
/**
* {@inheritDoc}
*/
public function get_payment_method_data() {
return array(
'id' => $this->name,
'title' => $this->gateway->title,
'description' => $this->gateway->description,
'icon' => 'multibanco',
);
}
}

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -72,7 +73,7 @@ class MyBankGateway extends WC_Payment_Gateway {
'products',
);
$this->method_title = __( 'MyBank', 'woocommerce-paypal-payments' );
$this->method_title = __( 'MyBank (via PayPal)', 'woocommerce-paypal-payments' );
$this->method_description = __( 'A European online banking payment solution primarily used in Italy, enabling customers to make secure bank transfers during checkout. Transactions are processed in EUR.', 'woocommerce-paypal-payments' );
$this->title = $this->get_option( 'title', __( 'MyBank', 'woocommerce-paypal-payments' ) );
@ -177,6 +178,9 @@ class MyBankGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -91,7 +91,7 @@ class MyBankPaymentMethod extends AbstractPaymentMethodType {
'id' => $this->name,
'title' => $this->gateway->title,
'description' => $this->gateway->description,
'icon' => esc_url( 'https://www.paypalobjects.com/images/checkout/alternative_payments/paypal_mybank_color.svg' ),
'icon' => 'mybank',
);
}
}

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -72,7 +73,7 @@ class P24Gateway extends WC_Payment_Gateway {
'products',
);
$this->method_title = __( 'Przelewy24', 'woocommerce-paypal-payments' );
$this->method_title = __( 'Przelewy24 (via PayPal)', 'woocommerce-paypal-payments' );
$this->method_description = __( 'A popular online payment gateway in Poland, offering various payment options for Polish customers. Transactions can be processed in PLN or EUR.', 'woocommerce-paypal-payments' );
$this->title = $this->get_option( 'title', __( 'Przelewy24', 'woocommerce-paypal-payments' ) );
@ -178,6 +179,9 @@ class P24Gateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -91,7 +91,7 @@ class P24PaymentMethod extends AbstractPaymentMethodType {
'id' => $this->name,
'title' => $this->gateway->title,
'description' => $this->gateway->description,
'icon' => esc_url( 'https://www.paypalobjects.com/images/checkout/alternative_payments/paypal_przelewy24_color.svg' ),
'icon' => 'p24',
);
}
}

View file

@ -13,6 +13,7 @@ use WC_Payment_Gateway;
use WooCommerce\PayPalCommerce\ApiClient\Endpoint\Orders;
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
use WooCommerce\PayPalCommerce\Button\Exception\RuntimeException;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway;
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor;
@ -72,7 +73,7 @@ class TrustlyGateway extends WC_Payment_Gateway {
'products',
);
$this->method_title = __( 'Trustly', 'woocommerce-paypal-payments' );
$this->method_title = __( 'Trustly (via PayPal)', 'woocommerce-paypal-payments' );
$this->method_description = __( 'A European payment method that allows buyers to make payments directly from their bank accounts, suitable for customers across multiple European countries. Supported currencies include EUR, DKK, SEK, GBP, and NOK.', 'woocommerce-paypal-payments' );
$this->title = $this->get_option( 'title', __( 'Trustly', 'woocommerce-paypal-payments' ) );
@ -177,6 +178,9 @@ class TrustlyGateway extends WC_Payment_Gateway {
$body = json_decode( $response['body'] );
$wc_order->update_meta_data( PayPalGateway::ORDER_ID_META_KEY, $body->id );
$wc_order->save_meta_data();
$payer_action = '';
foreach ( $body->links as $link ) {
if ( $link->rel === 'payer-action' ) {

View file

@ -91,7 +91,7 @@ class TrustlyPaymentMethod extends AbstractPaymentMethodType {
'id' => $this->name,
'title' => $this->gateway->title,
'description' => $this->gateway->description,
'icon' => esc_url( 'https://www.paypalobjects.com/images/checkout/alternative_payments/paypal_trustly_color.svg' ),
'icon' => 'trustly',
);
}
}

View file

@ -30,6 +30,9 @@ module.exports = {
'trustly-payment-method': path.resolve(
'./resources/js/trustly-payment-method.js'
),
'multibanco-payment-method': path.resolve(
'./resources/js/multibanco-payment-method.js'
),
},
output: {
path: path.resolve( __dirname, 'assets/' ),