Skip to content

Commit

Permalink
1. Added BNI Bank Transfer
Browse files Browse the repository at this point in the history
2. Added Permata Bank Transfer
3. Added Expiry
4. Added Callbacks
  • Loading branch information
andhikamaheva committed Aug 20, 2018
1 parent 1e13ba9 commit c2cc4c2
Showing 1 changed file with 46 additions and 20 deletions.
66 changes: 46 additions & 20 deletions request.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
package midtrans

import (
"time"
)

// ItemDetail : Represent the transaction details
type ItemDetail struct {
ID string `json:"id"`
Expand Down Expand Up @@ -57,7 +61,14 @@ type CreditCardDetail struct {

// PermataBankTransferDetail : Represent Permata bank_transfer detail
type PermataBankTransferDetail struct {
Bank Bank `json:"bank"`
Bank Bank `json:"bank,omitempty"`
VaNumber *string `json:"va_number,omitempty"`
RecipientName *string `json:"recipient_name ,omitempty"`
}

// BNIBankTransferDetail : Represent BNI bank_transfer detail
type BNIBankTransferDetail struct {
VaNumber string `json:"va_number"`
}

// BCABankTransferLangDetail : Represent BCA bank_transfer lang detail
Expand Down Expand Up @@ -88,9 +99,10 @@ type BCABankTransferDetailFreeText struct {

// BCABankTransferDetail : Represent BCA bank_transfer detail
type BCABankTransferDetail struct {
Bank Bank `json:"bank"`
VaNumber string `json:"va_number"`
FreeText BCABankTransferDetailFreeText `json:"free_text"`
Bank Bank `json:"bank"`
VaNumber string `json:"va_number"`
SubCompanyCode *string `json:"sub_company_code,omitempty"`
FreeText BCABankTransferDetailFreeText `json:"free_text"`
}

// MandiriBillBankTransferDetail : Represent Mandiri Bill bank_transfer detail
Expand Down Expand Up @@ -158,11 +170,22 @@ type ConvStoreDetail struct {
Message string `json:"message"`
}

// Callbacks : Represent callbacks url after transaction successfully paid
type Callbacks struct {
finish string `json:"finish,omitempty"`
}

// Expiry : Represent expiry time
type Expiry struct {
StartAt time.Time `json:"start_at,omitempty"`
Unit string `json:"unit,omitempty"`
duration int64 `json:"duration,omitempty"`
}

// ChargeReq : Represent Charge request payload
type ChargeReq struct {
PaymentType PaymentType `json:"payment_type"`
TransactionDetails TransactionDetails `json:"transaction_details"`

PaymentType PaymentType `json:"payment_type"`
TransactionDetails TransactionDetails `json:"transaction_details"`
CreditCard *CreditCardDetail `json:"credit_card,omitempty"`
BankTransfer *BankTransferDetail `json:"bank_transfer,omitempty"`
MandiriBillBankTransferDetail *MandiriBillBankTransferDetail `json:"echannel,omitempty"`
Expand All @@ -175,23 +198,26 @@ type ChargeReq struct {
IndosatDompetku *IndosatDompetkuDetail `json:"indosat_dompetku,omitempty"`
CustomerDetail *CustDetail `json:"customer_details,omitempty"`
ConvStore *ConvStoreDetail `json:"cstore,omitempty"`

Items *[]ItemDetail `json:"item_details,omitempty"`
CustField1 string `json:"custom_field1,omitempty"`
CustField2 string `json:"custom_field2,omitempty"`
CustField3 string `json:"custom_field3,omitempty"`
Items *[]ItemDetail `json:"item_details,omitempty"`
CustField1 string `json:"custom_field1,omitempty"`
CustField2 string `json:"custom_field2,omitempty"`
CustField3 string `json:"custom_field3,omitempty"`
}

// SnapReq : Represent SNAP API request payload
type SnapReq struct {
TransactionDetails TransactionDetails `json:"transaction_details"`
EnabledPayments []PaymentType `json:"enabled_payments"`
Items *[]ItemDetail `json:"item_details,omitempty"`
CustomerDetail *CustDetail `json:"customer_details,omitempty"`
CreditCard *CreditCardDetail `json:"credit_card,omitempty"`
CustomField1 string `json:"custom_field1"`
CustomField2 string `json:"custom_field2"`
CustomField3 string `json:"custom_field3"`
TransactionDetails TransactionDetails `json:"transaction_details"`
EnabledPayments []PaymentType `json:"enabled_payments"`
Items *[]ItemDetail `json:"item_details,omitempty"`
CustomerDetail *CustDetail `json:"customer_details,omitempty"`
CreditCard *CreditCardDetail `json:"credit_card,omitempty"`
BCABankTransfer *BCABankTransferDetail `json:"bca_va,omitempty"`
BNIBankTransfer *BNIBankTransferDetail `json:"bni_va,omitempty"`
PermataBankTransfer *PermataBankTransferDetail `json:"permata_va,omitempty"`
Expiry *Expiry `json:"expiry,omitempty"`
CustomField1 *string `json:"custom_field1,omitempty"`
CustomField2 *string `json:"custom_field2,omitempty"`
CustomField3 *string `json:"custom_field3,omitempty"`
}

// CaptureReq : Represent Capture request payload
Expand Down

0 comments on commit c2cc4c2

Please sign in to comment.