aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile4
-rw-r--r--account_link.go17
-rw-r--r--address.go4
-rw-r--r--bank.go1
-rw-r--r--clearing_inquiry.go2
-rw-r--r--client.go7
-rw-r--r--customer_detail.go4
-rw-r--r--duitku.go20
-rw-r--r--inquiry_status.go4
-rw-r--r--inquiry_status_response.go1
-rw-r--r--item_detail.go5
-rw-r--r--merchant.go10
-rw-r--r--payment_fee.go4
-rw-r--r--payment_status.go2
-rw-r--r--request.go2
-rw-r--r--rtol_inquiry.go2
16 files changed, 51 insertions, 38 deletions
diff --git a/Makefile b/Makefile
index edbed29..49e4995 100644
--- a/Makefile
+++ b/Makefile
@@ -14,5 +14,5 @@ test:
go tool cover -func=$(COVER_OUT) | tail -n1
lint:
- golangci-lint run ./...
- fieldalignment ./...
+ -revive ./...
+ -fieldalignment ./...
diff --git a/account_link.go b/account_link.go
index b5b8ed4..fa0f733 100644
--- a/account_link.go
+++ b/account_link.go
@@ -3,10 +3,10 @@
package duitku
-// [AccountLink] Parameter for payment methods that use OVO Account Link and
-// Shopee Account Link.
+// AccountLink Parameter for payment methods that use OVO or Shopee
+// [account link].
//
-// [AccountLink]: https://docs.duitku.com/api/en/#account-link
+// [account link]: https://docs.duitku.com/api/en/#account-link
type AccountLink struct {
// [REQ] Credential Code provide by Duitku.
CredentialCode string `json:"credentialCode"`
@@ -18,13 +18,14 @@ type AccountLink struct {
Shopee AccountLinkShopee `json:"shopee"`
}
+// AccountLinkOvo account link information with [OVO].
+//
+// [OVO]: https://docs.duitku.com/api/en/#ovo-detail
type AccountLinkOvo struct {
PaymentDetails []OvoPaymentDetail `json:"paymentDetails"`
}
-// [AccountLinkOvo] payment detail with OVO.
-//
-// [AccountLinkOvo]: https://docs.duitku.com/api/en/#ovo-detail
+// OvoPaymentDetail payment detail for account link OVO.
type OvoPaymentDetail struct {
// [REQ] Type of your payment.
PaymentType string `json:"paymentType"`
@@ -33,9 +34,9 @@ type OvoPaymentDetail struct {
Amount int64 `json:"amount"`
}
-// [AccountLinkShopee] payment detail with Shopee.
+// AccountLinkShopee payment detail with [Shopee].
//
-// [AccountLinkShopee]: https://docs.duitku.com/api/en/#shopee-detail
+// [Shopee]: https://docs.duitku.com/api/en/#shopee-detail
type AccountLinkShopee struct {
// [REQ] Voucher code.
PromoIDs string `json:"promo_ids"`
diff --git a/address.go b/address.go
index 825dab5..96a59de 100644
--- a/address.go
+++ b/address.go
@@ -3,9 +3,9 @@
package duitku
-// [Address] contains detailed address of customer.
+// Address contains detailed [address] of customer.
//
-// [Address]: https://docs.duitku.com/api/en/#address
+// [address]: https://docs.duitku.com/api/en/#address
type Address struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
diff --git a/bank.go b/bank.go
index 0112e4f..bc13df6 100644
--- a/bank.go
+++ b/bank.go
@@ -7,6 +7,7 @@ import (
"github.com/shuLhan/share/lib/math/big"
)
+// Bank contains bank information from response of ListBank.
type Bank struct {
MaxTransfer *big.Rat `json:"maxAmountTransfer"`
diff --git a/clearing_inquiry.go b/clearing_inquiry.go
index 88830b1..eaa0361 100644
--- a/clearing_inquiry.go
+++ b/clearing_inquiry.go
@@ -40,7 +40,7 @@ func (inq *ClearingInquiry) Sign(opts ClientOptions) {
plain = fmt.Sprintf(`%s%d%s%s%s%d%s%s`, inq.Email,
inq.Timestamp, inq.BankCode, inq.Type,
inq.BankAccount, inq.Amount, inq.Purpose, opts.DisburseApiKey)
- plainHash [sha256.Size]byte = sha256.Sum256([]byte(plain))
+ plainHash = sha256.Sum256([]byte(plain))
)
inq.Signature = hex.EncodeToString(plainHash[:])
}
diff --git a/client.go b/client.go
index 98ba946..d50fc45 100644
--- a/client.go
+++ b/client.go
@@ -42,6 +42,7 @@ const (
PathMerchantTransactionStatus = `/webapi/api/merchant/transactionStatus`
)
+// Client HTTP client for duitku disbursement and payment APIs.
type Client struct {
*libhttp.Client
@@ -247,7 +248,7 @@ func (cl *Client) ListBank() (banks []Bank, err error) {
// Sort the list by Code and then by Name in case code is equal.
sort.Slice(banks, func(x, y int) bool {
- var cmp int = strings.Compare(banks[x].Code, banks[y].Code)
+ var cmp = strings.Compare(banks[x].Code, banks[y].Code)
if cmp == -1 {
return true
}
@@ -322,9 +323,9 @@ func (cl *Client) MerchantPaymentMethod(req *PaymentMethod) (resp *PaymentMethod
return resp, nil
}
-// [MerchantPaymentStatus] get the status of payment from customer.
+// MerchantPaymentStatus get the [status of payment] from customer.
//
-// [MerchantPaymentStatus]: https://docs.duitku.com/api/en/#check-transaction
+// [status of payment]: https://docs.duitku.com/api/en/#check-transaction
func (cl *Client) MerchantPaymentStatus(req *PaymentStatus) (resp *PaymentStatusResponse, err error) {
var (
logp = `MerchantPaymentStatus`
diff --git a/customer_detail.go b/customer_detail.go
index 564651c..c486d24 100644
--- a/customer_detail.go
+++ b/customer_detail.go
@@ -3,9 +3,9 @@
package duitku
-// [CustomerDetail] detail of customer information for payment to merchant.
+// CustomerDetail detail of [customer] information for payment to merchant.
//
-// [CustomerDetail]: https://docs.duitku.com/api/en/#customer-detail
+// [customer]: https://docs.duitku.com/api/en/#customer-detail
type CustomerDetail struct {
FirstName string `json:"firstName"`
LastName string `json:"lastName"`
diff --git a/duitku.go b/duitku.go
index f95d28e..96f548d 100644
--- a/duitku.go
+++ b/duitku.go
@@ -9,6 +9,7 @@
// [duitku.com]: https://docs.duitku.com/disbursement/id/#langkah-awal
package duitku
+// List of duitku server URL for production and testing.
const (
ServerUrlLive = `https://passport.duitku.com`
ServerUrlSandbox = `https://sandbox.duitku.com`
@@ -17,29 +18,30 @@ const (
)
const (
- // LLG (Lalu Lintas Giro) is interbank transfer that cover more than
- // 130 bank in Indonesia.
+ // ClearingTypeLLG LLG (Lalu Lintas Giro) is interbank transfer that
+ // cover more than 130 bank in Indonesia.
// The maximal amount transfer is IDR 500.000.000.
// Transfer process follows the BI (Bank Indonesia) schedule, which is
// 8.00-15.00 on business days.
ClearingTypeLLG = `LLG`
- // RTGS (Real Time Gross Settlement) is interbank transfer that cover
- // more than 130 bank in Indonesia.
+ // ClearingTypeRTGS RTGS (Real Time Gross Settlement) is interbank transfer
+ // that cover more than 130 bank in Indonesia.
// The minimal amount transfer is IDR 100.000.000.
// Transfer process follows the BI (Bank Indonesia) schedule, which is
// 8.00-15.00 on business days.
ClearingTypeRTGS = `RTGS`
- // H2H (Bank Host to Host) Duitku Host to Host connection to bank, to
- // ensure direct connection and better reliability.
+ // ClearingTypeH2H (Bank Host to Host) Duitku Host to Host connection
+ // to bank, to ensure direct connection and better reliability.
// Currently only support 4 Major banks in Indonesia (BNI, BRI,
// Mandiri, Permata).
// Transfer schedule follows the schedule of each bank.
ClearingTypeH2H = `H2H`
- // BIFAST (Bank Indonesia Fast Payment) National retail payments that
- // can facilitate retail payments in real-time, safe, efficient, more
- // affordable service fees and available at any time (24/7).
+ // ClearingTypeBIFAST (Bank Indonesia Fast Payment) National retail
+ // payments that can facilitate retail payments in real-time, safe,
+ // efficient, more affordable service fees and available at any time
+ // (24/7).
ClearingTypeBIFAST = `BIFAST`
)
diff --git a/inquiry_status.go b/inquiry_status.go
index 28b5cf0..20d5ec9 100644
--- a/inquiry_status.go
+++ b/inquiry_status.go
@@ -24,8 +24,8 @@ func (inq *InquiryStatus) Sign(opts ClientOptions) {
inq.Email = opts.DisburseEmail
inq.Timestamp = time.Now().UnixMilli()
- var plain string = fmt.Sprintf(`%s%d%d%s`, inq.Email, inq.Timestamp, inq.DisburseID, opts.DisburseApiKey)
- var plainHash [sha256.Size]byte = sha256.Sum256([]byte(plain))
+ var plain = fmt.Sprintf(`%s%d%d%s`, inq.Email, inq.Timestamp, inq.DisburseID, opts.DisburseApiKey)
+ var plainHash = sha256.Sum256([]byte(plain))
inq.Signature = hex.EncodeToString(plainHash[:])
}
diff --git a/inquiry_status_response.go b/inquiry_status_response.go
index ced3f0e..c1ed166 100644
--- a/inquiry_status_response.go
+++ b/inquiry_status_response.go
@@ -5,6 +5,7 @@ package duitku
import "github.com/shuLhan/share/lib/math/big"
+// InquiryStatusResponse define response valeus from InquiryStatus.
type InquiryStatusResponse struct {
Response
diff --git a/item_detail.go b/item_detail.go
index 04a3525..149a301 100644
--- a/item_detail.go
+++ b/item_detail.go
@@ -3,9 +3,10 @@
package duitku
-// [ItemDetail] define the subset of product being payed during payment.
+// ItemDetail define the subset of [product detail] being payed during
+// payment.
//
-// [ItemDetail]: https://docs.duitku.com/api/en/#item-details
+// [product detail]: https://docs.duitku.com/api/en/#item-details
type ItemDetail struct {
// [REQ] Name of the item.
Name string `json:"name"`
diff --git a/merchant.go b/merchant.go
index 7d7d2c5..071d7ae 100644
--- a/merchant.go
+++ b/merchant.go
@@ -3,15 +3,17 @@
package duitku
+// Merchant the merchant configuration for payment.
+//
+// You can get the values of Merchant from project you registered on the
+// [merchant portal].
+//
+// [merchant portal]: https://passport.duitku.com/merchant/Project
type Merchant struct {
// The merchant code is the project code obtained from the Duitku
// merchant page.
// This code is useful as an identifier of your project in each
// request using the /merchant/* APIs.
- // You can get this code on every project you register on the
- // [merchant portal].
- //
- // [merchant portal]: https://passport.duitku.com/merchant/Project
Code string `ini:"::code"`
// The API key for signing merchant request.
diff --git a/payment_fee.go b/payment_fee.go
index 4b8f10f..080d632 100644
--- a/payment_fee.go
+++ b/payment_fee.go
@@ -3,13 +3,13 @@
package duitku
-// [PaymentFee] contains fee for payment method.
+// PaymentFee contains [fee] for payment method.
//
// If the settings in the merchant portal fees are charged to the
// merchant, the TotalFee will appear 0.
// The TotalFee will appear if it is charged to the customer.
//
-// [PaymentFee]: https://docs.duitku.com/api/en/#payment-fee
+// [fee]: https://docs.duitku.com/api/en/#payment-fee
type PaymentFee struct {
// Payment method code.
PaymentMethod string `json:"paymentMethod"`
diff --git a/payment_status.go b/payment_status.go
index 4eccd0c..009a824 100644
--- a/payment_status.go
+++ b/payment_status.go
@@ -9,6 +9,8 @@ import (
"fmt"
)
+// PaymentStatus define the request to get the latest order ID payment status
+// based on its merchant.
type PaymentStatus struct {
MerchantCode string `form:"merchantCode"`
OrderID string `form:"merchantOrderId"`
diff --git a/request.go b/request.go
index 36093c0..93dd848 100644
--- a/request.go
+++ b/request.go
@@ -25,6 +25,8 @@ type Request struct {
Timestamp int64 `json:"timestamp"`
}
+// CreateDisburseRequest create request for disbursement using ClientOptions
+// opts.
func CreateDisburseRequest(opts ClientOptions) (req Request) {
req.UserID = opts.DisburseUserID
req.Email = opts.DisburseEmail
diff --git a/rtol_inquiry.go b/rtol_inquiry.go
index 14b9bba..71932ab 100644
--- a/rtol_inquiry.go
+++ b/rtol_inquiry.go
@@ -52,7 +52,7 @@ func (inq *RtolInquiry) Sign(opts ClientOptions) {
plain = fmt.Sprintf(`%s%d%s%s%d%s%s`, inq.Email,
inq.Timestamp, inq.BankCode, inq.BankAccount,
inq.Amount, inq.Purpose, opts.DisburseApiKey)
- plainHash [sha256.Size]byte = sha256.Sum256([]byte(plain))
+ plainHash = sha256.Sum256([]byte(plain))
)
inq.Signature = hex.EncodeToString(plainHash[:])
}