Skip to content

Commit

Permalink
Fix status always unpaid
Browse files Browse the repository at this point in the history
  • Loading branch information
awang-jakpat committed Jan 16, 2024
1 parent 4c22d2d commit 8c30542
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions payment/goldpay/goldpay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}

0 comments on commit 8c30542

Please sign in to comment.