athlan / payment-service

Payment Processing Microservice

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Payment Service

This service handles payment registration, processing and puhing notification back to originator system.

It's using Omnipay on top making service configurable with multiple vendors of gateways interacting with unified API.

Service is exposed via REST API and broacasting notification events on queue sytems using Enqueue.

Flow

  1. Payment is Registered first by originator system specifying: amount, currency, description, payment type (transfer).

    Originator system calls POST /api/payment

    Payment service returns paymentId and processing url to redirect user to process payment.

  2. Payment is Processed by gateway.

    User is redirected to processing url.

    Payment Service redirects user to vendor gateway where user does the payment.

    After that user is redirected back to originator service where waits payment to be completed.

  3. Once vendor gateway received the payment and calling back Payment Service, event is broadcast over messaging system and originator system can mark paymentId as completed.

Assumptions

  • Payment Service is responsible for doing payments using gateway vendors and do a notification after payment completion or failure.
  • Payment Service have no knowledge about content of the client's order for that payment is beeing done. Thus originator system need to store that information and correlate with paymentId. After payment is completed originator system completed order it ships or activates products.

Supportability

Manual interventions

Marking payment as completed success or failed

This manual intervention simulates callback from vendor gateway. Marks payment being IN_PROCESS state as COMPLETED if completion of payment couldn't be achieved. It also sends notification back to source systems.

bin/console app:payment:complete:success PAYMENT_ID -a AUTHOR -m INTERVENTION_REASON

To mark completion as failed use:

bin/console app:payment:complete:failure PAYMENT_ID -a AUTHOR -m INTERVENTION_REASON
Sending notification about payment completion

This manual intervention resents notification to source systems about completion of the payment. Payment needs to be in completed status. It's useful when payment has been completed, however sending notification failed.

bin/console app:payment:complete:success:notification PAYMENT_ID

To mark completion as failed use:

bin/console app:payment:complete:failure:notification PAYMENT_ID

Development

To setup development environment, run Docker Compose:

make
make start

Build and publish

./bin/build.sh
./bin/publish.sh

About

Payment Processing Microservice


Languages

Language:PHP 79.9%Language:Makefile 9.6%Language:Dockerfile 8.5%Language:Shell 1.3%Language:HTML 0.6%