Skip to content

Commit e5be8a0

Browse files
Unit test Payment_Gateway\External_Checkout\Google_Pay\Google_Pay::get_gateway_merchant_id method
1 parent 375a5fc commit e5be8a0

File tree

1 file changed

+8
-2
lines changed
  • woocommerce/payment-gateway/External_Checkout/Google_Pay

1 file changed

+8
-2
lines changed

woocommerce/payment-gateway/External_Checkout/Google_Pay/Google_Pay.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,9 +732,15 @@ public function get_merchant_id() : string {
732732
*/
733733
public function get_gateway_merchant_id() : string {
734734

735-
$gateway = $this->get_processing_gateway();
735+
if (! $gateway = $this->get_processing_gateway()) {
736+
return '';
737+
}
738+
739+
if (! is_object($gateway)) {
740+
return '';
741+
}
736742

737-
return method_exists( $gateway, 'get_merchant_id' ) ? $gateway->get_merchant_id() : '';
743+
return method_exists($gateway, 'get_merchant_id') ? $gateway->get_merchant_id() : '';
738744
}
739745

740746
/**

0 commit comments

Comments
 (0)