Skip to content

Commit 7194d73

Browse files
MOL-363: update naming
1 parent bcb8e59 commit 7194d73

File tree

6 files changed

+48
-48
lines changed

6 files changed

+48
-48
lines changed

processor/src/commercetools/action.commercetools.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ export const setCustomFields = (fieldName: string, fieldValue: string) => {
2929
* If the responseValue is an API response, JSON Stringify it before passing it
3030
*/
3131
export const addInterfaceInteraction = (params: CreateInterfaceInteractionParams) => {
32-
const { sctmActionType, sctmRequest, sctmResponse, sctmId, sctmCreatedAt } = params;
33-
const interfaceInteractionId = sctmId ? sctmId : uuid();
34-
const interfaceInteractionTimestamp = sctmCreatedAt ? sctmCreatedAt : createDateNowString();
32+
const { sctm_action_type, sctm_request, sctm_response, sctm_id, sctm_created_at } = params;
33+
const interfaceInteractionId = sctm_id ? sctm_id : uuid();
34+
const interfaceInteractionTimestamp = sctm_created_at ? sctm_created_at : createDateNowString();
3535

3636
return {
3737
action: 'addInterfaceInteraction',
3838
type: {
3939
key: CustomFields.createPayment.interfaceInteraction.key,
4040
},
4141
fields: {
42-
sctmId: interfaceInteractionId,
43-
sctmActionType,
44-
sctmCreatedAt: interfaceInteractionTimestamp,
45-
sctmRequest: sctmRequest,
46-
sctmResponse: sctmResponse,
42+
sctm_id: interfaceInteractionId,
43+
sctm_action_type,
44+
sctm_created_at: interfaceInteractionTimestamp,
45+
sctm_request: sctm_request,
46+
sctm_response: sctm_response,
4747
},
4848
};
4949
};

processor/src/service/payment.service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -309,11 +309,11 @@ export const getCreatePaymentUpdateAction = async (molliePayment: MPayment | Cus
309309
};
310310

311311
const interfaceInteractionParams = {
312-
sctmActionType: ConnectorActions.CreatePayment,
313-
sctmRequest: JSON.stringify(interfaceInteractionRequest),
314-
sctmResponse: JSON.stringify(interfaceInteractionResponse),
315-
sctmId: uuid(),
316-
sctmCreatedAt: molliePayment.createdAt,
312+
sctm_action_type: ConnectorActions.CreatePayment,
313+
sctm_request: JSON.stringify(interfaceInteractionRequest),
314+
sctm_response: JSON.stringify(interfaceInteractionResponse),
315+
sctm_id: uuid(),
316+
sctm_created_at: molliePayment.createdAt,
317317
};
318318

319319
return Promise.resolve([

processor/src/types/commercetools.types.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ export type CTTransaction = {
7373
};
7474

7575
export type CreateInterfaceInteractionParams = {
76-
sctmActionType: ConnectorActions;
77-
sctmRequest: string;
78-
sctmResponse: string;
79-
sctmId?: string;
80-
sctmCreatedAt?: string;
76+
sctm_action_type: ConnectorActions;
77+
sctm_request: string;
78+
sctm_response: string;
79+
sctm_id?: string;
80+
sctm_created_at?: string;
8181
};
8282

8383
export type Action = {

processor/src/utils/constant.utils.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ export const CustomFields = {
2323
interfaceInteraction: {
2424
key: 'sctm_interface_interaction_type',
2525
fields: {
26-
id: 'sctmId',
27-
actionType: 'sctmActionType',
28-
createdAt: 'sctmCreatedAt',
29-
request: 'sctmRequest',
30-
response: 'sctmResponse',
26+
id: 'sctm_id',
27+
actionType: 'sctm_action_type',
28+
createdAt: 'sctm_created_at',
29+
request: 'sctm_request',
30+
response: 'sctm_response',
3131
},
3232
},
3333
},

processor/tests/commercetools/action.commercetools.spec.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ describe('Test actions.utils.ts', () => {
5959
};
6060

6161
const params: CreateInterfaceInteractionParams = {
62-
sctmId: '123456789',
63-
sctmActionType: ConnectorActions.CreatePayment,
64-
sctmRequest: JSON.stringify(requestValueObject),
65-
sctmResponse: JSON.stringify(responseValueObject),
66-
sctmCreatedAt: '2024-07-04T14:07:35+00:00',
62+
sctm_id: '123456789',
63+
sctm_action_type: ConnectorActions.CreatePayment,
64+
sctm_request: JSON.stringify(requestValueObject),
65+
sctm_response: JSON.stringify(responseValueObject),
66+
sctm_created_at: '2024-07-04T14:07:35+00:00',
6767
};
6868

6969
const actual = addInterfaceInteraction(params);
@@ -74,11 +74,11 @@ describe('Test actions.utils.ts', () => {
7474
key: 'sctm_interface_interaction_type',
7575
},
7676
fields: {
77-
sctmId: params.sctmId,
78-
sctmActionType: params.sctmActionType,
79-
sctmCreatedAt: params.sctmCreatedAt,
80-
sctmRequest: params.sctmRequest,
81-
sctmResponse: params.sctmResponse,
77+
sctm_id: params.sctm_id,
78+
sctm_action_type: params.sctm_action_type,
79+
sctm_created_at: params.sctm_created_at,
80+
sctm_request: params.sctm_request,
81+
sctm_response: params.sctm_response,
8282
},
8383
});
8484
});

processor/tests/service/payment.service.spec.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -528,14 +528,14 @@ describe('Test getCreatePaymentUpdateAction', () => {
528528
key: 'sctm_interface_interaction_type',
529529
},
530530
fields: {
531-
sctmId: uuid,
532-
sctmActionType: ConnectorActions.CreatePayment,
533-
sctmCreatedAt: molliePayment.createdAt,
534-
sctmRequest: JSON.stringify({
531+
sctm_id: uuid,
532+
sctm_action_type: ConnectorActions.CreatePayment,
533+
sctm_created_at: molliePayment.createdAt,
534+
sctm_request: JSON.stringify({
535535
transactionId: CTPayment.transactions[0].id,
536536
paymentMethod: CTPayment.paymentMethodInfo.method,
537537
}),
538-
sctmResponse: JSON.stringify({
538+
sctm_response: JSON.stringify({
539539
molliePaymentId: molliePayment.id,
540540
checkoutUrl: molliePayment._links.checkout?.href,
541541
transactionId: CTPayment.transactions[0].id,
@@ -660,11 +660,11 @@ describe('Test handleCreatePayment', () => {
660660
action: 'addInterfaceInteraction',
661661
type: { key: 'sctm_interface_interaction_type' },
662662
fields: {
663-
sctmId: '5c8b0375-305a-4f19-ae8e-07806b101999',
664-
sctmActionType: 'createPayment',
665-
sctmCreatedAt: '2024-03-20T09:13:37+00:00',
666-
sctmRequest: '{"transactionId":"5c8b0375-305a-4f19-ae8e-07806b101999","paymentMethod":"creditcard"}',
667-
sctmResponse:
663+
sctm_id: '5c8b0375-305a-4f19-ae8e-07806b101999',
664+
sctm_action_type: 'createPayment',
665+
sctm_created_at: '2024-03-20T09:13:37+00:00',
666+
sctm_request: '{"transactionId":"5c8b0375-305a-4f19-ae8e-07806b101999","paymentMethod":"creditcard"}',
667+
sctm_response:
668668
'{"molliePaymentId":"tr_7UhSN1zuXS","checkoutUrl":"https://www.mollie.com/checkout/select-method/7UhSN1zuXS","transactionId":"5c8b0375-305a-4f19-ae8e-07806b101999"}',
669669
},
670670
},
@@ -749,11 +749,11 @@ describe('Test handleCreatePayment', () => {
749749
action: 'addInterfaceInteraction',
750750
type: { key: 'sctm_interface_interaction_type' },
751751
fields: {
752-
sctmId: '5c8b0375-305a-4f19-ae8e-07806b101999',
753-
sctmActionType: 'createPayment',
754-
sctmCreatedAt: '2024-03-20T09:13:37+00:00',
755-
sctmRequest: '{"transactionId":"5c8b0375-305a-4f19-ae8e-07806b101999","paymentMethod":"creditcard"}',
756-
sctmResponse:
752+
sctm_id: '5c8b0375-305a-4f19-ae8e-07806b101999',
753+
sctm_action_type: 'createPayment',
754+
sctm_created_at: '2024-03-20T09:13:37+00:00',
755+
sctm_request: '{"transactionId":"5c8b0375-305a-4f19-ae8e-07806b101999","paymentMethod":"creditcard"}',
756+
sctm_response:
757757
'{"molliePaymentId":"tr_7UhSN1zuXS","checkoutUrl":"https://www.mollie.com/checkout/select-method/7UhSN1zuXS","transactionId":"5c8b0375-305a-4f19-ae8e-07806b101999"}',
758758
},
759759
},

0 commit comments

Comments
 (0)