durianpay

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: GPL-3.0 Imports: 7 Imported by: 0

README ยถ

Durianpay SDK for Golang (Unofficial)

๐Ÿง Project Philosophy

Durianpay is a Payment Gateway that can be used in Indonesia with the support of many payment methods such as VA, Bank Transfer, EWallet, Bank Transfer, Credit Card, and of course PayLater. Not only that, to get to Go Live the process is very easy.

But it's a shame, besides the API that can be used but there is no Official SDK that has been created and supported by Durianpay, this greatly adds to the workload when you want to use Golang as a language that will be integrated with Durianpay

๐Ÿ“’ Official Documentation

All of API Documentation is on the Official Website of Durian Pay https://durianpay.id/docs/api/.

โš ๏ธ API documentation is subject to change without notice, so this SDK may not work properly.

๐Ÿš€ Installation

$ go get github.com/iqbal-maxiapp/durianpay-go-sdk

Usage

package main

import (
    "github.com/iqbal-maxiapp/durianpay-go-sdk"
    "github.com/iqbal-maxiapp/durianpay-go-sdk/common"
)

... 
func main() {
  dp = durianpay.NewClient(&common.ClientConfig{
    Mode: common.SANDBOX, // SANBOX or LIVE
    ApiKey: "xxx",
    EnableLogging: true,
  })
}

๐Ÿ‘จโ€๐Ÿ’ป Library Usage

Here's a brief high-level overview of the Library uses:

๐ŸŒด Example

Create Order
import (
    "time"
    "github.com/iqbal-maxiapp/durianpay-go-sdk"
    "github.com/iqbal-maxiapp/durianpay-go-sdk/common"
    "github.com/iqbal-maxiapp/durianpay-go-sdk/modules/order"
)

...

  payload := &order.CreateOrderRequestPayload{
    Amount: "100000",
    Currency: "IDR",
    ExpiryDate: time.Now().Add(time.Hour + time.Duration(24)),
    OrderRefID: "INV/ORDER/xxxxx1",
    PaymentOption: "full_payment",
    Metadata: order.Metadata{},
    Items: []order.Items{
      {
        Name: "Soap",
        Qty: 1,
        Price: "100000",
        Logo: "",
      },
    },
    Customer: order.Customer{
      CustomerRefID: "CUS/xx1" ,
      GivenName: "Ayat Maulana",
      Email: "[email protected]",
      Mobile: "0812345678",
      Address: order.Address{
        ReceiverName: "Hehe",
        ReceiverPhone: "0812345678",
      },
    },
  }

  res, err := dp.Order.CreateOrder(context.TODO(), payload)
  if err != nil {
    // handle error
    log.Println(err)
  }
Create Payment
  ctx := context.TODO()
  res, err := dp.Payment.ChargePaymentVA(ctx, &payment.ChargePaymentVARequestPayload{
    OrderID: orderId,
    Amount: "100000",
    BankCode: payment.BCA,
    Name: "Ayat Maulana",
  }, &payment.SandboxOption{
    ForceFail: true,
  })

Use with Context
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(time.Millisecond * 10))
defer cancel()

res, err := dp.Disbursement.FetchBankList(ctx)
if err != nil {
  log.Println(err)
}
log.Println(res)

๐Ÿ“ Todo

  • API Integration
    • Order
    • Payment
      • Virtual Account
      • Online Bank
      • EWallet
      • QRIS
      • EWallet
      • Retail Store (ALFAMART/INDOMARET)
      • Online Card
      • Buy Now Pay Later (BNPL)
      • BCA Aggregator
    • Promo
    • Disbursement
    • Settlement
    • Refund
    • Subscription
    • EWallet Account
    • Customer
    • Static VA
  • Testing
  • Documentation per module

โœ๏ธ Contributing

Interested in contributing to this project? Thanks so much for your interest! We are always looking for improvements to the project and contributions from open-source developers are greatly appreciated.

If you have a contribution in mind, just fork this repository, follow code guide and make pull request in main repository.

๐Ÿ“ƒ License

The Well app is free and open-source software licensed under the GNU General Public License v3.0.

Documentation ยถ

Index ยถ

Constants ยถ

This section is empty.

Variables ยถ

This section is empty.

Functions ยถ

This section is empty.

Types ยถ

type Modules ยถ

type Modules struct {
	Disbursement disbursement.Disbursement
	Order        order.Order
	Payment      payment.Payment
	Promo        promo.Promo
	Settlement   settlement.Settlement
	Refund       refund.Refund
}

func NewClient ยถ

func NewClient(config *common.ClientConfig) *Modules

Directories ยถ

Path Synopsis
modules

Jump to

Keyboard shortcuts

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