A package for shopeepay wrapper client.
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.
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"
)
func GenerateQRCode(req *RequestCharge) (ResponseCharge, error)
func GenerateDeeplink(req *RequestCharge) (ResponseCharge, error)
func CheckPaymentStatus(req *RequestGeneral) (ResponseCharge, error)
func InvalidateQRCode(req *RequestCharge) (ResponseCharge, error)
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
}
If you do have a contribution to the package, feel free to create a Pull Request or an Issue.
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
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