Skip to content

Commit

Permalink
adding opfBaseUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
FollowTheFlo committed Oct 17, 2024
1 parent a7cf92d commit aea3468
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('OpfEndpointsService', () => {
beforeEach(() => {
opfConfigMock = {
opf: {
baseUrl: 'https://elec-spa.com/opf',
opfBaseUrl: 'https://elec-spa.com/opf',
},
};
opfApiConfigMock = {
Expand Down Expand Up @@ -70,7 +70,7 @@ describe('OpfEndpointsService', () => {
});

it('should return an empty string when baseUrl is empty', () => {
service['opfConfig'] = { opf: { baseUrl: '' } };
service['opfConfig'] = { opf: { opfBaseUrl: '' } };
const result = service['getBaseEndpoint']();
expect(result).toEqual('');
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ export class OpfEndpointsService {
}

private getBaseEndpoint(): string {
if (this.opfConfig && this.opfConfig.opf && this.opfConfig.opf.baseUrl) {
return this.opfConfig.opf.baseUrl;
if (this.opfConfig && this.opfConfig.opf && this.opfConfig.opf.opfBaseUrl) {
return this.opfConfig.opf.opfBaseUrl;
}

return '';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import { OpfConfig } from './opf-config';

export const defaultOpfConfig: OpfConfig = {
opf: {
baseUrl: '',
opfBaseUrl: '',
},
};
2 changes: 1 addition & 1 deletion integration-libs/opf/base/root/config/opf-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { Config } from '@spartacus/core';
})
export abstract class OpfConfig {
opf?: {
baseUrl?: string;
opfBaseUrl?: string;
commerceCloudPublicKey?: string;
};
}
Expand Down
2 changes: 1 addition & 1 deletion integration-libs/opf/schematics/add-opf/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"OPF-Quick-Buy"
]
},
"baseUrl": {
"opfBaseUrl": {
"type": "string",
"description": "The base url of Cloud Commerce Adapter for Open Payment Framework integration",
"x-prompt": "[OPF] What is the base URL (origin) of your OPF Cloud Commerce Adapter?"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ import { AdditionalFeatureConfiguration } from '../../utils/feature-utils';
import { LibraryOptions, SchematicConfig } from '../../utils/lib-utils';

export interface SpartacusOpfOptions extends LibraryOptions {
baseUrl?: string;
commerceCloudApiUrl?: string;
opfBaseUrl?: string;
commerceCloudPublicKey?: string;
}

Expand Down Expand Up @@ -261,7 +260,7 @@ function buildOpfConfig(
],
content: `<${OPF_CONFIG}>{
opf: {
baseUrl: "${options.commerceCloudApiUrl || options.baseUrl || 'PLACEHOLDER_OPF_BASE_URL'}",
opfBaseUrl: "${options.opfBaseUrl || 'PLACEHOLDER_OPF_BASE_URL'}",
commerceCloudPublicKey: "${
options.commerceCloudPublicKey ||
'PLACEHOLDER_COMMERCE_CLOUD_PUBLIC_KEY'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ if (environment.b2b) {
}),
provideConfig(<OpfConfig>{
opf: {
baseUrl:
opfBaseUrl:
'https://cp96avkh5f-integrati2-d2.opf.commerce.stage.context.cloud.sap/commerce-cloud-adapter-stage/storefront',
commerceCloudPublicKey: 'k2N3m3TJPLragwia5ZUvS/qkIPVQoy5qjUkOAB6Db+U=',
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/install/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ function add_epd_visualization {

function add_opf {
if [ "$ADD_OPF" = true ] ; then
ng add @spartacus/opf@${SPARTACUS_VERSION} --base-url ${OPF_BASE_URL} --commerce-cloud-public-key ${OPF_CLIENT_PUBLIC_KEY} --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
}

Expand Down

0 comments on commit aea3468

Please sign in to comment.