Skip to content

Commit

Permalink
add type for bank transfers, internet banking, among others
Browse files Browse the repository at this point in the history
  • Loading branch information
adamnoto committed Jan 5, 2017
1 parent 0156999 commit ae397bd
Showing 1 changed file with 100 additions and 2 deletions.
102 changes: 100 additions & 2 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,110 @@ type CreditCardDetail struct {
SavedTokenIdExpireAt string `json:"saved_token_id_expired_at"`
}

type PermataBankTransferDetail struct {
Bank Bank `json:"bank"`
}

type BCABankTransferLangDetail struct {
LangID string `json:"id,omitempty"`
LangEN string `json:"id,omitempty"`
}

/*
Example of usage syntax:
midtrans.BCABankTransferDetail{
FreeText: {
Inquiry: []midtrans.BCABankTransferLangDetail{
{
LangEN: "Test",
LangID: "Coba",
},
},
},
}
*/
type BCABankTransferDetail struct {
Bank Bank `json:"bank"`
VaNumber string `json:"va_number"`
FreeText struct {
Inquiry []BCABankTransferDetail `json:"inquiry"`
Payment []BCABankTransferDetail `json:"payment"`
} `json:"free_text"`
}

type MandiriBillBankTransferDetail struct {
BillInfo1 string `json:"bill_info1"`
BillInfo2 string `json:"bill_info2"`
}

type BankTransferDetail struct {
*PermataBankTransferDetail
*BCABankTransferDetail
*MandiriBillBankTransferDetail
}

// Internet Banking for BCA KlikPay
type BCAKlikPayDetail struct {
// 1 = normal, 2 = installment, 3 = normal + installment
Type string `json:"type"`
Desc string `json:"description"`
MiscFee int64 `json:"misc_fee,omitempty"`
}

type BCAKlikBCADetail struct {
Desc string `json:"description"`
UserID string `json:"user_id"`
}

type MandiriClickPayDetail struct {
CardNumber string `json:"card_number"`
Input1 string `json:"input1"`
Input2 string `json:"input2"`
Input3 string `json:"input3"`
Token string `json:"token"`
}

type CIMBClicksDetail struct {
Desc string `json:"description"`
}

type TelkomselCashDetail struct {
Promo bool `json:"promo"`
IsReversal int8 `json:"is_reversal"`
Customer string `json:"customer"`
}

type IndosatDompetkuDetail struct {
MSISDN string `json:"msisdn"`
}

type MandiriEcashDetail struct {
Desc string `json:"description"`
}

type ConvStoreDetail struct {
Store string `json:"store"`
Message string `json:"message"`
}

// Represent the request payload
type ChargeReq struct {
PaymentType PaymentType `json:"payment_type"`
TransactionDetails TransactionDetails `json:"transaction_details"`
CreditCard CreditCardDetail `json:"credit_card,omitempty"`
Items []ItemDetail `json:"item_details"`

CreditCard *CreditCardDetail `json:"credit_card,omitempty"`
BankTransfer *BankTransferDetail `json:"bank_transfer,omitempty"`

BCAKlikPay *BCAKlikPayDetail `json:"bca_klikpay,omitempty"`
BCAKlikBCA *BCAKlikBCADetail `json:"bca_klikbca"`
MandiriClickPay *MandiriClickPayDetail `json:"mandiri_clickpay"`
CIMBClicks *CIMBClicksDetail `json:"cimb_clicks"`
TelkomselCash *TelkomselCashDetail `json:"telkomsel_cash"`
IndosatDompetku *IndosatDompetkuDetail `json:"indosat_dompetku"`

ConvStore *ConvStoreDetail `json:"cstore"`

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

0 comments on commit ae397bd

Please sign in to comment.