From 179c1d6831adf8bf81a967f3242bd6ce777dd790 Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Tue, 13 Aug 2024 19:34:13 +0200
Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20Minor=20clean-up?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../resources/js/GooglepayButton.js | 25 ++-----------------
1 file changed, 2 insertions(+), 23 deletions(-)
diff --git a/modules/ppcp-googlepay/resources/js/GooglepayButton.js b/modules/ppcp-googlepay/resources/js/GooglepayButton.js
index cd468b93e..6ad65c6d5 100644
--- a/modules/ppcp-googlepay/resources/js/GooglepayButton.js
+++ b/modules/ppcp-googlepay/resources/js/GooglepayButton.js
@@ -386,7 +386,6 @@ class GooglepayButton {
updatedData.country_code = transactionInfo.countryCode;
updatedData.currency_code = transactionInfo.currencyCode;
- updatedData.total_str = transactionInfo.totalPrice;
// Handle unserviceable address.
if ( ! updatedData.shipping_options?.shippingOptions?.length ) {
@@ -425,7 +424,8 @@ class GooglepayButton {
* TODO - Move this to the PaymentButton base class
*
* @param {string} shippingId - The shipping method ID.
- * @param {Object} shippingData - The PaymentDataRequest object that contains shipping options.
+ * @param {Object} shippingData - The PaymentDataRequest object that
+ * contains shipping options.
* @param {Array} shippingData.shippingOptions
* @param {string} shippingData.defaultSelectedOptionId
*
@@ -460,27 +460,6 @@ class GooglepayButton {
return currentOption?.cost ? this.toAmount( currentOption.cost ) : 0;
}
- /**
- * Converts the provided value to a number with configurable precision.
- *
- * TODO - Move this to the PaymentButton base class
- *
- * @param {any} value - The value to convert.
- * @param {number} [precision=2] - The number of decimal places.
- * @return {number} Always a numeric value with the specified precision.
- */
- toAmount( value, precision = 2 ) {
- const number = Number( value );
-
- if ( isNaN( number ) ) {
- return 0;
- }
-
- const multiplier = Math.pow( 10, precision );
-
- return Math.round( number * multiplier ) / multiplier;
- }
-
unserviceableShippingAddressError() {
return {
reason: 'SHIPPING_ADDRESS_UNSERVICEABLE',