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,6 +276,7 @@ class ShoppingCart extends React.Component { ...@@ -276,6 +276,7 @@ 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) {
if (this.props.value_voucher == '') {
this.setState({ this.setState({
checkedBalance: false, checkedBalance: false,
checkedPoint: true, checkedPoint: true,
...@@ -284,6 +285,16 @@ class ShoppingCart extends React.Component { ...@@ -284,6 +285,16 @@ class ShoppingCart extends React.Component {
balanceused: 0 balanceused: 0
}) })
} else { } else {
this.setState({
checkedBalance: false,
checkedPoint: true,
checkedBalancePoint: false,
pointsused: Math.max(0, this.props.order_total - this.props.voucher.reward.value),
balanceused: 0
})
}
} else {
if (this.props.value_voucher == '') {
this.setState({ this.setState({
checkedBalance: false, checkedBalance: false,
checkedPoint: true, checkedPoint: true,
...@@ -291,6 +302,15 @@ class ShoppingCart extends React.Component { ...@@ -291,6 +302,15 @@ class ShoppingCart extends React.Component {
pointsused: this.props.order_total + this.props.grabamount, pointsused: this.props.order_total + this.props.grabamount,
balanceused: 0 balanceused: 0
}) })
} else {
this.setState({
checkedBalance: false,
checkedPoint: true,
checkedBalancePoint: false,
pointsused: Math.max(0, this.props.order_total - this.props.voucher.reward.value + this.props.grabamount),
balanceused: 0
})
}
} }
} else { } else {
this.setState({ this.setState({
...@@ -300,6 +320,7 @@ class ShoppingCart extends React.Component { ...@@ -300,6 +320,7 @@ class ShoppingCart extends React.Component {
}) })
if (this.props.type_pickup == true) { if (this.props.type_pickup == true) {
if (this.props.value_voucher == '') {
if (this.state.kasproPoint - this.props.order_total >= -1) { if (this.state.kasproPoint - this.props.order_total >= -1) {
this.setState({ this.setState({
pointsused: this.props.order_total, pointsused: this.props.order_total,
...@@ -312,6 +333,23 @@ class ShoppingCart extends React.Component { ...@@ -312,6 +333,23 @@ class ShoppingCart extends React.Component {
}) })
} }
} else { } 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) { if (this.state.kasproPoint - (this.props.order_total + this.props.grabamount) >= -1) {
this.setState({ this.setState({
pointsused: this.props.order_total + this.props.grabamount, pointsused: this.props.order_total + this.props.grabamount,
...@@ -323,6 +361,19 @@ class ShoppingCart extends React.Component { ...@@ -323,6 +361,19 @@ class ShoppingCart extends React.Component {
pointsused: 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, ''),
......
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