veritrans / go-midtrans

Apache License 2.0
77 stars 51 forks source link

wrong type on BCATransferDetail struct #1

Closed harymindiar closed 7 years ago

harymindiar commented 7 years ago

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"

rizdaprasetya commented 7 years ago

Hi, nice one 👍 Thanks for contributing! Issue solved with above PR. I'll close the issue now