mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/exchange-2.0.git
synced 2026-08-19 04:23:55 +00:00
working with promo code
This commit is contained in:
@@ -270,15 +270,22 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-6 ml-auto mr-0 p-t-10 p-b-10">
|
||||
<div class="col-6 p-t-10 p-b-10">
|
||||
<div class="no-padding text-left">
|
||||
<div class="font-heading all-caps">Promo Code</div>
|
||||
<div class="form-group no-margin form-group-default">
|
||||
<label>Enter promo code</label>
|
||||
<input type="text" class="form-control">
|
||||
<input v-model="promoCode" type="text" class="form-control">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-6 d-flex align-items-center pt-3" v-if="promoCode">
|
||||
<div class="col-auto p-l-0" style="">
|
||||
<button @click="applyPromocoe()" class="btn btn-sm h-100 btn-primary b-rad-none all-caps">
|
||||
Apply
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -312,6 +319,7 @@
|
||||
dropdownStatus: false,
|
||||
account_no: '',
|
||||
step:1,
|
||||
promoCode:""
|
||||
|
||||
}
|
||||
},
|
||||
@@ -342,6 +350,46 @@
|
||||
this.createBank = false;
|
||||
this.account_no = '';
|
||||
this.parameters.bankAccount = {};
|
||||
},
|
||||
applyPromocoe(){
|
||||
let promoRequestObj = {
|
||||
category : 'New cat 4',
|
||||
discount: {
|
||||
"percent_off": 10.0,
|
||||
"type": "PERCENT"
|
||||
},
|
||||
redemption: {
|
||||
quantity: 10
|
||||
},
|
||||
start_date: "2016-01-01T00:00:00Z",
|
||||
expiration_date: "2016-12-31T23:59:59Z",
|
||||
order: {
|
||||
amount: 10,
|
||||
currency: "USD",
|
||||
id: "order_1234523"
|
||||
}
|
||||
};
|
||||
this.isLoading = true;
|
||||
return fetch('https://as1.api.voucherify.io/v1/vouchers/dummy2/redemption', {
|
||||
method: 'POST',
|
||||
responseType: 'json',
|
||||
body: promoRequestObj,
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
'X-App-Token': '09a22aa9-f287-4813-9c65-6baa43091a6e',
|
||||
'X-App-Id': 'e12347c6-b072-4318-9a2b-179a7a3b1414'
|
||||
}
|
||||
}).then(response => {
|
||||
|
||||
console.log(response);
|
||||
|
||||
if(response.status === 401 && window.location.href !== route('login')){
|
||||
dispatch('userAuthentication', {access_token: '', redirect_url: '/'});
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
})
|
||||
}
|
||||
},
|
||||
mixins: [FormHandler]
|
||||
|
||||
Reference in New Issue
Block a user