qoin

package module
v0.0.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2020 License: MIT Imports: 14 Imported by: 0

README

Qoin-Go

Installation

go get github.com/Qoin-Digital-Indonesia/qoin-go

Usage

Transaction Description Example
import "encoding/json"

type DescriptionDetail struct {
	Item   uint8
	Desc   string
	Amount float32
}

type Description struct {
	Objects []DescriptionDetail
}

var description Description
description.Objects = make([]DescriptionDetail, 0)
description.Objects = append(description.Objects, DescriptionDetail{1, "T-Shirt", 15000})
description.Objects = append(description.Objects, DescriptionDetail{2, "Admin", 5000})
description.Objects = append(description.Objects, DescriptionDetail{3, "Shipping", 1000})
descriptionJSON, err := json.Marshal(description.Objects)
1. BRI VA
a. Create Order
import "github.com/Qoin-Digital-Indonesia/qoin-go"

var body = map[string]interface{}{
    "MerchantNumber":  "<your merchant code>",
    "ReferenceNumber": "<reference number>",
    "Amount":          21000,
    "Currency":        "IDR",
    "Description":     string(descriptionJSON),
    "UserName":        "Giovanni Reinard",
    "UserContact":     "628123456789;giovanni@qoin.id", // format: phone_number;email_address
    "RequestTime":     time.Now().Format("2006-01-02 15:04:05"),
}

qoin.SetEnvironment("sandbox") // sandbox || production
qoin.SetPrivateKey(`<your private key>`) // must use back quote (`) symbol
qoin.SetSecretKey("<your secret key>")
response := qoin.BriVaCreateOrder(body)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BriVaCreateOrder added in v0.0.2

func BriVaCreateOrder(body map[string]interface{}) map[string]interface{}

BriVaCreateOrder returns the response from BRI VA Create Order API

func BriVaGetStatus added in v0.0.9

func BriVaGetStatus(body map[string]string) map[string]interface{}

BriVaGetStatus returns the response from BRI VA Get Status API

func SetEnvironment added in v0.0.2

func SetEnvironment(environment string)

SetEnvironment set the API environment

func SetPrivateKey added in v0.0.3

func SetPrivateKey(privKey string)

SetPrivateKey set the private key for generate signature

func SetReferenceNumber added in v0.0.3

func SetReferenceNumber(refNumber string)

SetReferenceNumber set the reference number for generate signature

func SetSecretKey added in v0.0.3

func SetSecretKey(secKey string)

SetSecretKey set the secret key for generate signature

Types

type Signer added in v0.0.4

type Signer interface {
	Sign(data []byte) ([]byte, error)
}

Signer can create signatures that verify against a public key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL