This library crated for simplify your code to use Indodana Payment Method API.
Make sure that Go is installed on your computer. Type the following command in your terminal:
go get github.com/adhiva/go-indodana-wrapper
After it the package is ready to use.
Add following line in your *.go
file:
import "github.com/adhiva/go-indodana-wrapper"
If you are unhappy to use long go-indodana
, you can do something like this:
import (
indodana "github.com/adhiva/go-indodana-wrapper"
)
func GetInstallment(req *RequestGetInstallment) (ResponseGetInstallment, error)
func CheckStatus(req *RequestCheckStatus) (ResponseCheckStatus, error)
func CheckoutPayment(req *RequestCheckoutPayment) (ResponseCheckoutPayment, error)
func init() {
indodanaClient = indodana.NewClient()
indodanaClient.APIKey = config.Config.Indodana.APIKey
indodanaClient.SecretKey = config.Config.Indodana.SecretKey
if config.Config.Indodana.ENV == "production" {
indodanaClient.APIEnvType = indodana.Production
} else {
indodanaClient.APIEnvType = indodana.Sandbox
}
coreGateway = indodana.CoreGateway{
Client: indodanaClient,
}
}
func GetInstallment(request *indodana.RequestGetInstallment) (*indodana.ResponseGetInstallment, error) {
var (
resp *indodana.ResponseCharge
err error
)
resp, err = coreGateway.GetInstallment(request)
if err != nil {
return nil, err
}
return resp, nil
}
func CheckoutPayment(request *indodana.RequestCheckoutPayment) (*indodana.ResponseCheckoutPayment, error) {
var (
resp *indodana.ResponseCheckoutPayment
err error
)
// Generate deeplink for apps and mobile-web only
resp, err = coreGateway.CheckoutPayment(request)
if err != nil {
return nil, err
}
return resp, nil
}
func CheckStatus(merchantOrderID string) (*indodana.ResponseCheckStatus, error) {
var (
request *indodana.RequestCheckStatus
resp *indodana.ResponseCheckStatus
err error
)
request.MerchantOrderId = merchantOrderID
// Generate deeplink for apps and mobile-web only
resp, err = coreGateway.CheckStatus(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
- Cancel Refund Transaction
- Get Installment
- Checkout Payment
- Check Status
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 indodana client