Commit a094720c authored by Trisno's avatar Trisno

revisi fix issue voucher expired di shopping cart

parent df84fb14
...@@ -94,9 +94,50 @@ class ShoppingCart extends React.Component { ...@@ -94,9 +94,50 @@ class ShoppingCart extends React.Component {
} }
checkExpiredReward() { checkExpiredReward() {
let type_trans = ""
if (this.props.type_pickup == true) {
type_trans = 'Pickup'
} else {
type_trans = 'Delivery'
}
let params = {
session_id: this.props.session_id,
trans_type: type_trans,
order_item: this.props.order_item,
reward_id: this.props.voucher.id,
delivery_charge: this.props.grabamount,
}
// MULAI DISINI PEMANGGILAN API DI MULAI, KALAU BERHASIL SET VALUE VOUCHER NYA DAN SPINER DIMATIKAN, KALAU GAGAL CABUT SESSION VOUCHER DAN SPINNER DI MATIKAN
Axios.post(this.props.BASE_URL + 'crm/v2/reward/get_value', params).then(res => {
// console.log(res.data)
let voucherProps = {
value_voucher: res.data.reward,
voucher: res.data.reward
}
this.props.setVoucher(voucherProps);
}).catch(error => {
try {
let response = error.response.data
Alert.alert("", response.msg)
this.setState({
spinner: false,
})
// FUNGSI REDUX UNTUK HAPUS VOUCHER
this.props.removeVoucher()
} catch (error) {
Alert.alert("", error.toString())
this.setState({
spinner: false,
})
}
})
let date_time_now = new Date() let date_time_now = new Date()
console.log(date_time_now) // console.log(date_time_now)
console.log(this.props.value_voucher.expire_time) // console.log(this.props.value_voucher.expire_time)
// console.log(this.props.value_voucher)
if (date_time_now > this.props.value_voucher.expire_time) { if (date_time_now > this.props.value_voucher.expire_time) {
this.props.removeVoucher() this.props.removeVoucher()
} }
......
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