Commit 39aa0048 authored by Trisno's avatar Trisno

debug metode pembayaran

parent 021bd1f6
...@@ -62,7 +62,7 @@ class ShoppingCart extends React.Component { ...@@ -62,7 +62,7 @@ class ShoppingCart extends React.Component {
let params = this.props.route.params; let params = this.props.route.params;
if (params != undefined) { if (params != undefined) {
if (params.outlet_change != undefined && params.outlet_change) { if (params.outlet_change != undefined && params.outlet_change) {
Axios.post(this.props.BASE_URL+'crm/v2/menu/get_list', { Axios.post(this.props.BASE_URL + 'crm/v2/menu/get_list', {
outlet_id: params.outlet_id outlet_id: params.outlet_id
}).then(res => { }).then(res => {
let data = res.data.data let data = res.data.data
...@@ -276,54 +276,105 @@ class ShoppingCart extends React.Component { ...@@ -276,54 +276,105 @@ class ShoppingCart extends React.Component {
} }
} else if (val == 'point') { } else if (val == 'point') {
if (this.props.type_pickup == true) { if (this.props.type_pickup == true) {
this.setState({ if (this.props.value_voucher == '') {
checkedBalance: false,
checkedPoint: true,
checkedBalancePoint: false,
pointsused: this.props.order_total,
balanceused: 0
})
} else {
this.setState({
checkedBalance: false,
checkedPoint: true,
checkedBalancePoint: false,
pointsused: this.props.order_total + this.props.grabamount,
balanceused: 0
})
}
} else {
this.setState({
checkedBalance: false,
checkedPoint: false,
checkedBalancePoint: true,
})
if (this.props.type_pickup == true) {
if (this.state.kasproPoint - this.props.order_total >= -1) {
this.setState({ this.setState({
checkedBalance: false,
checkedPoint: true,
checkedBalancePoint: false,
pointsused: this.props.order_total, pointsused: this.props.order_total,
balanceused: 0 balanceused: 0
}) })
} else { } else {
this.setState({ this.setState({
balanceused: this.props.order_total - this.state.kasproPoint, checkedBalance: false,
pointsused: this.state.kasproPoint checkedPoint: true,
checkedBalancePoint: false,
pointsused: Math.max(0, this.props.order_total - this.props.voucher.reward.value),
balanceused: 0
}) })
} }
} else { } else {
if (this.state.kasproPoint - (this.props.order_total + this.props.grabamount) >= -1) { if (this.props.value_voucher == '') {
this.setState({ this.setState({
checkedBalance: false,
checkedPoint: true,
checkedBalancePoint: false,
pointsused: this.props.order_total + this.props.grabamount, pointsused: this.props.order_total + this.props.grabamount,
balanceused: 0 balanceused: 0
}) })
} else { } else {
this.setState({ this.setState({
balanceused: (this.props.order_total + this.props.grabamount) - this.state.kasproPoint, checkedBalance: false,
pointsused: this.state.kasproPoint checkedPoint: true,
checkedBalancePoint: false,
pointsused: Math.max(0, this.props.order_total - this.props.voucher.reward.value + this.props.grabamount),
balanceused: 0
}) })
} }
} }
} else {
this.setState({
checkedBalance: false,
checkedPoint: false,
checkedBalancePoint: true,
})
if (this.props.type_pickup == true) {
if (this.props.value_voucher == '') {
if (this.state.kasproPoint - this.props.order_total >= -1) {
this.setState({
pointsused: this.props.order_total,
balanceused: 0
})
} else {
this.setState({
balanceused: this.props.order_total - this.state.kasproPoint,
pointsused: this.state.kasproPoint
})
}
} else {
////////////// JIKA KASPRO POINT TIDAK HABIS DIKURANG TOTAL SETELAH DIKURANGI VOUCHER //////////////////
if (this.state.kasproPoint - (parseInt(this.props.order_total) - parseInt(this.props.voucher.reward.value)) >= -1) {
this.setState({
pointsused: Math.max(0, this.props.order_total - this.props.voucher.reward.value),
balanceused: 0
})
} /////////// JIKA KASPRO POINT KURANG DARI TOTAL SETELAH DIKURANGI VOUCHER/////////
else {
this.setState({
balanceused: (parseInt(this.props.order_total) - parseInt(this.props.voucher.reward.value)) - parseInt(this.state.kasproPoint),
pointsused: this.state.kasproPoint
})
}
}
} else {
if (this.props.value_voucher == '') {
if (this.state.kasproPoint - (this.props.order_total + this.props.grabamount) >= -1) {
this.setState({
pointsused: this.props.order_total + this.props.grabamount,
balanceused: 0
})
} else {
this.setState({
balanceused: (this.props.order_total + this.props.grabamount) - this.state.kasproPoint,
pointsused: this.state.kasproPoint
})
}
} else {
if (this.state.kasproPoint - ((parseInt(this.props.order_total) - parseInt(this.props.voucher.reward.value)) + this.props.grabamount) >= -1) {
this.setState({
pointsused: this.props.order_total + this.props.grabamount,
balanceused: 0
})
} else {
this.setState({
balanceused: (this.props.order_total + this.props.grabamount) - this.state.kasproPoint,
pointsused: this.state.kasproPoint
})
}
}
}
} }
} }
...@@ -336,7 +387,7 @@ class ShoppingCart extends React.Component { ...@@ -336,7 +387,7 @@ class ShoppingCart extends React.Component {
// console.log("INI PRAMETER NYA : " + JSON.stringify(params)) // console.log("INI PRAMETER NYA : " + JSON.stringify(params))
Axios.post(this.props.BASE_URL+'crm/v2/delivery/rate', params).then(res => { Axios.post(this.props.BASE_URL + 'crm/v2/delivery/rate', params).then(res => {
this.setState({ this.setState({
grabamount: res.data.data.amount, grabamount: res.data.data.amount,
...@@ -405,7 +456,7 @@ class ShoppingCart extends React.Component { ...@@ -405,7 +456,7 @@ class ShoppingCart extends React.Component {
session_id: this.props.session_id, session_id: this.props.session_id,
} }
Axios.post(this.props.BASE_URL+'crm/v2/member/get_profile', params).then(res => { Axios.post(this.props.BASE_URL + 'crm/v2/member/get_profile', params).then(res => {
const { kaspro_balance, kaspro_point } = res.data const { kaspro_balance, kaspro_point } = res.data
this.setState({ this.setState({
kasproBalance: kaspro_balance.replace(/,/g, ''), kasproBalance: kaspro_balance.replace(/,/g, ''),
...@@ -428,7 +479,7 @@ class ShoppingCart extends React.Component { ...@@ -428,7 +479,7 @@ class ShoppingCart extends React.Component {
// console.log(parseInt(this.state.kasproPoint) + parseInt(this.state.kasproBalance) + ' balance dan point') // console.log(parseInt(this.state.kasproPoint) + parseInt(this.state.kasproBalance) + ' balance dan point')
// console.log(this.props.order_total + this.props.grabamount + ' total belanja dan ongkir') // console.log(this.props.order_total + this.props.grabamount + ' total belanja dan ongkir')
// console.log(this.state.kasproPoint + this.state.kasproBalance >= this.props.order_total + this.props.grabamount && this.state.kasproBalance != 0 && this.state.kasproPoint != 0) // console.log(this.state.kasproPoint + this.state.kasproBalance >= this.props.order_total + this.props.grabamount && this.state.kasproBalance != 0 && this.state.kasproPoint != 0)
return ( return (
<ScrollView style={styles.container}> <ScrollView style={styles.container}>
<MyStatusBar /> <MyStatusBar />
...@@ -606,7 +657,7 @@ class ShoppingCart extends React.Component { ...@@ -606,7 +657,7 @@ class ShoppingCart extends React.Component {
</View> </View>
<View style={{ alignItems: 'center' }}> <View style={{ alignItems: 'center' }}>
{ {
parseInt(this.state.kasproPoint) + parseInt(this.state.kasproBalance) >= this.props.order_total + this.props.grabamount && this.state.kasproBalance != 0 && this.state.kasproPoint != 0 && this.props.order_total != 0 ? ( parseInt(this.state.kasproPoint) + parseInt(this.state.kasproBalance) >= this.props.order_total + this.props.grabamount && this.state.kasproBalance != 0 && this.state.kasproPoint != 0 && this.props.order_total != 0 ? (
<TouchableOpacity onPress={() => { <TouchableOpacity onPress={() => {
this.checkedSelection('balancepoint') this.checkedSelection('balancepoint')
}}> }}>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment