From 1a36144095f85dd653b387b450a3bca5139adb68 Mon Sep 17 00:00:00 2001
From: Philipp Stracker
Date: Thu, 5 Dec 2024 15:06:59 +0100
Subject: [PATCH] =?UTF-8?q?=F0=9F=91=94=20Start=20to=20customize=20the=20p?=
=?UTF-8?q?roduction=20ISU=20link?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/Endpoint/PartnerReferrals.php | 2 ++
.../resources/js/data/onboarding/selectors.js | 32 +++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php b/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php
index c7f5ec131..1d100cdda 100644
--- a/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php
+++ b/modules/ppcp-api-client/src/Endpoint/PartnerReferrals.php
@@ -16,6 +16,8 @@ use Psr\Log\LoggerInterface;
/**
* Class PartnerReferrals
+ *
+ * @see https://developer.paypal.com/docs/api/partner-referrals/v2/
*/
class PartnerReferrals {
diff --git a/modules/ppcp-settings/resources/js/data/onboarding/selectors.js b/modules/ppcp-settings/resources/js/data/onboarding/selectors.js
index 63296d8a4..2e0953437 100644
--- a/modules/ppcp-settings/resources/js/data/onboarding/selectors.js
+++ b/modules/ppcp-settings/resources/js/data/onboarding/selectors.js
@@ -36,5 +36,37 @@ export const flags = ( state ) => {
export const determineProducts = ( state ) => {
const derivedProducts = [];
+ const { isCasualSeller, areOptionalPaymentMethodsEnabled } =
+ persistentData( state );
+ const { canUseVaulting, canUseCardPayments } = flags( state );
+
+ if ( ! canUseCardPayments || ! areOptionalPaymentMethodsEnabled ) {
+ /**
+ * Branch 1: Credit Card Payments not available.
+ * The store uses the Express-checkout product.
+ */
+ derivedProducts.push( 'EXPRESS_CHECKOUT' );
+ } else if ( isCasualSeller ) {
+ /**
+ * Branch 2: Merchant has no business.
+ * The store uses the Express-checkout product.
+ */
+ derivedProducts.push( 'EXPRESS_CHECKOUT' );
+
+ // TODO: Add the "BCDC" product/feature
+ // Requirement: "EXPRESS_CHECKOUT with BCDC"
+ } else {
+ /**
+ * Branch 3: Merchant is business, and can use CC payments.
+ * The store uses the advanced PPCP product.
+ */
+ derivedProducts.push( 'PPCP' );
+ }
+
+ if ( canUseVaulting ) {
+ // TODO: Add the "Vaulting" product/feature
+ // Requirement: "... with Vault"
+ }
+
return derivedProducts;
};