|
|
@ -97,6 +97,8 @@ const PaymentMethodItem = ({ |
|
|
|
isPaypalExpanded?: boolean; |
|
|
|
isPaypalExpanded?: boolean; |
|
|
|
}) => { |
|
|
|
}) => { |
|
|
|
const { t } = useTranslation(); |
|
|
|
const { t } = useTranslation(); |
|
|
|
|
|
|
|
const { user } = useUserStore(); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<View> |
|
|
|
<View> |
|
|
|
<TouchableOpacity style={styles.cardContainer} onPress={onSelect}> |
|
|
|
<TouchableOpacity style={styles.cardContainer} onPress={onSelect}> |
|
|
@ -111,8 +113,8 @@ const PaymentMethodItem = ({ |
|
|
|
<Text style={styles.balanceText}> |
|
|
|
<Text style={styles.balanceText}> |
|
|
|
{t("balance.recharge.balance_remaining") || "Balance remaining"} |
|
|
|
{t("balance.recharge.balance_remaining") || "Balance remaining"} |
|
|
|
{"\n"} |
|
|
|
{"\n"} |
|
|
|
{useUserStore().user.balance} |
|
|
|
{user.balance} |
|
|
|
{useUserStore().user.currency} |
|
|
|
{user.currency} |
|
|
|
</Text> |
|
|
|
</Text> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
) : ( |
|
|
|
) : ( |
|
|
@ -458,7 +460,7 @@ export const PaymentMethod = () => { |
|
|
|
createOrderData.items = items; |
|
|
|
createOrderData.items = items; |
|
|
|
createOrderData.payment_method = selectedPayment; |
|
|
|
createOrderData.payment_method = selectedPayment; |
|
|
|
createOrderData.total_amount = |
|
|
|
createOrderData.total_amount = |
|
|
|
selectedPayment === "Paypal" |
|
|
|
selectedPayment === "paypal" |
|
|
|
? convertedAmount.reduce( |
|
|
|
? convertedAmount.reduce( |
|
|
|
(acc, item) => acc + item.converted_amount, |
|
|
|
(acc, item) => acc + item.converted_amount, |
|
|
|
0 |
|
|
|
0 |
|
|
@ -471,7 +473,7 @@ export const PaymentMethod = () => { |
|
|
|
).toFixed(2) |
|
|
|
).toFixed(2) |
|
|
|
); |
|
|
|
); |
|
|
|
createOrderData.actual_amount = |
|
|
|
createOrderData.actual_amount = |
|
|
|
selectedPayment === "Paypal" |
|
|
|
selectedPayment === "paypal" |
|
|
|
? convertedAmount.reduce( |
|
|
|
? convertedAmount.reduce( |
|
|
|
(acc, item) => acc + item.converted_amount, |
|
|
|
(acc, item) => acc + item.converted_amount, |
|
|
|
0 |
|
|
|
0 |
|
|
@ -484,15 +486,15 @@ export const PaymentMethod = () => { |
|
|
|
).toFixed(2) |
|
|
|
).toFixed(2) |
|
|
|
); |
|
|
|
); |
|
|
|
createOrderData.currency = |
|
|
|
createOrderData.currency = |
|
|
|
selectedPayment === "Paypal" ? selectedCurrency : user.currency; |
|
|
|
selectedPayment === "paypal" ? selectedCurrency : user.currency; |
|
|
|
createOrderData.domestic_shipping_fee = |
|
|
|
createOrderData.domestic_shipping_fee = |
|
|
|
selectedPayment === "Paypal" |
|
|
|
selectedPayment === "paypal" |
|
|
|
? convertedAmount.find( |
|
|
|
? convertedAmount.find( |
|
|
|
(item) => item.item_key === "domestic_shipping_fee" |
|
|
|
(item) => item.item_key === "domestic_shipping_fee" |
|
|
|
)?.converted_amount || 0 |
|
|
|
)?.converted_amount || 0 |
|
|
|
: orderData?.domestic_shipping_fee; |
|
|
|
: orderData?.domestic_shipping_fee; |
|
|
|
createOrderData.shipping_fee = |
|
|
|
createOrderData.shipping_fee = |
|
|
|
selectedPayment === "Paypal" |
|
|
|
selectedPayment === "paypal" |
|
|
|
? convertedAmount.find((item) => item.item_key === "shipping_fee") |
|
|
|
? convertedAmount.find((item) => item.item_key === "shipping_fee") |
|
|
|
?.converted_amount || 0 |
|
|
|
?.converted_amount || 0 |
|
|
|
: orderData?.shipping_fee; |
|
|
|
: orderData?.shipping_fee; |
|
|
@ -502,7 +504,7 @@ export const PaymentMethod = () => { |
|
|
|
pay_method: selectedPayment, |
|
|
|
pay_method: selectedPayment, |
|
|
|
offline_payment: currentTab === "offline" ? 0 : 1, |
|
|
|
offline_payment: currentTab === "offline" ? 0 : 1, |
|
|
|
all_price: |
|
|
|
all_price: |
|
|
|
selectedPayment === "Paypal" |
|
|
|
selectedPayment === "paypal" |
|
|
|
? convertedAmount.reduce( |
|
|
|
? convertedAmount.reduce( |
|
|
|
(acc, item) => acc + item.converted_amount, |
|
|
|
(acc, item) => acc + item.converted_amount, |
|
|
|
0 |
|
|
|
0 |
|
|
@ -564,9 +566,9 @@ export const PaymentMethod = () => { |
|
|
|
data: res, |
|
|
|
data: res, |
|
|
|
payMethod: selectedPayment, |
|
|
|
payMethod: selectedPayment, |
|
|
|
currency: |
|
|
|
currency: |
|
|
|
selectedPayment === "Paypal" ? selectedCurrency : user.currency, |
|
|
|
selectedPayment === "paypal" ? selectedCurrency : user.currency, |
|
|
|
amount: |
|
|
|
amount: |
|
|
|
selectedPayment === "Paypal" |
|
|
|
selectedPayment === "paypal" |
|
|
|
? convertedAmount.reduce( |
|
|
|
? convertedAmount.reduce( |
|
|
|
(acc, item) => acc + item.converted_amount, |
|
|
|
(acc, item) => acc + item.converted_amount, |
|
|
|
0 |
|
|
|
0 |
|
|
@ -731,12 +733,12 @@ export const PaymentMethod = () => { |
|
|
|
<Text>{t("payment.product_total")}</Text> |
|
|
|
<Text>{t("payment.product_total")}</Text> |
|
|
|
<View> |
|
|
|
<View> |
|
|
|
<Text> |
|
|
|
<Text> |
|
|
|
{selectedPayment === "Paypal" |
|
|
|
{selectedPayment === "paypal" |
|
|
|
? convertedAmount.find( |
|
|
|
? convertedAmount.find( |
|
|
|
(item) => item.item_key === "total_amount" |
|
|
|
(item) => item.item_key === "total_amount" |
|
|
|
)?.converted_amount || 0 |
|
|
|
)?.converted_amount || 0 |
|
|
|
: previewOrder?.total_amount || 0}{" "} |
|
|
|
: previewOrder?.total_amount || 0}{" "} |
|
|
|
{selectedPayment === "Paypal" |
|
|
|
{selectedPayment === "paypal" |
|
|
|
? selectedCurrency === "USD" |
|
|
|
? selectedCurrency === "USD" |
|
|
|
? "USD" |
|
|
|
? "USD" |
|
|
|
: "EUR" |
|
|
|
: "EUR" |
|
|
@ -748,12 +750,12 @@ export const PaymentMethod = () => { |
|
|
|
<Text>{t("payment.domestic_shipping")}</Text> |
|
|
|
<Text>{t("payment.domestic_shipping")}</Text> |
|
|
|
<View> |
|
|
|
<View> |
|
|
|
<Text> |
|
|
|
<Text> |
|
|
|
{selectedPayment === "Paypal" |
|
|
|
{selectedPayment === "paypal" |
|
|
|
? convertedAmount.find( |
|
|
|
? convertedAmount.find( |
|
|
|
(item) => item.item_key === "domestic_shipping_fee" |
|
|
|
(item) => item.item_key === "domestic_shipping_fee" |
|
|
|
)?.converted_amount || 0 |
|
|
|
)?.converted_amount || 0 |
|
|
|
: orderData?.domestic_shipping_fee || 0}{" "} |
|
|
|
: orderData?.domestic_shipping_fee || 0}{" "} |
|
|
|
{selectedPayment === "Paypal" |
|
|
|
{selectedPayment === "paypal" |
|
|
|
? selectedCurrency === "USD" |
|
|
|
? selectedCurrency === "USD" |
|
|
|
? "USD" |
|
|
|
? "USD" |
|
|
|
: "EUR" |
|
|
|
: "EUR" |
|
|
@ -765,12 +767,12 @@ export const PaymentMethod = () => { |
|
|
|
<Text>{t("payment.international_shipping")}</Text> |
|
|
|
<Text>{t("payment.international_shipping")}</Text> |
|
|
|
<View> |
|
|
|
<View> |
|
|
|
<Text> |
|
|
|
<Text> |
|
|
|
{selectedPayment === "Paypal" |
|
|
|
{selectedPayment === "paypal" |
|
|
|
? convertedAmount.find( |
|
|
|
? convertedAmount.find( |
|
|
|
(item) => item.item_key === "shipping_fee" |
|
|
|
(item) => item.item_key === "shipping_fee" |
|
|
|
)?.converted_amount || 0 |
|
|
|
)?.converted_amount || 0 |
|
|
|
: orderData?.shipping_fee || 0}{" "} |
|
|
|
: orderData?.shipping_fee || 0}{" "} |
|
|
|
{selectedPayment === "Paypal" |
|
|
|
{selectedPayment === "paypal" |
|
|
|
? selectedCurrency === "USD" |
|
|
|
? selectedCurrency === "USD" |
|
|
|
? "USD" |
|
|
|
? "USD" |
|
|
|
: "EUR" |
|
|
|
: "EUR" |
|
|
@ -791,7 +793,7 @@ export const PaymentMethod = () => { |
|
|
|
> |
|
|
|
> |
|
|
|
{t("payment.total")} |
|
|
|
{t("payment.total")} |
|
|
|
</Text> |
|
|
|
</Text> |
|
|
|
{selectedPayment === "Paypal" && |
|
|
|
{selectedPayment === "paypal" && |
|
|
|
selectedCurrency !== user.currency && ( |
|
|
|
selectedCurrency !== user.currency && ( |
|
|
|
<View style={{ flexDirection: "row" }}> |
|
|
|
<View style={{ flexDirection: "row" }}> |
|
|
|
<Text |
|
|
|
<Text |
|
|
@ -827,7 +829,7 @@ export const PaymentMethod = () => { |
|
|
|
</Text> |
|
|
|
</Text> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
)} |
|
|
|
)} |
|
|
|
{selectedPayment === "Paypal" && |
|
|
|
{selectedPayment === "paypal" && |
|
|
|
selectedCurrency === user.currency && ( |
|
|
|
selectedCurrency === user.currency && ( |
|
|
|
<View style={{ flexDirection: "row" }}> |
|
|
|
<View style={{ flexDirection: "row" }}> |
|
|
|
<Text |
|
|
|
<Text |
|
|
@ -847,7 +849,7 @@ export const PaymentMethod = () => { |
|
|
|
</Text> |
|
|
|
</Text> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
)} |
|
|
|
)} |
|
|
|
{selectedPayment !== "Paypal" && ( |
|
|
|
{selectedPayment !== "paypal" && ( |
|
|
|
<Text |
|
|
|
<Text |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
fontSize: fontSize(18), |
|
|
|
fontSize: fontSize(18), |
|
|
@ -998,8 +1000,8 @@ const styles = StyleSheet.create({ |
|
|
|
color: "#666", |
|
|
|
color: "#666", |
|
|
|
}, |
|
|
|
}, |
|
|
|
radioButton: { |
|
|
|
radioButton: { |
|
|
|
width: 20, |
|
|
|
width: widthUtils(20, 20).width, |
|
|
|
height: 20, |
|
|
|
height: widthUtils(20, 20).height, |
|
|
|
borderRadius: 10, |
|
|
|
borderRadius: 10, |
|
|
|
borderWidth: 1, |
|
|
|
borderWidth: 1, |
|
|
|
borderColor: "#CCCCCC", |
|
|
|
borderColor: "#CCCCCC", |
|
|
@ -1007,8 +1009,8 @@ const styles = StyleSheet.create({ |
|
|
|
alignItems: "center", |
|
|
|
alignItems: "center", |
|
|
|
}, |
|
|
|
}, |
|
|
|
radioInner: { |
|
|
|
radioInner: { |
|
|
|
width: 12, |
|
|
|
width: widthUtils(12, 12).width, |
|
|
|
height: 12, |
|
|
|
height: widthUtils(12, 12).height, |
|
|
|
borderRadius: 6, |
|
|
|
borderRadius: 6, |
|
|
|
backgroundColor: "transparent", |
|
|
|
backgroundColor: "transparent", |
|
|
|
}, |
|
|
|
}, |
|
|
@ -1186,7 +1188,7 @@ const styles = StyleSheet.create({ |
|
|
|
}, |
|
|
|
}, |
|
|
|
primaryButtonStyle: { |
|
|
|
primaryButtonStyle: { |
|
|
|
width: "100%", |
|
|
|
width: "100%", |
|
|
|
height: 50, |
|
|
|
height: widthUtils(50, 50).height, |
|
|
|
justifyContent: "center", |
|
|
|
justifyContent: "center", |
|
|
|
alignItems: "center", |
|
|
|
alignItems: "center", |
|
|
|
fontWeight: "600", |
|
|
|
fontWeight: "600", |
|
|
@ -1318,7 +1320,7 @@ const styles = StyleSheet.create({ |
|
|
|
}, |
|
|
|
}, |
|
|
|
submitButton: { |
|
|
|
submitButton: { |
|
|
|
width: "100%", |
|
|
|
width: "100%", |
|
|
|
height: 50, |
|
|
|
height: widthUtils(50, 50).height, |
|
|
|
justifyContent: "center", |
|
|
|
justifyContent: "center", |
|
|
|
alignItems: "center", |
|
|
|
alignItems: "center", |
|
|
|
backgroundColor: "#FF5100", |
|
|
|
backgroundColor: "#FF5100", |
|
|
@ -1379,56 +1381,65 @@ const styles = StyleSheet.create({ |
|
|
|
flexDirection: "row", |
|
|
|
flexDirection: "row", |
|
|
|
alignItems: "center", |
|
|
|
alignItems: "center", |
|
|
|
justifyContent: "space-between", |
|
|
|
justifyContent: "space-between", |
|
|
|
padding: 15, |
|
|
|
paddingHorizontal: 15, |
|
|
|
|
|
|
|
paddingVertical: 10, |
|
|
|
backgroundColor: "#F8F8F8", |
|
|
|
backgroundColor: "#F8F8F8", |
|
|
|
borderRadius: 8, |
|
|
|
borderRadius: 8, |
|
|
|
marginBottom: 10, |
|
|
|
marginBottom: 10, |
|
|
|
|
|
|
|
minHeight: 60, |
|
|
|
}, |
|
|
|
}, |
|
|
|
leftInfo: { |
|
|
|
leftInfo: { |
|
|
|
flexDirection: "row", |
|
|
|
flexDirection: "row", |
|
|
|
alignItems: "center", |
|
|
|
alignItems: "center", |
|
|
|
|
|
|
|
flex: 1, |
|
|
|
}, |
|
|
|
}, |
|
|
|
blueBox: { |
|
|
|
blueBox: { |
|
|
|
|
|
|
|
|
|
|
|
borderRadius: 4, |
|
|
|
borderRadius: 4, |
|
|
|
justifyContent: "center", |
|
|
|
justifyContent: "center", |
|
|
|
alignItems: "center", |
|
|
|
alignItems: "center", |
|
|
|
marginRight: 10, |
|
|
|
marginRight: 10, |
|
|
|
|
|
|
|
width: widthUtils(30, 80).width, |
|
|
|
|
|
|
|
height: widthUtils(30, 30).height, |
|
|
|
|
|
|
|
backgroundColor: "#3955f6", |
|
|
|
}, |
|
|
|
}, |
|
|
|
operatorImage: { |
|
|
|
operatorImage: { |
|
|
|
width: 60, |
|
|
|
width: widthUtils(30, 80).width, |
|
|
|
height: 22, |
|
|
|
height: widthUtils(30, 30).height, |
|
|
|
borderRadius: 4, |
|
|
|
borderRadius: 4, |
|
|
|
|
|
|
|
resizeMode: "contain", |
|
|
|
}, |
|
|
|
}, |
|
|
|
balanceText: { |
|
|
|
balanceText: { |
|
|
|
fontSize: fontSize(14), |
|
|
|
fontSize: fontSize(14), |
|
|
|
fontWeight: "500", |
|
|
|
fontWeight: "500", |
|
|
|
color: "#030303", |
|
|
|
color: "#030303", |
|
|
|
|
|
|
|
marginLeft: 10, |
|
|
|
|
|
|
|
lineHeight: 18, |
|
|
|
}, |
|
|
|
}, |
|
|
|
iconRow: { |
|
|
|
iconRow: { |
|
|
|
flexDirection: "row", |
|
|
|
flexDirection: "row", |
|
|
|
alignItems: "center", |
|
|
|
alignItems: "center", |
|
|
|
|
|
|
|
flex: 1, |
|
|
|
}, |
|
|
|
}, |
|
|
|
imageContainer: { |
|
|
|
imageContainer: { |
|
|
|
width: 40, |
|
|
|
flexDirection: "column", |
|
|
|
height: 40, |
|
|
|
alignItems: "flex-start", |
|
|
|
borderRadius: 4, |
|
|
|
|
|
|
|
marginRight: 10, |
|
|
|
|
|
|
|
}, |
|
|
|
}, |
|
|
|
mobileMoneyTextContainer: { |
|
|
|
mobileMoneyTextContainer: { |
|
|
|
flexDirection: "row", |
|
|
|
flexDirection: "row", |
|
|
|
alignItems: "center", |
|
|
|
alignItems: "center", |
|
|
|
|
|
|
|
marginTop: 5, |
|
|
|
}, |
|
|
|
}, |
|
|
|
mobileMoneyImgContainer: { |
|
|
|
mobileMoneyImgContainer: { |
|
|
|
width: 60, |
|
|
|
width: widthUtils(30, 80).width, |
|
|
|
height: 22, |
|
|
|
height: widthUtils(30, 30).height, |
|
|
|
borderWidth: 0, |
|
|
|
borderWidth: 0, |
|
|
|
marginRight: 5, |
|
|
|
marginRight: 5, |
|
|
|
}, |
|
|
|
}, |
|
|
|
mobileMoneyImg: { |
|
|
|
mobileMoneyImg: { |
|
|
|
width: 60, |
|
|
|
width: widthUtils(30, 80).width, |
|
|
|
height: 22, |
|
|
|
height: widthUtils(30, 30).height, |
|
|
|
borderWidth: 0, |
|
|
|
borderWidth: 0, |
|
|
|
|
|
|
|
resizeMode: "contain", |
|
|
|
}, |
|
|
|
}, |
|
|
|
mobileMoneyText: { |
|
|
|
mobileMoneyText: { |
|
|
|
fontSize: fontSize(16), |
|
|
|
fontSize: fontSize(16), |
|
|
@ -1441,6 +1452,7 @@ const styles = StyleSheet.create({ |
|
|
|
height: fontSize(24), |
|
|
|
height: fontSize(24), |
|
|
|
justifyContent: "center", |
|
|
|
justifyContent: "center", |
|
|
|
alignItems: "center", |
|
|
|
alignItems: "center", |
|
|
|
|
|
|
|
marginLeft: 10, |
|
|
|
}, |
|
|
|
}, |
|
|
|
checkmarkContainer: { |
|
|
|
checkmarkContainer: { |
|
|
|
position: "absolute", |
|
|
|
position: "absolute", |
|
|
|