Add support for package payment methods and basic checkout proccess
This commit is contained in:
@@ -29,19 +29,49 @@ export const recieveProfileInfo = (json) => ({
|
||||
export const fetchProfileInfo = (idUser) => {
|
||||
return dispatch => {
|
||||
dispatch(requestProfileInfo());
|
||||
return client.fetch({
|
||||
url: `${API_SERVER}/profileSettings/api/getProfileInfo`,
|
||||
method: 'post',
|
||||
data: {idUser}
|
||||
})
|
||||
.then(response => {
|
||||
if(response.data){
|
||||
dispatch(recieveProfileInfo(response.data));
|
||||
|
||||
dispatch(recieveProfileInfo({
|
||||
"id": 2,
|
||||
"name": "Customer User",
|
||||
"mail": "customer@mail.com",
|
||||
"phone": "",
|
||||
"userType": "customer",
|
||||
"vatCode": "556084-6783",
|
||||
"companyName": "Coor Service Management AB",
|
||||
"billingAddresses": [
|
||||
{
|
||||
"id": 1,
|
||||
"city": "Göteborg",
|
||||
"countryName": "SE",
|
||||
"detailedAddress": "Lilla Bommen 2",
|
||||
"firstName": "Customer",
|
||||
"lastName": "User",
|
||||
"zipCode": "12323"
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
client.onError(error, dispatch);
|
||||
});
|
||||
],
|
||||
"profileAddresses": [
|
||||
{
|
||||
"id": 1,
|
||||
"city": "Göteborg",
|
||||
"countryName": "Göteborg",
|
||||
"detailedAddress": "Lilla Bommen 2",
|
||||
"zipCode": "12323"
|
||||
}
|
||||
]
|
||||
}));
|
||||
// return client.fetch({
|
||||
// url: `${API_SERVER}/wp-json/wiaas/cart/customer-info`,
|
||||
// method: 'get',
|
||||
// data: {idUser}
|
||||
// })
|
||||
// .then(response => {
|
||||
// if(response.data){
|
||||
// dispatch(recieveProfileInfo(response.data));
|
||||
// }
|
||||
// })
|
||||
// .catch(error => {
|
||||
// client.onError(error, dispatch);
|
||||
// });
|
||||
}
|
||||
};
|
||||
|
||||
@@ -107,17 +137,32 @@ const recieveCountries = (json) => ({
|
||||
export const fetchCountries = () => {
|
||||
return dispatch => {
|
||||
dispatch(requestCountries());
|
||||
return client.fetch({
|
||||
url: `${API_SERVER}/profileSettings/api/getCoutnries`,
|
||||
method: 'get'
|
||||
})
|
||||
.then(response => {
|
||||
if(response.data){
|
||||
dispatch(recieveCountries(response.data));
|
||||
}
|
||||
})
|
||||
.catch(error => {
|
||||
client.onError(error, dispatch);
|
||||
});
|
||||
|
||||
dispatch(recieveCountries([
|
||||
{
|
||||
"idCountry": 3,
|
||||
"countryName": "Denmark"
|
||||
},
|
||||
{
|
||||
"idCountry": 4,
|
||||
"countryName": "Finland"
|
||||
},
|
||||
{
|
||||
"idCountry": 2,
|
||||
"countryName": "Sweden"
|
||||
}
|
||||
]));
|
||||
// return client.fetch({
|
||||
// url: `${API_SERVER}/profileSettings/api/getCoutnries`,
|
||||
// method: 'get'
|
||||
// })
|
||||
// .then(response => {
|
||||
// if(response.data){
|
||||
// dispatch(recieveCountries(response.data));
|
||||
// }
|
||||
// })
|
||||
// .catch(error => {
|
||||
// client.onError(error, dispatch);
|
||||
// });
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user