Skip to content

Commit

Permalink
MOL-471: fixing get payment methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tdang1-shopmacher committed Sep 19, 2024
1 parent caf7615 commit 98efe1d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 20 deletions.
14 changes: 10 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## v1.0.2

Fixes

- Fix the issue that the payment method is not correctly set in some cases

## v1.0.1

### Added
Added

- Changelog

### Updated
Updated

- Postman collection
- Interface interaction field naming to differentiate the connector itself to others

## v1.0.0

### Added
Added

- General configurations for Commercetools, Mollie and connector related
- Package version for requests
Expand All @@ -32,7 +38,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this p
- [KBC/CBC](https://docs.mollie.com/docs/kbc)
- [Paypal](https://docs.mollie.com/docs/paypal)
- [Przelewy24](https://docs.mollie.com/docs/przelewy24)
- Supporting for [Apply pay direct](https://docs.mollie.com/docs/direct-integration-of-apple-pay) & [Mollie card component](https://docs.mollie.com/docs/mollie-components)
- Supporting for [Apply pay direct](https://docs.mollie.com/docs/direct-integration-of-apple-pay) & [Mollie card component](https://docs.mollie.com/docs/mollie-components)
- Filter options for listing payment methods
- Create/cancel payment via Payment API
- Refund/cancel refund payment via Refund API
Expand Down
4 changes: 2 additions & 2 deletions processor/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion processor/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "shopmacher-mollie-processor",
"description": "Integration between commercetools and mollie payment service provider",
"version": "1.0.0",
"version": "1.0.2",
"main": "index.js",
"private": true,
"scripts": {
Expand Down
7 changes: 6 additions & 1 deletion processor/src/utils/map.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ import { parseStringToJsonObject, removeEmptyProperties } from './app.utils';
import { readConfiguration } from './config.utils';

const extractMethodsRequest = (ctPayment: Payment): ParsedMethodsRequestType | undefined => {
return ctPayment?.custom?.fields?.[CustomFields.payment.request];
return parseStringToJsonObject(
ctPayment?.custom?.fields?.[CustomFields.payment.request],
CustomFields.payment.request,
'SCTM - extractMethodsRequest',
ctPayment.id,
);
};

const buildMethodsListParams = (parsedMethodsRequest: ParsedMethodsRequestType): Partial<MethodsListParams> => {
Expand Down
16 changes: 8 additions & 8 deletions processor/tests/service/payment.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ describe('Test listPaymentMethodsByPayment', () => {
},
custom: {
fields: {
sctm_payment_methods_request: {
sctm_payment_methods_request: JSON.stringify({
locale: 'de_DE',
},
}),
},
} as unknown as CustomFields,
} as unknown as Payment;
Expand Down Expand Up @@ -214,9 +214,9 @@ describe('Test listPaymentMethodsByPayment', () => {
},
custom: {
fields: {
sctm_payment_methods_request: {
sctm_payment_methods_request: JSON.stringify({
locale: 'de_DE',
},
}),
},
} as unknown as CustomFields,
} as unknown as Payment;
Expand Down Expand Up @@ -286,9 +286,9 @@ describe('Test listPaymentMethodsByPayment', () => {
},
custom: {
fields: {
sctm_payment_methods_request: {
sctm_payment_methods_request: JSON.stringify({
locale: 'de_DE',
},
}),
},
} as unknown as CustomFields,
} as unknown as Payment;
Expand Down Expand Up @@ -362,9 +362,9 @@ describe('Test listPaymentMethodsByPayment', () => {
},
custom: {
fields: {
sctm_payment_methods_request: {
sctm_payment_methods_request: JSON.stringify({
locale: 'de_DE',
},
}),
},
} as unknown as CustomFields,
} as unknown as Payment;
Expand Down
8 changes: 4 additions & 4 deletions processor/tests/utils/map.utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ describe('Test map.utils.ts', () => {
},
custom: {
fields: {
sctm_payment_methods_request: {
sctm_payment_methods_request: JSON.stringify({
sequenceType: 'oneoff',
locale: 'de_DE',
billingCountry: 'DE',
resouce: 'payments',
includeWallets: 'momo',
includeWallets: 'applepay',
orderLineCategories: 'demo,test,sandbox',
},
}),
},
},
} as unknown as Payment;
Expand All @@ -49,7 +49,7 @@ describe('Test map.utils.ts', () => {
sequenceType: 'oneoff',
locale: 'de_DE',
billingCountry: 'DE',
includeWallets: 'momo',
includeWallets: 'applepay',
orderLineCategories: 'demo,test,sandbox',
} as unknown as MethodsListParams;

Expand Down

0 comments on commit 98efe1d

Please sign in to comment.