Skip to content

Commit

Permalink
Merge pull request #121 from mollie/bugfix/MOL-587-resolve-develop
Browse files Browse the repository at this point in the history
Bugfix/mol 587 resolve develop
  • Loading branch information
tdang1-shopmacher authored Dec 23, 2024
2 parents a882a8e + d3a76e8 commit 17b9bf5
Show file tree
Hide file tree
Showing 31 changed files with 250 additions and 79 deletions.
87 changes: 51 additions & 36 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,42 @@ 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.2.1
## v1.2.0

Added

- Mollie custom application

Updated

- [getPaymentMethods](/docs/GetPaymentMethods.md) response has new returned format as follow

```Typescript
{
id: string,
name: Record<string, string>
description: Record<string, string>
image: string;
order: number;
}

// e.g.
{
id: 'paypal',
name: {
'en-GB': 'PayPal',
'de-DE': 'PayPal',
},
description: {
'en-GB': '',
'de-DE': '',
},
image: 'https://example.img/paypal.svg',
order: 1
}
```

## v1.1.3

Added

Expand All @@ -16,6 +51,7 @@ Fixes
- Handling the Refund Creation for the case that the Payment has more than one Success Charge transaction
- Changing the way to determine the Create Refund action:
- Before

```Typescript
// processor/src/utils/paymentAction.utils.ts

Expand All @@ -25,6 +61,7 @@ Fixes
```

- After

