Skip to content

Commit

Permalink
Update the payment status
Browse files Browse the repository at this point in the history
  • Loading branch information
awang-jakpat committed Dec 20, 2023
1 parent cf846f6 commit 7c8b2ad
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 7 additions & 1 deletion payment/goldpay/goldpay.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (

"github.com/awang-jakpat/golds-dev-tools/httphelper"
"github.com/awang-jakpat/golds-dev-tools/payment"
"github.com/awang-jakpat/golds-dev-tools/payment/paymentstatus"
)

type GoldpayConfig struct {
Expand Down Expand Up @@ -49,8 +50,13 @@ func (gp *goldPay) Pay(amount float64) (payment.PaymentInfo, error) {
return payment.PaymentInfo{}, err
}

var status string
if response.Status == "completed" {
status = paymentstatus.PAID
}

return payment.PaymentInfo{
ID: response.ID,
Status: response.Status,
Status: status,
}, nil
}
5 changes: 5 additions & 0 deletions payment/paymentstatus/payment_status.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package paymentstatus

const (
PAID string = "paid"
)

0 comments on commit 7c8b2ad

Please sign in to comment.