Mhamdans17 commited on
Commit ·
1517cb7
1
Parent(s): e9ae501
fix: update order.TotalAmount with Tripay fee on webhook PAID to reflect in admin reports
Browse files
controllers/order_controller.go
CHANGED
|
@@ -584,7 +584,12 @@ func TripayWebhook(c *gin.Context) {
|
|
| 584 |
switch tripayStatus {
|
| 585 |
case "PAID":
|
| 586 |
order.PaymentStatus = "paid"
|
| 587 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 588 |
case "EXPIRED", "FAILED":
|
| 589 |
order.PaymentStatus = "failed"
|
| 590 |
if oldStatus != "failed" {
|
|
|
|
| 584 |
switch tripayStatus {
|
| 585 |
case "PAID":
|
| 586 |
order.PaymentStatus = "paid"
|
| 587 |
+
if tripayTotal, ok := notification["total_amount"].(float64); ok && tripayTotal > 0 {
|
| 588 |
+
order.TotalAmount = int(tripayTotal)
|
| 589 |
+
order.PaidAmount = int(tripayTotal)
|
| 590 |
+
} else {
|
| 591 |
+
order.PaidAmount = order.TotalAmount
|
| 592 |
+
}
|
| 593 |
case "EXPIRED", "FAILED":
|
| 594 |
order.PaymentStatus = "failed"
|
| 595 |
if oldStatus != "failed" {
|