Skip to content

Commit e152458

Browse files
Feature/mol 736 resolve develop (#159)
* MOL-736 - update condition check * MOL-736 - update post deploy script
1 parent a18bf88 commit e152458

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

processor/src/commercetools/customFields.commercetools.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { CustomFields } from '../utils/constant.utils';
22
import { createApiRoot } from '../client/create.client';
33
import { FieldDefinition, TypeUpdateAction } from '@commercetools/platform-sdk';
4-
import { readConfiguration } from '../utils/config.utils';
54
const PAYMENT_TYPE_KEY = 'sctm-payment-custom-type';
65

76
export async function createCustomPaymentType(): Promise<void> {
@@ -239,9 +238,8 @@ export async function createCustomPaymentInterfaceInteractionType(): Promise<voi
239238

240239
export async function createCustomTransactionType(): Promise<void> {
241240
const transactionCustomTypeKey =
242-
readConfiguration().commerceTools.transactionCustomTypeKey &&
243-
readConfiguration().commerceTools.transactionCustomTypeKey.length > 0
244-
? readConfiguration().commerceTools.transactionCustomTypeKey
241+
process.env?.CTP_TRANSACTION_CUSTOM_TYPE_KEY && process.env.CTP_TRANSACTION_CUSTOM_TYPE_KEY?.length > 0
242+
? process.env.CTP_TRANSACTION_CUSTOM_TYPE_KEY
245243
: CustomFields.transactions.defaultCustomTypeKey;
246244

247245
const apiRoot = createApiRoot();

processor/src/service/connector.service.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,15 @@ import { getAccessToken } from '../commercetools/auth.commercetools';
88

99
export const createExtensionAndCustomFields = async (extensionUrl: string): Promise<void> => {
1010
const response = await getAccessToken();
11-
await createPaymentExtension(extensionUrl, response?.access_token as string);
12-
await createCustomPaymentType();
13-
await createCustomPaymentInterfaceInteractionType();
14-
await createCustomTransactionType();
11+
try {
12+
await createPaymentExtension(extensionUrl, response?.access_token as string);
13+
await createCustomPaymentType();
14+
await createCustomPaymentInterfaceInteractionType();
15+
await createCustomTransactionType();
16+
} catch (error) {
17+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
18+
throw new Error(`Failed to create extension and custom fields: ${errorMessage}`);
19+
}
1520
};
1621

1722
export const removeExtension = async (): Promise<void> => {

0 commit comments

Comments
 (0)