summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src-migrate/modules/cart/components/CartSummaryMobile.tsx3
-rw-r--r--src/core/utils/googleTag.js4
-rw-r--r--src/lib/cart/components/Cart.jsx3
-rw-r--r--src/lib/cart/components/CartOld.jsx3
-rw-r--r--src/lib/cart/components/Cartheader.jsx3
-rw-r--r--src/lib/checkout/components/Checkout.jsx1
-rw-r--r--src/lib/checkout/components/CheckoutOld.jsx2
-rw-r--r--src/lib/checkout/email/FinishCheckoutEmail.jsx5
-rw-r--r--src/lib/invoice/components/Invoice.jsx5
-rw-r--r--src/lib/quotation/components/Quotation.jsx7
-rw-r--r--src/lib/transaction/components/Transaction.jsx4
-rw-r--r--src/pages/api/shop/midtrans-payment.js1
-rw-r--r--src/pages/google_merchant/products/[page].js5
13 files changed, 28 insertions, 18 deletions
diff --git a/src-migrate/modules/cart/components/CartSummaryMobile.tsx b/src-migrate/modules/cart/components/CartSummaryMobile.tsx
index d9f72e0e..02258204 100644
--- a/src-migrate/modules/cart/components/CartSummaryMobile.tsx
+++ b/src-migrate/modules/cart/components/CartSummaryMobile.tsx
@@ -29,6 +29,7 @@ const CartSummaryMobile = ({
isLoaded = false,
}: Props) => {
const [showPopup, setShowPopup] = useState(false);
+ const PPN : number = process.env.NEXT_PUBLIC_PPN ? parseFloat(process.env.NEXT_PUBLIC_PPN) : 0;
return (
<>
<BottomPopup
@@ -63,7 +64,7 @@ const CartSummaryMobile = ({
</Skeleton>
<Skeleton isLoaded={isLoaded} className={style.line}>
- <span className={style.label}>Tax 11%</span>
+ <span className={style.label}>Tax {((PPN - 1) * 100).toFixed(0)}%</span>
<span className={style.value}>Rp {formatCurrency(tax || 0)}</span>
</Skeleton>
diff --git a/src/core/utils/googleTag.js b/src/core/utils/googleTag.js
index 96a6bd2e..f1550071 100644
--- a/src/core/utils/googleTag.js
+++ b/src/core/utils/googleTag.js
@@ -1,3 +1,5 @@
+const PPN = process.env.NEXT_PUBLIC_PPN
+
const mapVariants = (variants) => {
return variants.map((variant) => {
const res = {
@@ -22,7 +24,7 @@ const sumTotal = (variants) => {
0
)
let subtotal = totalPurchase - totalDiscount
- let tax = Math.round(subtotal * 0.11)
+ let tax = Math.round(subtotal * (PPN - 1))
let grandTotal = subtotal + tax
return {
totalPurchase: totalPurchase,
diff --git a/src/lib/cart/components/Cart.jsx b/src/lib/cart/components/Cart.jsx
index c6aaa596..1e25d959 100644
--- a/src/lib/cart/components/Cart.jsx
+++ b/src/lib/cart/components/Cart.jsx
@@ -27,6 +27,7 @@ import CardProdcuctsList from '@/core/components/elements/Product/cartProductsLi
// import cardProdcuctsList from '@/core/components/elements/Product/cartProductsList'
const Cart = () => {
+ const PPN = process.env.NEXT_PUBLIC_PPN
const router = useRouter()
const [products, setProducts] = useState(null)
const [isLoading, setIsLoading] = useState(true)
@@ -97,7 +98,7 @@ const Cart = () => {
if (product.canBuy == false) {
toggleSelected(product.id)
}
- let priceBeforeTax = product.price.price / 1.11
+ let priceBeforeTax = product.price.price / PPN
calculateTotalPriceBeforeTax += priceBeforeTax * product.quantity
calculateTotalTaxAmount += (product.price.price - priceBeforeTax) * product.quantity
calculateTotalDiscountAmount +=
diff --git a/src/lib/cart/components/CartOld.jsx b/src/lib/cart/components/CartOld.jsx
index 718541af..358efa49 100644
--- a/src/lib/cart/components/CartOld.jsx
+++ b/src/lib/cart/components/CartOld.jsx
@@ -20,6 +20,7 @@ import whatsappUrl from '@/core/utils/whatsappUrl'
import useAuth from '@/core/hooks/useAuth'
const Cart = () => {
+ const PPN = process.env.NEXT_PUBLIC_PPN
const router = useRouter()
const [products, setProducts] = useState(null)
const auth = useAuth()
@@ -67,7 +68,7 @@ const Cart = () => {
})
if (!product.selected) continue
- let priceBeforeTax = product.price.price / 1.11
+ let priceBeforeTax = product.price.price / PPN
calculateTotalPriceBeforeTax += priceBeforeTax * product.quantity
calculateTotalTaxAmount += (product.price.price - priceBeforeTax) * product.quantity
calculateTotalDiscountAmount +=
diff --git a/src/lib/cart/components/Cartheader.jsx b/src/lib/cart/components/Cartheader.jsx
index 1c30bb13..6d4e2679 100644
--- a/src/lib/cart/components/Cartheader.jsx
+++ b/src/lib/cart/components/Cartheader.jsx
@@ -14,6 +14,7 @@ const { ShoppingCartIcon, PhotoIcon } = require('@heroicons/react/24/outline');
const { default: Link } = require('next/link');
const Cardheader = (cartCount) => {
+ const PPN = process.env.NEXT_PUBLIC_PPN
const router = useRouter();
const [subTotal, setSubTotal] = useState(null);
const [buttonLoading, SetButtonTerapkan] = useState(false);
@@ -66,7 +67,7 @@ const Cardheader = (cartCount) => {
for (const product of products) {
if (product.quantity == '') continue;
- let priceBeforeTax = product.price.price / 1.11;
+ let priceBeforeTax = product.price.price / PPN;
calculateTotalPriceBeforeTax += priceBeforeTax * product.quantity;
calculateTotalTaxAmount +=
(product.price.price - priceBeforeTax) * product.quantity;
diff --git a/src/lib/checkout/components/Checkout.jsx b/src/lib/checkout/components/Checkout.jsx
index 4e182745..e3b586f1 100644
--- a/src/lib/checkout/components/Checkout.jsx
+++ b/src/lib/checkout/components/Checkout.jsx
@@ -588,7 +588,6 @@ const Checkout = () => {
setItemTnC(item);
SetBottomPopupTnC(true);
};
- // const taxTotal = (totalAmount - totalDiscountAmount - discountVoucher) * 0.11
const hasNoPrice = useMemo(() => {
if (!products) return false;
diff --git a/src/lib/checkout/components/CheckoutOld.jsx b/src/lib/checkout/components/CheckoutOld.jsx
index 5b479a73..433c5672 100644
--- a/src/lib/checkout/components/CheckoutOld.jsx
+++ b/src/lib/checkout/components/CheckoutOld.jsx
@@ -239,7 +239,7 @@ const Checkout = () => {
setIsLoading(false)
window.location.href = payment.data.redirectUrl
}
- const taxTotal = (totalAmount - totalDiscountAmount) * 0.11
+ const taxTotal = (totalAmount - totalDiscountAmount) * (PPN - 1)
return (
<>
diff --git a/src/lib/checkout/email/FinishCheckoutEmail.jsx b/src/lib/checkout/email/FinishCheckoutEmail.jsx
index d19ba1ca..9a94587e 100644
--- a/src/lib/checkout/email/FinishCheckoutEmail.jsx
+++ b/src/lib/checkout/email/FinishCheckoutEmail.jsx
@@ -17,6 +17,7 @@ import {
import FinishCheckout from '../components/FinishCheckout'
const FinishCheckoutEmail = ({ transaction, payment, statusPayment }) => {
+ const PPN = process.env.NEXT_PUBLIC_PPN
return (
<Html>
@@ -206,9 +207,9 @@ const FinishCheckoutEmail = ({ transaction, payment, statusPayment }) => {
</Column>
</Row>
<Row style={style.descriptionRow}>
- <Column style={style.descriptionLCol}>PPN 11% (Incl.)</Column>
+ <Column style={style.descriptionLCol}>PPN {((PPN - 1) * 100).toFixed(0)}% (Incl.)</Column>
<Column style={style.descriptionRCol}>
- {currencyFormat(transaction.subtotal * 0.11)}
+ {currencyFormat(transaction.subtotal * (PPN - 1))}
</Column>
</Row>
diff --git a/src/lib/invoice/components/Invoice.jsx b/src/lib/invoice/components/Invoice.jsx
index 81202b1c..15bfa746 100644
--- a/src/lib/invoice/components/Invoice.jsx
+++ b/src/lib/invoice/components/Invoice.jsx
@@ -13,6 +13,7 @@ import { createSlug } from '@/core/utils/slug'
import { useEffect, useState } from 'react'
const Invoice = ({ id }) => {
+ const PPN = process.env.NEXT_PUBLIC_PPN
const { invoice } = useInvoice({ id })
const [totalAmount, setTotalAmount] = useState(0)
@@ -255,8 +256,8 @@ const Invoice = ({ id }) => {
{currencyFormat(invoice.data?.amountTotal)}
</div>
- <div className='text-right'>PPN 11% (Incl.)</div>
- <div className='text-right font-medium'>{currencyFormat(totalAmount * 0.11)}</div>
+ <div className='text-right'>PPN {((PPN - 1) * 100).toFixed(0)}% (Incl.)</div>
+ <div className='text-right font-medium'>{currencyFormat(invoice.data?.amountTotal - totalAmount)}</div>
</div>
</div>
</div>
diff --git a/src/lib/quotation/components/Quotation.jsx b/src/lib/quotation/components/Quotation.jsx
index 5a2f63a5..2f4d6c46 100644
--- a/src/lib/quotation/components/Quotation.jsx
+++ b/src/lib/quotation/components/Quotation.jsx
@@ -37,6 +37,7 @@ const { checkoutApi } = require('@/lib/checkout/api/checkoutApi');
const { getProductsCheckout } = require('@/lib/checkout/api/checkoutApi');
const Quotation = () => {
+ const PPN = process.env.NEXT_PUBLIC_PPN ? parseFloat(process.env.NEXT_PUBLIC_PPN) : 0;
const router = useRouter();
const auth = useAuth();
const query = router.query.source ?? null;
@@ -307,7 +308,7 @@ const Quotation = () => {
toast.error('Gagal melakukan transaksi, terjadi kesalahan internal');
};
- const taxTotal = (totalAmount - totalDiscountAmount) * 0.11;
+ const taxTotal = (totalAmount - totalDiscountAmount) * (PPN - 1);
return (
<>
@@ -425,7 +426,7 @@ const Quotation = () => {
<div>{currencyFormat(cartCheckout?.subtotal)}</div>
</div>
<div className='flex gap-x-2 justify-between'>
- <div className='text-gray_r-11'>PPN 11%</div>
+ <div className='text-gray_r-11'>PPN {((PPN - 1) * 100).toFixed(0)}%</div>
<div>{currencyFormat(cartCheckout?.tax)}</div>
</div>
<div className='flex gap-x-2 justify-between'>
@@ -574,7 +575,7 @@ const Quotation = () => {
<div>{currencyFormat(cartCheckout?.subtotal)}</div>
</div>
<div className='flex gap-x-2 justify-between'>
- <div className='text-gray_r-11'>PPN 11%</div>
+ <div className='text-gray_r-11'>PPN {((PPN - 1) * 100).toFixed(0)}%</div>
<div>{currencyFormat(cartCheckout?.tax)}</div>
</div>
<div className='flex gap-x-2 justify-between'>
diff --git a/src/lib/transaction/components/Transaction.jsx b/src/lib/transaction/components/Transaction.jsx
index f5dc507a..273ea3f7 100644
--- a/src/lib/transaction/components/Transaction.jsx
+++ b/src/lib/transaction/components/Transaction.jsx
@@ -207,7 +207,7 @@ const Transaction = ({ id }) => {
<p>{currencyFormat(transaction.data?.amountUntaxed)}</p>
</div>
<div className='flex justify-between mt-1'>
- <p className='text-gray_r-12/70'>PPN 11%</p>
+ <p className='text-gray_r-12/70'>PPN {((PPN - 1) * 100).toFixed(0)}%</p>
<p>{currencyFormat(transaction.data?.amountTax)}</p>
</div>
<div className='flex justify-between mt-1'>
@@ -975,7 +975,7 @@ const Transaction = ({ id }) => {
{currencyFormat(transaction.data?.amountUntaxed)}
</div>
- <div className='text-right'>PPN 11%</div>
+ <div className='text-right'>PPN {((PPN - 1) * 100).toFixed(0)}%</div>
<div className='text-right font-medium'>
{currencyFormat(transaction.data?.amountTax)}
</div>
diff --git a/src/pages/api/shop/midtrans-payment.js b/src/pages/api/shop/midtrans-payment.js
index 12aaa51f..f90e9e81 100644
--- a/src/pages/api/shop/midtrans-payment.js
+++ b/src/pages/api/shop/midtrans-payment.js
@@ -3,6 +3,7 @@ import camelcaseObjectDeep from 'camelcase-object-deep'
import midtransClient from 'midtrans-client'
export default async function handler(req, res) {
+ const PPN = process.env.NEXT_PUBLIC_PPN
const { transactionId = null } = req.query
if (!transactionId) {
diff --git a/src/pages/google_merchant/products/[page].js b/src/pages/google_merchant/products/[page].js
index 0c2cf3c5..8395f839 100644
--- a/src/pages/google_merchant/products/[page].js
+++ b/src/pages/google_merchant/products/[page].js
@@ -6,6 +6,7 @@ import _ from 'lodash-contrib';
import { create } from 'xmlbuilder';
export async function getServerSideProps({ res, query }) {
+ const PPN = process.env.NEXT_PUBLIC_PPN
const titleContent = 'Indoteknik.com: B2B Industrial Supply & Solution';
const descriptionContent =
'Temukan pilihan produk B2B Industri & Alat Teknik untuk Perusahaan, UMKM & Pemerintah dengan lengkap, mudah dan transparan.';
@@ -77,7 +78,7 @@ export async function getServerSideProps({ res, query }) {
'g:availability': { '#text': availability },
'g:brand': { '#text': product.manufacture?.name || '' },
'g:price': {
- '#text': `${Math.round(product.lowestPrice.price * 1.11)} IDR`,
+ '#text': `${Math.round(product.lowestPrice.price * PPN)} IDR`,
},
};
@@ -93,7 +94,7 @@ export async function getServerSideProps({ res, query }) {
if (product.lowestPrice.discountPercentage > 0) {
item['g:sale_price'] = {
- '#text': `${Math.round(product.lowestPrice.priceDiscount * 1.11)} IDR`,
+ '#text': `${Math.round(product.lowestPrice.priceDiscount * PPN)} IDR`,
};
}
productItems.push(item);