From 25282b9514dc5d85886c15a2c8cb15e0ec6181c1 Mon Sep 17 00:00:00 2001
From: Pedro Silva
Date: Mon, 10 Jul 2023 08:53:05 +0100
Subject: [PATCH] Fix code review ajustments
---
modules/ppcp-api-client/src/Entity/Item.php | 4 ++--
.../ActionHandler/SingleProductActionHandler.js | 10 +++++-----
.../modules/Helper/{CartJanitor.js => CartHelper.js} | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
rename modules/ppcp-button/resources/js/modules/Helper/{CartJanitor.js => CartHelper.js} (97%)
diff --git a/modules/ppcp-api-client/src/Entity/Item.php b/modules/ppcp-api-client/src/Entity/Item.php
index 0f576f32c..efcaa179d 100644
--- a/modules/ppcp-api-client/src/Entity/Item.php
+++ b/modules/ppcp-api-client/src/Entity/Item.php
@@ -74,7 +74,7 @@ class Item {
protected $tax_rate;
/**
- * The tax rate.
+ * The cart item key.
*
* @var string|null
*/
@@ -192,7 +192,7 @@ class Item {
/**
* Returns the cart key for this item.
*
- * @return string
+ * @return string|null
*/
public function cart_item_key():?string {
return $this->cart_item_key;
diff --git a/modules/ppcp-button/resources/js/modules/ActionHandler/SingleProductActionHandler.js b/modules/ppcp-button/resources/js/modules/ActionHandler/SingleProductActionHandler.js
index 6d2e83706..5cb64febc 100644
--- a/modules/ppcp-button/resources/js/modules/ActionHandler/SingleProductActionHandler.js
+++ b/modules/ppcp-button/resources/js/modules/ActionHandler/SingleProductActionHandler.js
@@ -3,7 +3,7 @@ import BookingProduct from "../Entity/BookingProduct";
import onApprove from '../OnApproveHandler/onApproveForContinue';
import {payerData} from "../Helper/PayerData";
import {PaymentMethods} from "../Helper/CheckoutMethodState";
-import CartJanitor from "../Helper/CartJanitor";
+import CartHelper from "../Helper/CartHelper";
import FormHelper from "../Helper/FormHelper";
class SingleProductActionHandler {
@@ -18,7 +18,7 @@ class SingleProductActionHandler {
this.updateCart = updateCart;
this.formElement = formElement;
this.errorHandler = errorHandler;
- this.cartJanitor = null;
+ this.cartHelper = null;
}
subscriptionsConfiguration() {
@@ -100,7 +100,7 @@ class SingleProductActionHandler {
createOrder()
{
- this.cartJanitor = null;
+ this.cartHelper = null;
let getProducts = (() => {
if ( this.isBookingProduct() ) {
@@ -139,7 +139,7 @@ class SingleProductActionHandler {
this.errorHandler.clear();
const onResolve = (purchase_units) => {
- this.cartJanitor = (new CartJanitor()).addFromPurchaseUnits(purchase_units);
+ this.cartHelper = (new CartHelper()).addFromPurchaseUnits(purchase_units);
const payer = payerData();
const bnCode = typeof this.config.bn_codes[this.config.context] !== 'undefined' ?
@@ -206,7 +206,7 @@ class SingleProductActionHandler {
}
cleanCart() {
- this.cartJanitor.removeFromCart().then(() => {
+ this.cartHelper.removeFromCart().then(() => {
this.refreshMiniCart();
}).catch(error => {
this.refreshMiniCart();
diff --git a/modules/ppcp-button/resources/js/modules/Helper/CartJanitor.js b/modules/ppcp-button/resources/js/modules/Helper/CartHelper.js
similarity index 97%
rename from modules/ppcp-button/resources/js/modules/Helper/CartJanitor.js
rename to modules/ppcp-button/resources/js/modules/Helper/CartHelper.js
index aa4c1d839..8220d7d00 100644
--- a/modules/ppcp-button/resources/js/modules/Helper/CartJanitor.js
+++ b/modules/ppcp-button/resources/js/modules/Helper/CartHelper.js
@@ -1,4 +1,4 @@
-class CartJanitor {
+class CartHelper {
constructor(cartItemKeys = [])
{
@@ -62,4 +62,4 @@ class CartJanitor {
}
}
-export default CartJanitor;
+export default CartHelper;