Skip to content

Commit

Permalink
Fix Apple Pay and Google Pay if card payments are disabled (#7250)
Browse files Browse the repository at this point in the history
Co-authored-by: Dan Paun <[email protected]>
  • Loading branch information
dpaun1985 and Dan Paun authored Sep 28, 2023
1 parent 32e8bd0 commit 995374d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-5945-add-default-cc-enabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Fix Apple Pay and Google Pay if card payments are disabled.
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,6 @@ public function set_off_session( bool $off_session = true ) {
* @throws Invalid_Request_Parameter_Exception When there are no payment methods provided.
*/
public function set_payment_methods( array $payment_methods ) {
// Hard to validate without hardcoding a list here.
if ( empty( $payment_methods ) ) {
throw new Invalid_Request_Parameter_Exception(
__( 'Intentions require at least one payment method', 'woocommerce-payments' ),
'wcpay_core_invalid_request_parameter_missing_payment_method_types'
);
}

$this->set_param( 'payment_method_types', $payment_methods );
}

Expand Down
1 change: 1 addition & 0 deletions includes/payment-methods/class-upe-payment-gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -989,6 +989,7 @@ public function get_payment_method_ids_enabled_at_checkout( $order_id = null, $f

$enabled_payment_methods = [];
$active_payment_methods = $this->get_upe_enabled_payment_method_statuses();

foreach ( $upe_enabled_payment_methods as $payment_method_id ) {
$payment_method_capability_key = $this->payment_method_capability_key_map[ $payment_method_id ] ?? 'undefined_capability_key';
if ( isset( $this->payment_methods[ $payment_method_id ] ) ) {
Expand Down

0 comments on commit 995374d

Please sign in to comment.