Skip to content

Using the existing instantiation method for OC #4577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions includes/payment-methods/class-wc-stripe-upe-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -1020,12 +1020,7 @@ private function process_payment_with_payment_method( int $order_id ) {
$response_args = [];

if ( $this->oc_enabled && isset( $payment_method_details->type ) ) {
foreach ( self::UPE_AVAILABLE_METHODS as $payment_method_class ) {
$payment_method = new $payment_method_class();
if ( $payment_method->get_id() === $payment_method_details->type ) {
$upe_payment_method = $payment_method;
}
}
$upe_payment_method = self::get_payment_method_instance( $payment_method_details->type );
}

// Make sure that we attach the payment method and the customer ID to the order meta data.
Expand Down Expand Up @@ -2179,12 +2174,7 @@ public function create_token_from_setup_intent( $setup_intent_id, $user ) {
if ( $this->oc_enabled ) {
$payment_method_type = $payment_method_details['type'] ?? $payment_method_details->type ?? null;
if ( ! empty( $payment_method_type ) ) {
foreach ( self::UPE_AVAILABLE_METHODS as $payment_method_class ) {
$payment_method_instance = new $payment_method_class();
if ( $payment_method_instance->get_id() === $payment_method_type ) {
$payment_method = $payment_method_instance;
}
}
$payment_method = self::get_payment_method_instance( $payment_method_type );
}
} else {
$payment_method = $this->payment_methods[ $payment_method_type ] ?? null;
Expand Down
Loading