summaryrefslogtreecommitdiff
path: root/src/pages/api/shop/midtrans-payment.js
diff options
context:
space:
mode:
authorHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-05-08 16:44:09 +0700
committerHATEC\SPVDEV001 <tri.susilo@altama.co.id>2023-05-08 16:44:09 +0700
commit486f85a45fc7e0669576f59824a31be472ed25bb (patch)
tree0268afa8efe48746e040611ba41ad2cafda7ad08 /src/pages/api/shop/midtrans-payment.js
parentcff198277e14450f8d20d9e18548325e6f277682 (diff)
parent30fc50600009ca54f085d594d838803c107e87f2 (diff)
Merge branch 'master' into development_tri/implementasi_raja_ongkir
# Conflicts: # src/lib/checkout/components/Checkout.jsx
Diffstat (limited to 'src/pages/api/shop/midtrans-payment.js')
-rw-r--r--src/pages/api/shop/midtrans-payment.js15
1 files changed, 3 insertions, 12 deletions
diff --git a/src/pages/api/shop/midtrans-payment.js b/src/pages/api/shop/midtrans-payment.js
index 1772e9e0..12aaa51f 100644
--- a/src/pages/api/shop/midtrans-payment.js
+++ b/src/pages/api/shop/midtrans-payment.js
@@ -22,6 +22,7 @@ export default async function handler(req, res) {
{},
{ Token: auth.token }
)
+
if (!transaction?.id) {
return res.status(400).json({ error: 'No Data' })
}
@@ -48,7 +49,7 @@ export default async function handler(req, res) {
const parameter = {
transaction_details: {
order_id: transaction.name?.replaceAll('/', '-'),
- gross_amount: transaction.amountTotal
+ gross_amount: Math.floor(transaction.amountTotal)
},
credit_card: {
secure: true
@@ -56,17 +57,7 @@ export default async function handler(req, res) {
customer_details: {
first_name: transaction.address.customer.name,
email: transaction.address.customer.email || '',
- phone: transaction.address.customer.phone || '',
- billing_address: {
- first_name: transaction.address.invoice.name,
- email: transaction.address.invoice.email || '',
- phone: transaction.address.invoice.phone || ''
- },
- shipping_address: {
- first_name: transaction.address.shipping.name,
- email: transaction.address.shipping.email || '',
- phone: transaction.address.shipping.phone || ''
- }
+ phone: transaction.address.customer.phone || ''
}
}