```Typescript
// processor/src/utils/paymentAction.utils.ts
Expand All @@ -35,6 +72,7 @@ Fixes

- We are supporting to create the refund for the payment which has more than one Success Charge transactions
- By default, we will create the Refund for the latest Success Charge transaction. For example:

```Typescript
// CommerceTools Payment
{
Expand Down Expand Up @@ -95,6 +133,7 @@ Fixes
- Following the changes for creating refund, we also updated the handler for Refund Cancellation to match with the above changes
- Changing the way to determine the Cancel Refund action:
- Before

```Typescript
// processor/src/utils/paymentAction.utils.ts
Expand All @@ -108,6 +147,7 @@ Fixes
```

- After

```Typescript
// processor/src/utils/paymentAction.utils.ts
Expand All @@ -121,6 +161,7 @@ Fixes
```

- To support the old versions, we will create the cancellation for the latest Pending Refund transaction (which is a pending refund for the latest Success Charge transaction in that payment). For example:

```Typescript
// CommerceTools Payment
{
Expand Down Expand Up @@ -158,9 +199,11 @@ Fixes
// In this case, this will be considered as a Cancellation request for the Pending Refund with id: refund-transaction-2
```

__*Note:* The above solution is just for supporting the old versions and will be remove in the near future (in next versions). From this version, please follow the below solution.__

- However, to do it in a correct way, from this version, you should specify the Mollie Refund ID (which stored in the `interactionId` of the Pending Refund transaction) that you want to cancel by putting it in the `interactionId` of the Initial CancelAuthorization. For example:

```Typescript
// CommerceTools Payment
{
Expand Down Expand Up @@ -199,41 +242,6 @@ Fixes
// In this case, this will be considered as a Cancellation request for the Pending Refund with id: refund-transaction-1
```

## v1.2.0

Added

- Mollie custom application initialization

Updated

- [getPaymentMethods](/docs/GetPaymentMethods.md) response has new returned format as follow

```Typescript
{
id: string,
name: Record<string, string>
description: Record<string, string>
image: string;
order: number;
}
// e.g.
{
id: 'paypal',
name: {
'en-GB': 'PayPal',
'de-DE': 'PayPal',
},
description: {
'en-GB': '',
'de-DE': '',
},
image: 'https://example.img/paypal.svg',
order: 1
}
```

## v1.1.2

Added
Expand All @@ -254,6 +262,13 @@ Added
- DockerImage for self hosting on AWS
- Installation endpoint for required configurations

## v1.0.4

Added

- Add configuration to enable authorization mode
- OAuth middleware for securing connector endpoint

## v1.0.3

Added
Expand Down
2 changes: 1 addition & 1 deletion application/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
ENABLE_NEW_JSX_TRANSFORM="true"
FAST_REFRESH="true"
FAST_REFRESH="true"
4 changes: 2 additions & 2 deletions application/.env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ENABLE_NEW_JSX_TRANSFORM="true"
FAST_REFRESH="true"

ENTRY_POINT_URI_PATH="mollie"
PROJECT_KEY="shopm-adv-dev"
PROJECT_KEY="your-project-key"
CLOUD_IDENTIFIER="gcp-eu"
CUSTOM_APPLICATION_ID="app-id"
APPLICATION_URL="http://localhost:3001"
APPLICATION_URL="http://localhost:3001"
2 changes: 1 addition & 1 deletion application/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ dist
# Cypress
cypress/.env
cypress/screenshots/**
cypress/videos/**
cypress/videos/**
2 changes: 1 addition & 1 deletion application/cypress/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ CYPRESS_LOGIN_PASSWORD=<your-password>
CYPRESS_PROJECT_KEY=<your-project-key>
CYPRESS_PACKAGE_NAME="application"
CYPRESS_BASE_URL="https://mc.europe-west1.gcp.commercetools.com/"
CYPRESS_LOCALE="en-GB"
CYPRESS_LOCALE="en-GB"
2 changes: 1 addition & 1 deletion application/schemas/ctp.json
Original file line number Diff line number Diff line change
Expand Up @@ -110765,4 +110765,4 @@
}
]
}
}
}
6 changes: 3 additions & 3 deletions application/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ jest.mock('./src/constants', () => {
View: 'ViewMollie',
Manage: 'TestMollie',
},
PROJECT_KEY: 'shopm-adv-dev',
PROJECT_KEY: 'your-project-key',
CLOUD_IDENTIFIER: 'gcp-eu',
CUSTOM_APPLICATION_ID: '',
APPLICATION_URL: 'http://localhost:3001',
Expand All @@ -14,9 +14,9 @@ jest.mock('./src/constants', () => {
EXTENSION_URL_PATH: '/processor',
APPLICATION_URL_PATH: '/application/methods',
USER_AGENT: {
name: 'ShopmacherMollieCommercetoolsConnector/1.2.0-alpha',
name: 'ShopmacherMollieCommercetoolsConnector/1.2.0',
version: '1.2.0',
libraryName: 'ShopmacherMollieCommercetoolsConnector/1.2.0-alpha',
libraryName: 'ShopmacherMollieCommercetoolsConnector/1.2.0',
contactEmail: '[email protected]',
},
};
Expand Down
2 changes: 1 addition & 1 deletion application/src/components/welcome/web-developer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/Authorization.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ CREAT/UPDATE Extension
"url": "https://efd6-115-74-115-119.ngrok-free.app/processor",
"authorization": {
"type": "AuthorizationHeader",
"headerValue": "_token_"
"headerValue": "***tAjsIR2!srt"
}
}
...
Expand Down
2 changes: 1 addition & 1 deletion docs/CancelPaymentRefund.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,4 +160,4 @@ When order is successfully cancelled on Mollie, we update commercetools payment
## Update per version

The function was updated at:
- [v1.2.1](../CHANGELOG.md#v121)
- [v1.1.3](../CHANGELOG.md#v113)
2 changes: 1 addition & 1 deletion docs/CreateRefund.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ When the refund is completed, this transaction's state will be updated by the no
## Update per version

The function was updated at:
- [v1.2.1](../CHANGELOG.md#v121)
- [v1.1.3](../CHANGELOG.md#v113)
28 changes: 12 additions & 16 deletions docs/GetPaymentMethods.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,17 @@ _Body:_

```json
{
"actions": [
{
"actions": [
{
"action": "setCustomField",
"name": "sctm_mollie_profile_id",
"value": "pfl_SPkYGi***"
},
{
"action": "setCustomField",
"name": "sctm_payment_methods_response",
"value": "{\"count\":7,\"methods\":[{\"id\":\"przelewy24\",\"name\":{\"en-GB\":\"Przelewy24\",\"de-DE\":\"Przelewy24\",\"pl-PL\":\"Przelewy24\"},\"description\":{\"en-GB\":\"\",\"de-DE\":\"Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of \",\"pl-PL\":\"\"},\"image\":\"https://www.mollie.com/external/icons/payment-methods/przelewy24.svg\",\"order\":4},{\"id\":\"banktransfer\",\"name\":{\"en-GB\":\"Bank transfer\",\"de-DE\":\"Bank transfer\",\"pl-PL\":\"Bank transfer\"},\"description\":{\"en-GB\":\"\",\"de-DE\":\"\",\"pl-PL\":\"\"},\"image\":\"https://www.mollie.com/external/icons/payment-methods/banktransfer.svg\",\"order\":3},{\"id\":\"applepay\",\"name\":{\"en-GB\":\"Apple Pay\",\"de-DE\":\"Apple Pay\",\"pl-PL\":\"Apple Pay\"},\"description\":{\"en-GB\":\"Apple Pay description\",\"de-DE\":\"Apple Pay description\",\"pl-PL\":\"\"},\"image\":\"https://www.mollie.com/external/icons/payment-methods/applepay.svg\",\"order\":2},{\"id\":\"paypal\",\"name\":{\"en-GB\":\"PayPal\",\"de-DE\":\"PayPal\",\"pl-PL\":\"PayPal\"},\"description\":{\"en-GB\":\"\",\"de-DE\":\"\",\"pl-PL\":\"\"},\"image\":\"https://www.mollie.com/external/icons/payment-methods/paypal.svg\",\"order\":0},{\"id\":\"ideal\",\"name\":{\"en-GB\":\"iDEAL\",\"de-DE\":\"iDEAL\",\"pl-PL\":\"iDEAL\"},\"description\":{\"en-GB\":\"\",\"de-DE\":\"\",\"pl-PL\":\"\"},\"image\":\"https://www.mollie.com/external/icons/payment-methods/ideal.svg\",\"order\":0},{\"id\":\"bancontact\",\"name\":{\"en-GB\":\"Bancontact\",\"de-DE\":\"Bancontact\",\"pl-PL\":\"Bancontact\"},\"description\":{\"en-GB\":\"\",\"de-DE\":\"\",\"pl-PL\":\"\"},\"image\":\"https://www.mollie.com/external/icons/payment-methods/bancontact.svg\",\"order\":0},{\"id\":\"kbc\",\"name\":{\"en-GB\":\"KBC/CBC Payment Button\",\"de-DE\":\"KBC/CBC Payment Button\",\"pl-PL\":\"KBC/CBC Payment Button\"},\"description\":{\"en-GB\":\"\",\"de-DE\":\"\",\"pl-PL\":\"\"},\"image\":\"https://www.mollie.com/external/icons/payment-methods/kbc.svg\",\"order\":0}]}"
}
]
}
]
"actions": [
{
"action": "setCustomField",
"name": "sctm_payment_methods_response",
"value": "{\"count\":11,\"methods\":[{\"resource\":\"method\",\"id\":\"applepay\",\"description\":\"Apple Pay\",\"minimumAmount\":{\"value\":\"0.01\",\"currency\":\"EUR\"},\"maximumAmount\":{\"value\":\"10000.00\",\"currency\":\"EUR\"},\"image\":{\"size1x\":\"https://www.mollie.com/external/icons/payment-methods/applepay.png\",\"size2x\":\"https://www.mollie.com/external/icons/payment-methods/applepay%402x.png\",\"svg\":\"https://www.mollie.com/external/icons/payment-methods/applepay.svg\"},\"status\":\"activated\",\"_links\":{\"self\":{\"href\":\"https://api.mollie.com/v2/methods/applepay\",\"type\":\"application/hal+json\"}}},{\"resource\":\"method\",\"id\":\"creditcard\",\"description\":\"Karte\",\"minimumAmount\":{\"value\":\"0.01\",\"currency\":\"EUR\"},\"maximumAmount\":{\"value\":\"10000.00\",\"currency\":\"EUR\"},\"image\":{\"size1x\":\"https://www.mollie.com/external/icons/payment-methods/creditcard.png\",\"size2x\":\"https://www.mollie.com/external/icons/payment-methods/creditcard%402x.png\",\"svg\":\"https://www.mollie.com/external/icons/payment-methods/creditcard.svg\"},\"status\":\"activated\",\"_links\":{\"self\":{\"href\":\"https://api.mollie.com/v2/methods/creditcard\",\"type\":\"application/hal+json\"}}},{\"resource\":\"method\",\"id\":\"paypal\",\"description\":\"PayPal\",\"minimumAmount\":{\"value\":\"0.01\",\"currency\":\"EUR\"},\"maximumAmount\":null,\"image\":{\"size1x\":\"https://www.mollie.com/external/icons/payment-methods/paypal.png\",\"size2x\":\"https://www.mollie.com/external/icons/payment-methods/paypal%402x.png\",\"svg\":\"https://www.mollie.com/external/icons/payment-methods/paypal.svg\"},\"status\":\"activated\",\"_links\":{\"self\":{\"href\":\"https://api.mollie.com/v2/methods/paypal\",\"type\":\"application/hal+json\"}}},{\"resource\":\"method\",\"id\":\"banktransfer\",\"description\":\"Überweisung\",\"minimumAmount\":{\"value\":\"0.01\",\"currency\":\"EUR\"},\"maximumAmount\":{\"value\":\"1000000.00\",\"currency\":\"EUR\"},\"image\":{\"size1x\":\"https://www.mollie.com/external/icons/payment-methods/banktransfer.png\",\"size2x\":\"https://www.mollie.com/external/icons/payment-methods/banktransfer%402x.png\",\"svg\":\"https://www.mollie.com/external/icons/payment-methods/banktransfer.svg\"},\"status\":\"activated\",\"_links\":{\"self\":{\"href\":\"https://api.mollie.com/v2/methods/banktransfer\",\"type\":\"application/hal+json\"}}},{\"resource\":\"method\",\"id\":\"ideal\",\"description\":\"iDEAL\",\"minimumAmount\":{\"value\":\"0.01\",\"currency\":\"EUR\"},\"maximumAmount\":{\"value\":\"50000.00\",\"currency\":\"EUR\"},\"image\":{\"size1x\":\"https://www.mollie.com/external/icons/payment-methods/ideal.png\",\"size2x\":\"https://www.mollie.com/external/icons/payment-methods/ideal%402x.png\",\"svg\":\"https://www.mollie.com/external/icons/payment-methods/ideal.svg\"},\"status\":\"activated\",\"_links\":{\"self\":{\"href\":\"https://api.mollie.com/v2/methods/ideal\",\"type\":\"application/hal+json\"}}},{\"resource\":\"method\",\"id\":\"bancontact\",\"description\":\"Bancontact\",\"minimumAmount\":{\"value\":\"0.02\",\"currency\":\"EUR\"},\"maximumAmount\":{\"value\":\"50000.00\",\"currency\":\"EUR\"},\"image\":{\"size1x\":\"https://www.mollie.com/external/icons/payment-methods/bancontact.png\",\"size2x\":\"https://www.mollie.com/external/icons/payment-methods/bancontact%402x.png\",\"svg\":\"https://www.mollie.com/external/icons/payment-methods/bancontact.svg\"},\"status\":\"activated\",\"_links\":{\"self\":{\"href\":\"https://api.mollie.com/v2/methods/bancontact\",\"type\":\"application/hal+json\"}}},{\"resource\":\"method\",\"id\":\"eps\",\"description\":\"eps\",\"minimumAmount\":{\"value\":\"1.00\",\"currency\":\"EUR\"},\"maximumAmount\":{\"value\":\"50000.00\",\"currency\":\"EUR\"},\"image\":{\"size1x\":\"https://www.mollie.com/external/icons/payment-methods/eps.png\",\"size2x\":\"https://www.mollie.com/external/icons/payment-methods/eps%402x.png\",\"svg\":\"https://www.mollie.com/external/icons/payment-methods/eps.svg\"},\"status\":\"activated\",\"_links\":{\"self\":{\"href\":\"https://api.mollie.com/v2/methods/eps\",\"type\":\"application/hal+json\"}}},{\"resource\":\"method\",\"id\":\"przelewy24\",\"description\":\"Przelewy24\",\"minimumAmount\":{\"value\":\"0.01\",\"currency\":\"EUR\"},\"maximumAmount\":{\"value\":\"12815.00\",\"currency\":\"EUR\"},\"image\":{\"size1x\":\"https://www.mollie.com/external/icons/payment-methods/przelewy24.png\",\"size2x\":\"https://www.mollie.com/external/icons/payment-methods/przelewy24%402x.png\",\"svg\":\"https://www.mollie.com/external/icons/payment-methods/przelewy24.svg\"},\"status\":\"activated\",\"_links\":{\"self\":{\"href\":\"https://api.mollie.com/v2/methods/przelewy24\",\"type\":\"application/hal+json\"}}},{\"resource\":\"method\",\"id\":\"kbc\",\"description\":\"KBC/CBC Zahlungsbutton\",\"minimumAmount\":{\"value\":\"0.01\",\"currency\":\"EUR\"},\"maximumAmount\":{\"value\":\"50000.00\",\"currency\":\"EUR\"},\"image\":{\"size1x\":\"https://www.mollie.com/external/icons/payment-methods/kbc.png\",\"size2x\":\"https://www.mollie.com/external/icons/payment-methods/kbc%402x.png\",\"svg\":\"https://www.mollie.com/external/icons/payment-methods/kbc.svg\"},\"status\":\"activated\",\"_links\":{\"self\":{\"href\":\"https://api.mollie.com/v2/methods/kbc\",\"type\":\"application/hal+json\"}}},{\"resource\":\"method\",\"id\":\"belfius\",\"description\":\"Belfius Pay Button\",\"minimumAmount\":{\"value\":\"0.01\",\"currency\":\"EUR\"},\"maximumAmount\":{\"value\":\"50000.00\",\"currency\":\"EUR\"},\"image\":{\"size1x\":\"https://www.mollie.com/external/icons/payment-methods/belfius.png\",\"size2x\":\"https://www.mollie.com/external/icons/payment-methods/belfius%402x.png\",\"svg\":\"https://www.mollie.com/external/icons/payment-methods/belfius.svg\"},\"status\":\"activated\",\"_links\":{\"self\":{\"href\":\"https://api.mollie.com/v2/methods/belfius\",\"type\":\"application/hal+json\"}}},{\"resource\":\"method\",\"id\":\"bancomatpay\",\"description\":\"Bancomat Pay\",\"minimumAmount\":{\"value\":\"0.01\",\"currency\":\"EUR\"},\"maximumAmount\":{\"value\":\"50000.00\",\"currency\":\"EUR\"},\"image\":{\"size1x\":\"https://www.mollie.com/external/icons/payment-methods/bancomatpay.png\",\"size2x\":\"https://www.mollie.com/external/icons/payment-methods/bancomatpay%402x.png\",\"svg\":\"https://www.mollie.com/external/icons/payment-methods/bancomatpay.svg\"},\"status\":\"activated\",\"_links\":{\"self\":{\"href\":\"https://api.mollie.com/v2/methods/bancomatpay\",\"type\":\"application/hal+json\"}}}]}"
},
{
"action": "setCustomField",
"name": "sctm_mollie_profile_id",
"value": "pfl_SPkYGiEQjf"
}
]
}
```
35 changes: 35 additions & 0 deletions docs/contribution/ContributionGuidelines.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Contribution Guide

* [Prerequisites](#prerequisites)
* [Development](#development)

## Prerequisites

To merge your changes, your commits must be [signed](https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits).

Minimum requirements are:
- **Node.js** version 18
- **Npm** npm v10.7.0
- **Bash** shell
- **Signed** git commits

You can install all dependencies using `npm` with following command:

```
npm install
```

## Development
While developing project you can use some predefined commands for running tests, running linter or generating coverage.

- Execute `npm run test` to run all tests.
- Execute `npm run lint` to show lint errors in the code.

## Release procedure
At the moment there is no automated release scripts, which means we do releases manually. We use [gitflow workflow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) for releases. Please **squash commits when finishing the feature branch**, this way we can keep relatively clean history on develop and main.

Contributing by following these steps:

1. Create and check out a new branch off main and make your necessary change here. The branch name should have a specific prefix depends on the purpose, e.g: `bugfix/`, `feat/`
2. Bump [version](https://semver.org/) on npm package (in /processor). Commit changes on the above branch.
3. Create PR and wait for the approval from the development team.
26 changes: 26 additions & 0 deletions docs/contribution/IssueTemplate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Issue Template

**Deployment**
_My deployment is on:_

- [ ] Docker
- [ ] AWS Lambda
- [ ] GCP
- [ ] Azure
- [ ] Other _Please specify:_

**Expected behaviour**

_Please explain what should happen._

**Actual behaviour**

_Please explain what is happening instead. Provide a log message if relevant._

**Attempted fixes**

_Please explain what you've done so far to try and fix the problem._

**Please provide more information about how this can be reproduced. Please include jsfiddle links, code snippets or any other necessary information**

_Include extra info here._
2 changes: 2 additions & 0 deletions processor/.env.jest
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ CTP_CLIENT_SECRET=12345678901234567890123456789012
CTP_PROJECT_KEY=TEST
CTP_SCOPE=TEST
CTP_REGION=europe-west1.gcp
CTP_AUTH_URL=https://auth.europe-west1.gcp.commercetools.com
AUTHENTICATION_MODE=0
CTP_SESSION_AUDIENCE=https://mc.europe-west1.gcp.commercetools.com
CTP_SESSION_ISSUER=gcp-eu

## MOLLIE vars
MOLLIE_PROFILE_ID=pfl_12345
DEBUG=0
Expand Down
2 changes: 1 addition & 1 deletion processor/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ module.exports = {
setupFiles: ['<rootDir>/src/jest.setup.ts'],
setupFilesAfterEnv: ['<rootDir>/src/jest.setupAfterEnv.ts'],
modulePathIgnorePatterns: ['<rootDir>/src/jest.setup.ts'],
reporters: ['default', 'jest-junit'],
reporters: ['default', 'jest-junit']
};
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.2.0-alpha25.11.24.1241",
"version": "1.2.0-build23.12.24.1536",
"main": "index.js",
"private": true,
"scripts": {
Expand Down
Loading

0 comments on commit 17b9bf5

Please sign in to comment.