Mhamdans17 commited on
Commit ·
0ff7334
1
Parent(s): 1517cb7
feat: add Tripay fee as a Biaya Layanan item in WhatsApp notifications
Browse files
controllers/order_controller.go
CHANGED
|
@@ -629,6 +629,7 @@ func TripayWebhook(c *gin.Context) {
|
|
| 629 |
}
|
| 630 |
|
| 631 |
var waItems []services.WAItem
|
|
|
|
| 632 |
for _, item := range order.Items {
|
| 633 |
pName := "Item"
|
| 634 |
if item.Product != nil {
|
|
@@ -639,6 +640,15 @@ func TripayWebhook(c *gin.Context) {
|
|
| 639 |
Quantity: item.Quantity,
|
| 640 |
Price: item.UnitPrice,
|
| 641 |
})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 642 |
}
|
| 643 |
|
| 644 |
var company models.Company
|
|
|
|
| 629 |
}
|
| 630 |
|
| 631 |
var waItems []services.WAItem
|
| 632 |
+
itemsTotal := 0
|
| 633 |
for _, item := range order.Items {
|
| 634 |
pName := "Item"
|
| 635 |
if item.Product != nil {
|
|
|
|
| 640 |
Quantity: item.Quantity,
|
| 641 |
Price: item.UnitPrice,
|
| 642 |
})
|
| 643 |
+
itemsTotal += (item.Quantity * item.UnitPrice)
|
| 644 |
+
}
|
| 645 |
+
|
| 646 |
+
if order.TotalAmount > itemsTotal {
|
| 647 |
+
waItems = append(waItems, services.WAItem{
|
| 648 |
+
Name: "Biaya Layanan QRIS",
|
| 649 |
+
Quantity: 1,
|
| 650 |
+
Price: order.TotalAmount - itemsTotal,
|
| 651 |
+
})
|
| 652 |
}
|
| 653 |
|
| 654 |
var company models.Company
|