Skip to content

Commit

Permalink
fix: Move GooglePay url into default config
Browse files Browse the repository at this point in the history
Closes: CXSPA-9216
  • Loading branch information
Matejk00 authored Jan 21, 2025
1 parent 8283000 commit 1c29fdc
Showing 8 changed files with 6 additions and 67 deletions.
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ import { OpfQuickBuyConfig } from './opf-quick-buy-config';
export const defaultOpfQuickBuyConfig: OpfQuickBuyConfig = {
providers: {
googlePay: {
resourceUrl: '',
resourceUrl: 'https://pay.google.com/gp/p/js/pay.js',
},
},
};
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
exports[`Spartacus SAP OPF integration schematics: ng-add SAP OPF feature general setup should add the feature using the lazy loading syntax 1`] = `
"import { NgModule } from '@angular/core';
import { CmsConfig, provideConfig } from "@spartacus/core";
import { OPF_QUICK_BUY_FEATURE, OpfQuickBuyConfig, OpfQuickBuyRootModule } from "@spartacus/opf/quick-buy/root";
import { OPF_QUICK_BUY_FEATURE, OpfQuickBuyRootModule } from "@spartacus/opf/quick-buy/root";
@NgModule({
declarations: [],
@@ -17,16 +17,7 @@ import { OPF_QUICK_BUY_FEATURE, OpfQuickBuyConfig, OpfQuickBuyRootModule } from
import('@spartacus/opf/quick-buy').then((m) => m.OpfQuickBuyModule),
},
}
}),
provideConfig(<OpfQuickBuyConfig>{
providers:
{
googlePay: {
resourceUrl: "PLACEHOLDER_GOOGLE_PAY_API_URL"
}
}
})
]
})]
})
export class OpfFeatureModule { }
"
@@ -35,7 +26,7 @@ export class OpfFeatureModule { }
exports[`Spartacus SAP OPF integration schematics: ng-add SAP OPF feature general setup should add the feature using the lazy loading syntax 2`] = `
"import { NgModule } from '@angular/core';
import { CmsConfig, provideConfig } from "@spartacus/core";
import { OPF_QUICK_BUY_FEATURE, OpfQuickBuyConfig, OpfQuickBuyRootModule } from "@spartacus/opf/quick-buy/root";
import { OPF_QUICK_BUY_FEATURE, OpfQuickBuyRootModule } from "@spartacus/opf/quick-buy/root";
@NgModule({
declarations: [],
@@ -49,16 +40,7 @@ import { OPF_QUICK_BUY_FEATURE, OpfQuickBuyConfig, OpfQuickBuyRootModule } from
import('@spartacus/opf/quick-buy').then((m) => m.OpfQuickBuyModule),
},
}
}),
provideConfig(<OpfQuickBuyConfig>{
providers:
{
googlePay: {
resourceUrl: "PLACEHOLDER_GOOGLE_PAY_API_URL"
}
}
})
]
})]
})
export class OpfFeatureModule { }
"
4 changes: 0 additions & 4 deletions integration-libs/opf/schematics/add-opf/schema.json
Original file line number Diff line number Diff line change
@@ -52,10 +52,6 @@
"commerceCloudPublicKey": {
"type": "string",
"description": "Commerce Clould public key required for authentication between OPF Cloud Commerce Adapter and Spartacus"
},
"opfGooglePayApiUrl": {
"type": "string",
"description": "GooglePay Api url required for Quick Buy Google Pay Integration."
}
},
"required": []
Original file line number Diff line number Diff line change
@@ -36,7 +36,6 @@ import { ORDER_MODULE } from '../order-schematics-config';
export interface SpartacusOpfOptions extends LibraryOptions {
opfBaseUrl?: string;
commerceCloudPublicKey?: string;
opfGooglePayApiUrl?: string;
}

export const OPF_FOLDER_NAME = 'opf';
@@ -264,7 +263,6 @@ export const OPF_QUICK_BUY_SCHEMATICS_CONFIG: SchematicConfig = {
scssFileName: OPF_SCSS_FILE_NAME,
importStyle: SPARTACUS_OPF,
},
customConfig: buildOpfQuickBuyConfig,
};

