Git Product home page Git Product logo

go-midtrans's Issues

go-midtrans doesn't work while running inside docker container

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

custom callback for snap doesnt work

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

Refund support?

The core gateway doesn't include API for refund and direct refund

Snap SDK did not return "status_code"

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!

LICENSE unavailable

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

Invalid SnapRequest sent by mobile sdk

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?

Mandiri eCash is not found on charge request struct

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"`
    ...
}

Installment On Snap

Hi midtrans team,

I found that Installement Term on CreditCardDetail has data type int8, but on the API Documentation it should be json object:

image

And what should I put on InstallmentTerm value?
image

Any suggestion?

Thanks!

Wrong status_code on Response struct for CoreGateway

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.
Screen Shot 2019-11-26 at 21 16 41

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.

wrong type on BCATransferDetail struct

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"

Invalid installment struct

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

No documentation about set custom transaction expired

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,
			},
		},
	}

Missing channel_status_code and channel_status_message field in CoreGateway Response

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.