Skip to content

Commit

Permalink
Merge branch 'main' into release/v1.2.0-resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
tdang1-shopmacher committed Dec 3, 2024
2 parents 997903f + 8055001 commit 2929922
Show file tree
Hide file tree
Showing 30 changed files with 326 additions and 757 deletions.
51 changes: 1 addition & 50 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,67 +4,18 @@ 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.0-alpha

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
## v1.0.4

Added

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

## v1.1.1

Fixes

- Type converting issue in payment method listing endpoint

## v1.1.0

Added

- DockerImage for self hosting on AWS
- Installation endpoint for required configurations

## v1.0.3

Added

- Add docs for status checking endpoint
- Endpoints for checking connector statuses

## v1.0.2

Expand Down
29 changes: 5 additions & 24 deletions connect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@ deployAs:
description: Commercetools Composable Commerce API region
required: true
default: "europe-west1.gcp"
- key: CTP_AUTH_URL
description: Commercetools Auth URL
default: https://auth.europe-west1.gcp.commercetools.com
required: true
- key: MOLLIE_CARD_COMPONENT
description: Enable Mollie card component (0 or 1)
description: Enable Mollie cart component (0 or 1)
required: false
default: "0"
- key: CONNECTOR_MODE
Expand Down Expand Up @@ -52,26 +56,3 @@ deployAs:
- key: CTP_SCOPE
description: Commercetools Composable Commerce client scope
required: true
- key: CTP_SESSION_AUDIENCE
description: Commercetools Composable Commerce client session audience. The value should only contain the origin URL (protocol, hostname, port).
required: true
- key: CTP_SESSION_ISSUER
description: Commercetools Composable Commerce client session issuer. The cloud identifier that maps to the MC API URL of the related cloud region or the MC API URL.
required: true

- name: application
applicationType: merchant-center-custom-application
scripts:
postDeploy: yarn install && yarn build
preUndeploy: yarn install && yarn build
configuration:
standardConfiguration:
- key: CUSTOM_APPLICATION_ID
description: The Custom Application ID
required: true
- key: CLOUD_IDENTIFIER
description: The cloud identifier
default: 'gcp-eu'
- key: ENTRY_POINT_URI_PATH
description: The Application entry point URI path
required: true
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
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._
10 changes: 0 additions & 10 deletions processor/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ AUTHENTICATION_MODE=<YOUR_AUTHENTICATION_MODE>
CTP_AUTH_URL=https://auth.<YOUR_CTP_REGION>.commercetools.com
CTP_API_URL=https://api.<YOUR_CTP_REGION>.commercetools.com

## CT Session Middleware options
### The public-facing URL used to connect to the server / serverless function.
### The value should only contain the origin URL (protocol, hostname, port),
### the request path is inferred from the incoming request.
CTP_SESSION_AUDIENCE=https://mc.<YOUR_CTP_REGION>.commercetools.com
### The cloud identifier (see `CLOUD_IDENTIFIERS`) that maps to the MC API URL
### of the related cloud region or the MC API URL
### e.g. gcp-eu
CTP_SESSION_ISSUER=gcp-eu

## Mollie PSP credentials
DEBUG=<INTEGER_VALUE> ## Either 1 for enable or 0 for disable
CONNECTOR_MODE=<YOUR_CONNECTOR_MODE> ## Either test or live
Expand Down
3 changes: 1 addition & 2 deletions processor/.env.jest
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ 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']
};
Loading

0 comments on commit 2929922

Please sign in to comment.