function buildOpfConfig(
@@ -290,26 +288,3 @@ function buildOpfConfig(
},
};
}

function buildOpfQuickBuyConfig(
options: SpartacusOpfOptions
): AdditionalFeatureConfiguration<SpartacusOpfOptions> {
return {
providers: {
import: [
{
moduleSpecifier: SPARTACUS_OPF_QUICK_BUY_ROOT,
namedImports: [OPF_QUICKBUY_CONFIG],
},
],
content: `<${OPF_QUICKBUY_CONFIG}>{
providers:
{
googlePay: {
resourceUrl: "${options.opfGooglePayApiUrl || 'PLACEHOLDER_GOOGLE_PAY_API_URL'}"
}
}
}`,
},
};
}
Original file line number Diff line number Diff line change
@@ -36,10 +36,7 @@ import {
OpfPaymentRootModule,
} from '@spartacus/opf/payment/root';
import {
OPF_GOOGLE_PAY_PROVIDER_NAME,
OPF_QUICK_BUY_FEATURE,
OpfQuickBuyConfig,
OpfQuickBuyGooglePayProvider,
OpfQuickBuyRootModule,
} from '@spartacus/opf/quick-buy/root';
import { environment } from '../../../../environments/environment';
@@ -112,13 +109,6 @@ if (environment.b2b) {
commerceCloudPublicKey: 'ab4RhYGZ+w5B0SALMPOPlepWk/kmDQjTy2FU5hrQoFg=',
},
}),
provideConfig(<OpfQuickBuyConfig>{
providers: {
[OPF_GOOGLE_PAY_PROVIDER_NAME]: {
resourceUrl: 'https://pay.google.com/gp/p/js/pay.js',
} as OpfQuickBuyGooglePayProvider,
},
}),
...extensionProviders,
],
})
2 changes: 0 additions & 2 deletions scripts/install/config.default.sh
Original file line number Diff line number Diff line change
@@ -93,8 +93,6 @@ EPD_VISUALIZATION_BASE_URL=
# The base URL and public key values are required for connection to Cloud Commerce Adapter (OPF)
OPF_BASE_URL=
OPF_CLIENT_PUBLIC_KEY=
# Google Pay Api url required for Quick Buy Google Pay integration.
OPF_QUICK_BUY_GOOGLE_PAY_RESOURCE_URL=

#NPM connection info
#NPM_URL must start by 'https://' and end with '/' char
2 changes: 0 additions & 2 deletions scripts/install/config.opf.sh
Original file line number Diff line number Diff line change
@@ -8,5 +8,3 @@ BASE_SITE="electronics-spa-standalone"
# The base URL and public key values are required for connection to Cloud Commerce Adapter (OPF)
OPF_BASE_URL="https://cp96avkh5f-integrati2-d2.opf.commerce.stage.context.cloud.sap/commerce-cloud-adapter-stage/storefront"
OPF_CLIENT_PUBLIC_KEY="k2N3m3TJPLragwia5ZUvS/qkIPVQoy5qjUkOAB6Db+U="
# Google Pay Api url required for Quick Buy Google Pay integration.
OPF_QUICK_BUY_GOOGLE_PAY_RESOURCE_URL="https://pay.google.com/gp/p/js/pay.js"
2 changes: 1 addition & 1 deletion scripts/install/functions.sh
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@ function add_epd_visualization {

function add_opf {
if [ "$ADD_OPF" = true ] ; then
ng add @spartacus/opf@${SPARTACUS_VERSION} --opf-base-url ${OPF_BASE_URL} --commerce-cloud-public-key ${OPF_CLIENT_PUBLIC_KEY} --opf-google-pay-api-url ${OPF_QUICK_BUY_GOOGLE_PAY_RESOURCE_URL} --skip-confirmation --no-interactive
ng add @spartacus/opf@${SPARTACUS_VERSION} --opf-base-url ${OPF_BASE_URL} --commerce-cloud-public-key ${OPF_CLIENT_PUBLIC_KEY} --skip-confirmation --no-interactive
fi
}

0 comments on commit 1c29fdc

Please sign in to comment.