Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions woocommerce/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
*** SkyVerge WooCommerce Plugin Framework Changelog ***

2025.nn.nn - version 5.15.3
* Fix - Add Merchant ID to Google Pay, distinguishing it from Gateway merchant ID

2024.11.25 - version 5.15.2
* Fix - Prevent "Capture Charge" bulk action from loading on non-order pages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ public function get_settings() {
'default' => 'no',
],

[
'id' => 'sv_wc_google_pay_merchant_id',
'title' => __( 'Merchant ID', 'woocommerce-plugin-framework' ),
/** translators: Placeholders: %1$s - <a href="..."> tag, %2$s - </a> tag */
'desc' => sprintf( __( 'A Google merchant identifier issued after registration with the %1$sGoogle Pay & Wallet Console%2$s. 12-18 characters. Required in production environment.', 'woocommerce-plugin-framework' ), '<a href="https://pay.google.com/business/console" target="_blank">', '</a>' ),
'type' => 'text',
],

[
'id' => 'sv_wc_google_pay_display_locations',
/* translators: Allow Google Pay button on selected display locations (e.g. cart, checkout, product page...) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,10 @@ protected function get_js_handler_args() {
return (array) apply_filters( 'wc_' . $this->get_gateway()->get_id() . '_google_pay_js_handler_params', [
'plugin_id' => $this->get_gateway()->get_plugin()->get_id(),
'merchant_id' => $this->get_handler()->get_merchant_id(),
'merchant_name' => get_bloginfo( 'name' ),
'merchant_name' => $this->get_handler()->get_merchant_name(),
'gateway_id' => $this->get_gateway()->get_id(),
'gateway_id_dasherized' => $this->get_gateway()->get_id_dasherized(),
'gateway_merchant_id' => $this->get_handler()->get_gateway_merchant_id(),
'environment' => $this->get_gateway()->get_environment() == 'production' ? 'PRODUCTION' : 'TEST',
'ajax_url' => admin_url( 'admin-ajax.php' ),
'recalculate_totals_nonce' => wp_create_nonce( 'wc_' . $this->get_gateway()->get_id() . '_google_pay_recalculate_totals' ),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,18 +702,58 @@ public function get_supported_networks() {
}


/**
* Gets the Google Pay merchant ID.
*
* @since 5.10.0
*
* @see https://developers.google.com/pay/api/web/reference/request-objects#MerchantInfo
*
* @return string
*/
public function get_merchant_id() : string {

return get_option( "sv_wc_{$this->id}_merchant_id" ) ?? '';
}

/**
* Gets the gateway merchant ID.
*
* This is different from the Google Pay Merchant ID.
* Each plugin can override this method to get the merchant ID from their own setting.
*
* @since 5.10.0
* @see https://developers.google.com/pay/api/web/guides/tutorial#tokenization
*
* @since 5.15.3
*
* @return string
*/
public function get_gateway_merchant_id() : string {

$gateway = $this->get_processing_gateway();

return method_exists( $gateway, 'get_merchant_id' ) ? $gateway->get_merchant_id() : '';
}

/**
* Gets the merchant name.
*
* Defaults to the blog name.
*
* @since 5.15.3
*
* @return string
*/
public function get_merchant_id() {
public function get_merchant_name() :string {

return method_exists( $this->get_processing_gateway(), 'get_merchant_id' ) ? $this->get_processing_gateway()->get_merchant_id() : '';
/**
* Filters the Google Pay merchant name.
*
* @since 5.15.3
*
* @param string $name the merchant name (defaults to blog name)
*/
return apply_filters( 'sv_wc_google_pay_merchant_name', get_bloginfo( 'name' ) );
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jQuery( function( $ ) {
* @param {string} params.merchant_name The site name
* @param {string} params.gateway_id The gateway ID
* @param {string} params.gateway_id_dasherized The gateway ID dasherized
* @param {string} params.gateway_merchant_id The gateway merchant ID
* @param {string} params.environment The gateway environment (PRODUCTION or TEST)
* @param {string} params.ajax_url The AJAX URL
* @param {string} params.recalculate_totals_nonce Nonce for the recalculate_totals AJAX action
Expand All @@ -42,6 +43,7 @@ jQuery( function( $ ) {
merchant_name,
gateway_id,
gateway_id_dasherized,
gateway_merchant_id,
environment,
ajax_url,
recalculate_totals_nonce,
Expand All @@ -55,6 +57,7 @@ jQuery( function( $ ) {
} = params;

this.gatewayID = gateway_id;
this.gatewayMerchantID = gateway_merchant_id;
this.merchantID = merchant_id;
this.merchantName = merchant_name;
this.environment = environment;
Expand Down Expand Up @@ -109,7 +112,7 @@ jQuery( function( $ ) {
type: 'PAYMENT_GATEWAY',
parameters: {
'gateway': plugin_id,
'gatewayMerchantId': this.merchantID
'gatewayMerchantId': this.gatewayMerchantID
}
};

Expand Down
Loading