veritrans / go-midtrans Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
Hi @rizdaprasetya and Midtrans team,
Go Report Card (goreportcard.com) is a widely-adopted tools to check how good our Golang programming language. I check this repository and here is the results https://goreportcard.com/report/github.com/veritrans/go-midtrans and it's still on B (Not Bad)
I'd like to contribute to improve goreportcard.com rating ๐
I found something weird while working with this go package, I tried to run it from Docker Container and I got error One or more parameters in the payload is invalid.
but when I try it in localhost from my machine, it's working like a charm
Error Log from Docker Container
2021/01/02 20:41:46 Request POST : api.sandbox.midtrans.com /v2/charge
2021/01/02 20:41:46 One or more parameters in the payload is invalid.
Success Log from my local machine
2021/01/03 03:28:06 Request POST : api.sandbox.midtrans.com /v2/charge
2021/01/03 03:28:06 OK, Mandiri Bill transaction is successful
If there is a special configuration for run midtrans inside Docker
please add it into documentation thanks
Hello
Documentation said we could use custom callback for our payment
custom finish url
when i tried to custom my payload like
Callbacks: &midtrans.Callbacks{ Finish: "https://example.org/?foo=123456", },
instead of giving my custom finish url query, it still redirect with query
?status_code=200&transaction_status=settlement&merchant_id=XXXXXX&order_id=XXXXXXX
I used Development env for testing
The core gateway doesn't include API for refund
and direct refund
Hi @rizdaprasetya and Midtrans team,
As we know, SnapResponse
struct has field status_code
to keep HTTP Status Code from Midtrans. But I found that field is always empty and found that it does not use or set by any function right now. I need that field so I can check the error that happen on Midtrans API.
I will submit a PR regarding to this issue ๐
Thanks!
Hi @rizdaprasetya and Midtrans team,
As we know, this repository has no LICENSE yet. It would be great if you define the LICENSE of this repository. Maybe Apache 2.0 or MIT would be great options ๐
Thanks,
Reza
Hi,
I'm using this module with version (v0.0.0-20190513104831-ff7f567d2249) in my golang backend. However, when we receive the snap request from our android app, we found out that credit_card.authentication
sent by the android sdk is not a boolean, but string. Meanwhile in go-midtrans module, it is defined as boolean
in here.
We are using struct SnapReq
to decode the json sent by the android and to do some validation against the request sent by android app. However we got error due to the issue i explained above.
decoder := json.NewDecoder(r.Body)
var snapRequest go-midtrans.SnapReq
err := decoder.Decode(&snapRequest)
if err != nil {
.....
}
Is this expected?
When I test use mandiri ecash payment method (at https://api-docs.midtrans.com/#mandiri-e-cash)
{
"payment_type": "mandiri_ecash",
"mandiri_ecash": {
"description": "Transaction Description"
},
...
}
There is json key "mandiri_ecash"
but it's not exist at https://github.com/veritrans/go-midtrans/blob/master/request.go#L142
May should be like this
type ChargeReq struct {
...
MandiriClickPay *MandiriClickPayDetail `json:"mandiri_clickpay,omitempty"`
MandiriEcash *MandiriEcashDetail `json:"mandiri_ecash,omitempty"`
CIMBClicks *CIMBClicksDetail `json:"cimb_clicks,omitempty"`
...
}
In override notification url part in snap docs (https://snap-docs.midtrans.com/#override-notification-url),
there is feature where people can append or override notification url. In file client.go
or snap.go
, I don't see function that provide this feature
Hi midtrans team,
Based on this fix #19 , it fill the status_code both in SnapResponse's struct and Response's struct with http statuscode.
But in CoreGateway, when getting status of an order https://api.sandbox.midtrans.com/v2/some-order-id/status
, it gives the status_code result in response body based on transaction's status like image below.
Because of fix in #19 it will replace the status_code=407 (which explain the transaction's status) with status_code=200 from http status_code in Response of CoreGateway.
so the status_code in Response struct must not replaced with the http status code, because it is refer from transaction's status.
There is any plan to develop iris API wrapper (https://iris-docs.midtrans.com/#iris-api) ?
Hi There,
i just saw the codes on https://github.com/veritrans/go-midtrans/blob/master/request.go#L77. seems there was incorrect type
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"`
}
it should be using BCABankTransferLangDetail
instead BCABankTransferDetail
type BCABankTransferDetail struct {
Bank Bank `json:"bank"`
VaNumber string `json:"va_number"`
FreeText struct {
Inquiry []BCABankTransferLangDetail `json:"inquiry"`
Payment []BCABankTransferLangDetail `json:"payment"`
} `json:"free_text"`
}
if i referred from doc the payload json should be like this
"bank_transfer":{
"bank": "bca",
"free_text": {
"inquiry": [
{
"id": "Free Text ID Free Text ID Free Text ID",
"en": "Free Text EN Free Text EN Free Text EN"
}
],
"payment": [
{
"id": "Free Text ID Free Text ID Free Text ID",
"en": "Free Text EN Free Text EN Free Text EN"
}
]
}
also this one
type BCABankTransferLangDetail struct {
LangID string `json:"id,omitempty"`
LangEN string `json:"id,omitempty"`
}
the second annotation should be LangEN string json:"en,omitempty"
Hi,
We will use installment struct, and i found the installment struct has missing code.
type InstallmentTermsDetail {
Bni []int8 `json:"bni,omitempty"`
Mandiri []int8 `json:"mandiri,omitempty"`
Cimb []int8 `json:"cimb,omitempty"`
Mega []int8 `json:"mega,omitempty"`
Bca []int8 `json:"bca,omitempty"`
Bri []int8 `json:"bri,omitempty"`
Maybank []int8 `json:"maybank,omitempty"`
Offline []int8 `json:"offline,omitempty"`
}
there is missing type struct
and i found a type of field Terms
has an array of object.
refer to this documentation midtrans-snap-documentation that field is using an object.
please take a look on #60
when i see core.go, i didnt found Deny Func
should i create it manually ?
Hello I am using midtrans for my business, and I have struggle finding how to define custom trx expire in ChargeReq.
I have try this one by reading the code of go-midtrans but this is not work, please help me by explain how to define custom
transaction expire in ChargeReq
req := &midtrans.ChargeReq{
PaymentType: midtrans.SourceEchannel,
MandiriBillBankTransferDetail: &midtrans.MandiriBillBankTransferDetail{
BillInfo1: "complete payment",
BillInfo2: "dept",
},
// how to set valid configuration for custom trx expire
CustomExpiry: &midtrans.CustomExpiry{
OrderTime: trxTime.Format("2006-01-02 15:04:05 +0700"),
ExpiryDuration: 1,
Unit: "HOUR",
},
TransactionDetails: midtrans.TransactionDetails{
OrderID: trxID,
GrossAmt: grossAmt,
},
CustomerDetail: &midtrans.CustDetail{
Phone: custPhone,
FName: custName,
},
Items: &[]midtrans.ItemDetail{
{
ID: itemID,
Price: grossAmt,
Qty: 1,
Name: itemName,
},
},
}
The SnapReq struct does not support expiry as mentioned here https://snap-docs.midtrans.com/#request-body-json-parameter ?
Doc: https://api-docs.midtrans.com/#get-transaction-status
Request:
GET /v2/{order_id}/status
Response:
{
"status_code" : "200",
"status_message" : "Success, transaction found",
"transaction_id" : "249fc620-6017-4540-af7c-5a1c25788f46",
"masked_card" : "481111-1114",
"order_id" : "example-1424936368",
"payment_type" : "credit_card",
"transaction_time" : "2015-02-26 14:39:33",
"transaction_status" : "partial_refund",
"fraud_status" : "accept",
"approval_code" : "1424936374393",
"signature_key" : "2802a264cb978fbc59f631c68d120cbda8dc853f5dfdc52301c615cf4f14e7a0b09aa...",
"bank" : "bni",
"gross_amount" : "30000.00",
"channel_response_code": "00",
"channel_response_message": "Approved",
"card_type": "credit",
"refund_amount": "12000.00",
"refunds": [
{
"refund_chargeback_id": 1,
"refund_amount": "5000.00",
"created_at": "2015-02-27 00:14:20",
"reason": "some reason",
"refund_key": "reference1"
},
{
"refund_chargeback_id": 2,
"refund_amount": "7000.00",
"created_at": "2015-02-28 01:23:15",
"reason": "",
"refund_key": "reference2"
},
]
}
Based on this documentation when we call Get Status API, it might contains the channel_status_code
and channel_status_message
field, but it was missing from Response
struct in response.go
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.