diff --git a/request_test.go b/request_test.go index 938bc23..d965ab0 100644 --- a/request_test.go +++ b/request_test.go @@ -4,7 +4,6 @@ import ( "midtrans" "testing" "github.com/cheekybits/is" - "midtrans/paytype" "encoding/json" ) @@ -16,11 +15,28 @@ func TestCustomerFieldOmmittable(t *testing.T) { } reqJSON, _ := json.Marshal(req) - is.Equal(string(reqJSON), `{"payment_type":"credit_card","transaction_details":{"order_id":"","gross_amount":0},"item_details":null}`) + is.Equal(string(reqJSON), `{"payment_type":"credit_card","transaction_details":{"order_id":"","gross_amount":0}}`) req.CustField1 = "f1" req.CustField2 = "f2" req.CustField3 = "f3" reqJSON, _ = json.Marshal(req) - is.Equal(string(reqJSON), `{"payment_type":"credit_card","transaction_details":{"order_id":"","gross_amount":0},"item_details":null,"custom_field1":"f1","custom_field2":"f2","custom_field3":"f3"}`) + is.Equal(string(reqJSON), `{"payment_type":"credit_card","transaction_details":{"order_id":"","gross_amount":0},"custom_field1":"f1","custom_field2":"f2","custom_field3":"f3"}`) +} + +func TestBankTransferMandiriBill(t *testing.T) { + is := is.New(t) + + req := midtrans.ChargeReq{ + PaymentType: midtrans.SourceBankTransfer, + BankTransfer: &midtrans.BankTransferDetail{ + MandiriBillBankTransferDetail: &midtrans.MandiriBillBankTransferDetail{ + BillInfo1: "Silahkan transfer", + BillInfo2: "Untuk pembelian pulsa", + }, + }, + } + + reqJSON, _ := json.Marshal(req) + is.Equal(string(reqJSON), `{"payment_type":"bank_transfer","transaction_details":{"order_id":"","gross_amount":0},"bank_transfer":{"bill_info1":"Silahkan transfer","bill_info2":"Untuk pembelian pulsa"}}`) } \ No newline at end of file