Skip to content

Commit aa20fab

Browse files
MOL-303: add additional info to the version string
1 parent 4070093 commit aa20fab

File tree

8 files changed

+20
-16
lines changed

8 files changed

+20
-16
lines changed

processor/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

processor/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "shopmacher-mollie-processor",
33
"description": "Integration between commercetools and mollie payment service provider",
4-
"version": "0.0.32",
4+
"version": "0.0.33",
55
"main": "index.js",
66
"private": true,
77
"scripts": {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import createMollieClient, { MollieClient } from '@mollie/api-client';
22
import { getApiKey, readConfiguration } from '../utils/config.utils';
3-
import { VERSION_STRING } from '../utils/constant.utils';
3+
import { MOLLIE_VERSION_STRINGS } from '../utils/constant.utils';
44

55
/**
66
* Initializes the Mollie client using the API key from the configuration.
@@ -10,13 +10,13 @@ import { VERSION_STRING } from '../utils/constant.utils';
1010
export const initMollieClient = (): MollieClient => {
1111
return createMollieClient({
1212
apiKey: getApiKey(),
13-
versionStrings: `${VERSION_STRING}`,
13+
versionStrings: MOLLIE_VERSION_STRINGS,
1414
});
1515
};
1616

1717
export const initMollieClientForApplePaySession = (): MollieClient => {
1818
return createMollieClient({
1919
apiKey: readConfiguration().mollie.liveApiKey,
20-
versionStrings: `${VERSION_STRING}`,
20+
versionStrings: MOLLIE_VERSION_STRINGS,
2121
});
2222
};

processor/src/mollie/payment.mollie.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { logger } from '../utils/logger.utils';
1313
import { ApplePaySessionRequest, CustomPayment } from '../types/mollie.types';
1414
import ApplePaySession from '@mollie/api-client/dist/types/src/data/applePaySession/ApplePaySession';
1515
import { getApiKey } from '../utils/config.utils';
16-
import { VERSION_STRING } from '../utils/constant.utils';
16+
import { MOLLIE_VERSION_STRINGS } from '../utils/constant.utils';
1717
import fetch from 'node-fetch';
1818

1919
/**
@@ -111,7 +111,7 @@ export const createPaymentWithCustomMethod = async (paymentParams: PaymentCreate
111111
const headers = {
112112
'Content-Type': 'application/json',
113113
Authorization: `Bearer ${getApiKey()}`,
114-
versionStrings: `${VERSION_STRING}`,
114+
versionStrings: MOLLIE_VERSION_STRINGS,
115115
};
116116

117117
const response = await fetch('https://api.mollie.com/v2/payments', {

processor/src/utils/constant.utils.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ export const LIBRARY_NAME = 'ShopmacherCommercetoolsMollieConnector';
55

66
export const LIBRARY_VERSION = PACKAGE_VERSION;
77

8+
export const MOLLIE_AGENT_INFO = 'uap/NJTCs6RvSnqbvawh';
9+
810
export const VERSION_STRING = `${LIBRARY_NAME}/${LIBRARY_VERSION}`;
911

12+
export const MOLLIE_VERSION_STRINGS = [VERSION_STRING, MOLLIE_AGENT_INFO];
13+
1014
export const CustomFields = {
1115
payment: {
1216
error: 'sctm_payment_methods_error',

processor/tests/client/mollie.client.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getApiKey } from '../../src/utils/config.utils';
22
import { initMollieClient } from '../../src/client/mollie.client';
33
import createMollieClient, { MollieClient } from '@mollie/api-client';
44
import { describe, jest, expect, it } from '@jest/globals';
5-
import { LIBRARY_NAME, LIBRARY_VERSION } from '../../src/utils/constant.utils';
5+
import { MOLLIE_VERSION_STRINGS } from '../../src/utils/constant.utils';
66

77
jest.mock('@mollie/api-client', () => ({
88
// @ts-expect-error ignore type error
@@ -30,7 +30,7 @@ describe('Test mollie.client.ts', () => {
3030
expect(mockGetApiKey).toHaveBeenCalled();
3131
expect(mockCreateMollieClient).toHaveBeenCalledWith({
3232
apiKey: 'test-api-key',
33-
versionStrings: `${LIBRARY_NAME}/${LIBRARY_VERSION}`,
33+
versionStrings: MOLLIE_VERSION_STRINGS,
3434
});
3535
expect(client).toBe(mockMollieClient);
3636
});

processor/tests/mollie/payment.mollie.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
import { MollieApiError, PaymentCreateParams } from '@mollie/api-client';
1111
import { logger } from '../../src/utils/logger.utils';
1212
import CustomError from '../../src/errors/custom.error';
13-
import { VERSION_STRING } from '../../src/utils/constant.utils';
13+
import { MOLLIE_VERSION_STRINGS } from '../../src/utils/constant.utils';
1414
import { getApiKey } from '../../src/utils/config.utils';
1515
import fetch from 'node-fetch';
1616

@@ -136,7 +136,7 @@ describe('createPaymentWithCustomMethod', () => {
136136
const headers = {
137137
'Content-Type': 'application/json',
138138
Authorization: `Bearer ${getApiKey()}`,
139-
versionStrings: `${VERSION_STRING}`,
139+
versionStrings: MOLLIE_VERSION_STRINGS,
140140
};
141141

142142
(fetch as unknown as jest.Mock).mockImplementation(async () =>
@@ -174,7 +174,7 @@ describe('createPaymentWithCustomMethod', () => {
174174
const headers = {
175175
'Content-Type': 'application/json',
176176
Authorization: `Bearer ${getApiKey()}`,
177-
versionStrings: `${VERSION_STRING}`,
177+
versionStrings: MOLLIE_VERSION_STRINGS,
178178
};
179179

180180
const response = {
@@ -239,7 +239,7 @@ describe('createPaymentWithCustomMethod', () => {
239239
const headers = {
240240
'Content-Type': 'application/json',
241241
Authorization: `Bearer ${getApiKey()}`,
242-
versionStrings: `${VERSION_STRING}`,
242+
versionStrings: MOLLIE_VERSION_STRINGS,
243243
};
244244

245245
const response = {
@@ -295,7 +295,7 @@ describe('createPaymentWithCustomMethod', () => {
295295
const headers = {
296296
'Content-Type': 'application/json',
297297
Authorization: `Bearer ${getApiKey()}`,
298-
versionStrings: `${VERSION_STRING}`,
298+
versionStrings: MOLLIE_VERSION_STRINGS,
299299
};
300300

301301
const errorMessage = 'SCTM - createPaymentWithCustomMethod - Failed to create a payment with unknown errors';

processor/tests/routes/webhook.route.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, it, jest, beforeEach } from '@jest/globals';
1+
import { describe, it, jest, beforeEach, expect } from '@jest/globals';
22
import { Request, Response, NextFunction } from 'express';
33
import webhookRouter from '../../src/routes/webhook.route';
44

0 commit comments

Comments
 (0)