Skip to content

adhiva/go-shopeepay-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-shopeepay-wrapper

A package for shopeepay wrapper client.

Installation

Make sure that Go is installed on your computer. Type the following command in your terminal:

go get github.com/adhiva/go-shopeepay-wrapper

After it the package is ready to use.

Import package in your project

Add following line in your *.go file:

import "github.com/adhiva/go-shopeepay-wrapper"

If you are unhappy to use long go-shopeepay-wrapper, you can do something like this:

import (
  shopeepay "github.com/adhiva/go-shopeepay-wrapper"
)

List of wrapper shopeepay client:

func GenerateQRCode(req *RequestCharge) (ResponseCharge, error)
func GenerateDeeplink(req *RequestCharge) (ResponseCharge, error)
func CheckPaymentStatus(req *RequestGeneral) (ResponseCharge, error)
func InvalidateQRCode(req *RequestCharge) (ResponseCharge, error)

Examples

GenerateQRCode
func init() {
	shopeePayClient = shopeepay.NewClient()
	shopeePayClient.ClientID = config.Config.ShopeePay.ClientID
	shopeePayClient.ClientSecret = config.Config.ShopeePay.ClientSecret
	shopeePayClient.MerchantExtID = config.Config.ShopeePay.MerchantExtID
	shopeePayClient.StoreExtID = config.Config.ShopeePay.StoreExtID
	shopeePayClient.APIEnvRegion = shopeepay.ID // Use this accordance your region, shopeepay is available in Indonesia, Singapore, Philippines, and Malaysia

	if config.Config.ShopeePay.ENV == "production" {
		shopeePayClient.APIEnvType = shopeepay.Production
	} else {
		shopeePayClient.APIEnvType = shopeepay.Sandbox
	}

	coreGateway = shopeepay.CoreGateway{
		Client: shopeePayClient,
	}
}

func ShopeePayCharge(request *shopeepay.RequestCharge) (*shopeepay.ResponseCharge, error) {
	var (
		resp shopeepay.ResponseCharge
		err  error
	)

	resp, err = coreGateway.GenerateQRCode(request)

	if err != nil {
		return nil, err
    }
    
	return &resp, nil
}

Support

If you do have a contribution to the package, feel free to create a Pull Request or an Issue.

What to contribute

If you don't know what to do, there are some features and functions that need to be done

  • Create a Transaction List
  • Create a Transaction Void
  • Create a Refund Transaction

Advice

Feel free to create what you want, but keep in mind when you implement new features:

  • Code must be clear and readable, names of variables/constants clearly describes what they are doing
  • Wrapper they are created must be documented and described in source file and added to README.md to the list of wrapper shopeepay client

Contributors

About

This is library wrapper shopeepay API using Golang

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages