From 8c305427efe2c3e517df28921f3c25e2ae4e7d7d Mon Sep 17 00:00:00 2001 From: Awang Trisakti Date: Tue, 16 Jan 2024 14:08:28 +0700 Subject: [PATCH] Fix status always unpaid --- payment/goldpay/goldpay.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/payment/goldpay/goldpay.go b/payment/goldpay/goldpay.go index a7a3c0e..62a3905 100644 --- a/payment/goldpay/goldpay.go +++ b/payment/goldpay/goldpay.go @@ -18,8 +18,12 @@ type GoldpayConfig struct { } type goldpayApiResponse struct { - ID string `json:"id"` - Status string `json:"status"` + Success bool `json:"success"` + Messsage string `json:"message"` + Data struct { + ID string `json:"id"` + Status string `json:"status"` + } `json:"data"` } type goldPay struct { @@ -50,12 +54,13 @@ func (gp *goldPay) Pay(amount float64) (payment.PaymentInfo, error) { } var status string - if response.Status == "completed" { + var data = response.Data + if data.Status == "completed" { status = paymentstatus.PAID } return payment.PaymentInfo{ - ID: response.ID, + ID: data.ID, Status: status, }, nil }