Sign inSign up

berlingskemedia/bm.ms.payment_manager

By berlingskemedia

•Updated about 3 years ago

Image
0

50K+

berlingskemedia/bm.ms.payment_manager repository overview

⁠Payment manager microservice

Berlingske payment service supporting MobilePay and Dibs gateways

⁠Docker information

You need Docker Engine version 17.09.0 and higher.

⁠Install

Just simply use

npm install

⁠Start

To set all needed local environment variables please use docker-compose.override.yml. In docker-compose.override.yml.dist you can find list of all variables with example values.

To start application please write inside docker container:

npm start

or

npm run dev

for nodemon file watcher.

⁠Tests

We use Jest⁠ for testing our application. To run both the unit and functional tests use the following command.

npm t

You can also run the tests in watch mode

npm run test:watch

Since Jest provides an easy way for filtering tests it runs, we don't have any explicit npm script commands.

Instead you can use the following to run just unit tests:

npm run test -- unit
⁠Code coverage

You can generate code coverage in html format using

npm run test:coverage

The output will be in tests/coverage folder.

⁠Environment variables

Service uses these env vars:

  • NODE_ENV:
    • dev
    • testing
    • staging
    • production
  • SERVER_EXTERNAL_URL - is the URL that the server exposes for callbacks from FarPay.
  • BOOM_LOG_JSON - 1 to log the messages in JSON.
  • BOOM_LOG_INPUT - 1 to log all the input data on errors.
⁠Service
  • PORT
  • HOST
  • NODE_ENV
⁠CORS SETTINGS
⁠BPC
  • BPC_APP_ID - BPC application name/id
  • BPC_APP_KEY - BPC application key
  • BPC_URL
  • BPC_ALGORITHM
⁠FarPay
  • FARPAY_API_URL
  • FARPAY_API_KEY
  • FARPAY_LOG_REQUEST
⁠Gigya
  • GIGYA_HOSTNAME
  • GIGYA_APP_KEY
  • GIGYA_SECRET
⁠Purchase flows

Environment variables:

  • PURCHASE_CACHE_TIME - default cache time in seconds for orders.
  • PURCHASE_TEMP_PERMISSIONS_TTL - time for the temporary permissions to live on the BPC end, in seconds, 1 hour by default
⁠Mongo

actiontoken collection has 2 indexes, one is ttl index:

await MongoDB.collection('actiontoken').createIndex({ token: 1 }, { unique: true });
await MongoDB.collection('actiontoken').createIndex({ updated: 1 }, { expireAfterSeconds: purchaseConfig.purchaseCacheTime });

orders collection has one ttl index:

await MongoDB.collection('orders').createIndex({ changedAt: 1 }, { expireAfterSeconds: 30 * 86400 });

Tag summary

Content type

Image

Digest

sha256:c56ab96d2…

Size

65.5 MB

Last updated

about 3 years ago

docker pull berlingskemedia/bm.ms.payment_manager