Giter Club home page Giter Club logo

paymentsvc's Introduction

About

This service handle SCB internet banking payment by using Omise as a payment gateway.

Setup

Create .env file by the running command below then edit Omise's credentials.

cp .env.example .env

Run the app

Start the service on port 8080 (or set it via PORT variable).

make run

Run unit tests

make test

Build docker image

make docker-build

Run docker container

docker run --env-file .env -p 8080:8080 paymentsvc

Demo

Create a new payment request.

# Create a payment request of 2000 Satangs (20 THB)
curl -X POST http://localhost:8080/payments -d \
'{
    "amount": 2000,
    "currency": "THB",
    "return_uri": "https://example.com",
    "source_type": "internet_banking_scb"
}'

Response

{
    "id": 1,
    "authorized_uri": "https://pay.omise.co/offsites/ofsp_test_5mtr3e40dnsray0sxuk/pay"
}

Open a link in the authorized_uri field on the web browser then proceed to approve or reject the payment. The web browser will redirect to the return_uri specify on the first request.

Get the payment result.

# This will get a result of the payment with payment id = 1
curl http://localhost:8080/payments/1

Response

{
    "id": 1,
    "status": "successful",
    "amount": 2000,
    "currency": "THB",
    "source_type": "internet_banking_scb",
    "created_at": "2021-02-11T03:16:43.047466+07:00",
    "updated_at": "2021-02-11T03:33:29.65266+07:00"
}

paymentsvc's People

Contributors

noppawitt avatar

Stargazers

 avatar

Watchers

 avatar  avatar

paymentsvc's Issues

payment status is always `pending`

Steps:

  1. create a new payment
  2. make the payment accept or decline
  3. query payment status

Observed:
payment status always return as pending

Expected:
payment status should be marked as successful or failed

Get certificate error when run in docker

steps:

  1. run service in docker
  2. create a new payment

onbserved:

{
    "message": "Post \"https://api.omise.co/sources\": x509: certificate signed by unknown authority"
}

expected:
able to create a new payment

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.