-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from Xaxxis/main
[fix bug] nil StatusCode handling on HTTP Client & Iris error type field struct
- Loading branch information
Showing
7 changed files
with
107 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Sample App | ||
This is a very simple, very minimalist example to demonstrate integrating Midtrans with Go | ||
|
||
## Run The app | ||
1. Clone the repository, open terminal in this `/example/simple/coreapi-card-3ds` folder. | ||
2. Run the web server using: `go run main.go` | ||
3. The smple app will run at port 3000. Open `localhost:3000` from browser. | ||
|
||
## Run command line app | ||
1. Clone the repository, open terminal in this `/example/simple/coreapi` folder. | ||
2. Run the app using: `go run main.go` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,7 +178,38 @@ func TestGetListBeneficiaryBank(t *testing.T) { | |
func TestValidateBankAccount(t *testing.T) { | ||
iris := Client{} | ||
iris.New(irisApproverKeySandbox, midtrans.Sandbox) | ||
resp, err := iris.ValidateBankAccount("danamon", "000001137298") | ||
resp, err := iris.ValidateBankAccount("mandiri", "1111222233333") | ||
assert.Nil(t, err) | ||
assert.Equal(t, resp.AccountNo, "000001137298") | ||
assert.Equal(t, resp.AccountNo, "1111222233333") | ||
} | ||
|
||
func TestCreatePayoutFail(t *testing.T) { | ||
iris := Client{} | ||
iris.New(irisCreatorKeySandbox, midtrans.Sandbox) | ||
|
||
p1 := CreatePayoutDetailReq{ | ||
BeneficiaryAccount: "1380011819286", | ||
BeneficiaryBank: "mandiri", | ||
BeneficiaryEmail: "[email protected]", | ||
Amount: random(), | ||
Notes: "MidGoUnitTest", | ||
} | ||
|
||
p2 := CreatePayoutDetailReq{ | ||
BeneficiaryAccount: "1380011819286", | ||
BeneficiaryBank: "mandiri", | ||
BeneficiaryEmail: "[email protected]", | ||
Amount: random(), | ||
Notes: "MidGoUnitTest", | ||
} | ||
var payouts []CreatePayoutDetailReq | ||
payouts = append(payouts, p1) | ||
payouts = append(payouts, p2) | ||
|
||
|
||
cp := CreatePayoutReq{Payouts: payouts} | ||
payoutReps, err := iris.CreatePayout(cp) | ||
assert.NotNil(t, payoutReps) | ||
assert.NotNil(t, err) | ||
assert.Equal(t, "An error occurred when creating payouts", payoutReps.ErrorMessage) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters