mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
♻️ Refactor PayUponInvoiceGateway
This commit is contained in:
parent
fcb9ae488a
commit
262d3abd26
2 changed files with 4 additions and 13 deletions
|
@ -1489,7 +1489,7 @@ return array(
|
|||
$container->get( 'woocommerce.logger.woocommerce' ),
|
||||
$container->get( 'wcgateway.pay-upon-invoice-helper' ),
|
||||
$container->get( 'wcgateway.checkout-helper' ),
|
||||
$container->get( 'onboarding.state' ),
|
||||
$container->get( 'settings.flag.is-connected' ),
|
||||
$container->get( 'wcgateway.processor.refunds' ),
|
||||
$container->get( 'wcgateway.url' )
|
||||
);
|
||||
|
|
|
@ -17,7 +17,6 @@ use WooCommerce\PayPalCommerce\ApiClient\Endpoint\PayUponInvoiceOrderEndpoint;
|
|||
use WooCommerce\PayPalCommerce\ApiClient\Exception\PayPalApiException;
|
||||
use WooCommerce\PayPalCommerce\ApiClient\Factory\PurchaseUnitFactory;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\Environment;
|
||||
use WooCommerce\PayPalCommerce\Onboarding\State;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Gateway\TransactionUrlProvider;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\CheckoutHelper;
|
||||
use WooCommerce\PayPalCommerce\WcGateway\Helper\PayUponInvoiceHelper;
|
||||
|
@ -89,13 +88,6 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
|
|||
*/
|
||||
protected $checkout_helper;
|
||||
|
||||
/**
|
||||
* The onboarding state.
|
||||
*
|
||||
* @var State
|
||||
*/
|
||||
protected $state;
|
||||
|
||||
/**
|
||||
* The refund processor.
|
||||
*
|
||||
|
@ -121,7 +113,7 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
|
|||
* @param LoggerInterface $logger The logger.
|
||||
* @param PayUponInvoiceHelper $pui_helper The PUI helper.
|
||||
* @param CheckoutHelper $checkout_helper The checkout helper.
|
||||
* @param State $state The onboarding state.
|
||||
* @param bool $is_connected Whether the onboarding was completed.
|
||||
* @param RefundProcessor $refund_processor The refund processor.
|
||||
* @param string $module_url The module URL.
|
||||
*/
|
||||
|
@ -134,7 +126,7 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
|
|||
LoggerInterface $logger,
|
||||
PayUponInvoiceHelper $pui_helper,
|
||||
CheckoutHelper $checkout_helper,
|
||||
State $state,
|
||||
bool $is_connected,
|
||||
RefundProcessor $refund_processor,
|
||||
string $module_url
|
||||
) {
|
||||
|
@ -169,8 +161,7 @@ class PayUponInvoiceGateway extends WC_Payment_Gateway {
|
|||
$this->module_url = $module_url;
|
||||
$this->icon = apply_filters( 'woocommerce_paypal_payments_pay_upon_invoice_gateway_icon', esc_url( $this->module_url ) . 'assets/images/ratepay.svg' );
|
||||
|
||||
$this->state = $state;
|
||||
if ( $state->current_state() === State::STATE_ONBOARDED ) {
|
||||
if ( $is_connected ) {
|
||||
$this->supports = array( 'refunds' );
|
||||
}
|
||||
$this->refund_processor = $refund_processor;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue