Repository URL to install this package:
|
Version:
2.0.11 ▾
|
import { Request } from '@skava/request'
import {
loginBaseURL,
logoutBaseUrl,
registerBaseUrl,
addaddressBaseUrl,
addcardBaseUrl,
deletecardBaseUrl,
updatePasswordUrl,
addSecurityQuestionUrl,
getProfileUrl,
updateProfileUrl,
resetPasswordByMailUrl,
validateResetEmailUrl,
validateResetSMSUrl,
getSecurityQuestionUrl,
resetPasswordBySQUrl,
// getTokenForTwitterUrl,
} from '../../../bootstrapper/api/config'
import {
loginParams,
registerParams,
registerGuestParams,
logoutParams,
addAddressParams,
removeAddressParams,
updateAddressParams,
changeDefaultAddressParams,
addCardParams,
deleteCardParams,
changeDefaultCardParams,
getProfileParams,
updateProfileParams,
updatePasswordParams,
addSecurityQuestionParams,
resetPasswordByEmailParams,
validateResetPasswordByEmailParams,
resetPasswordBySMSParams,
validateResetPasswordBySMSParams,
getSecurityQuestionsParams,
resetPasswordBySecurityQuestionsParams,
twittertokenParams,
} from './defaultParams'
// http:// localhost:3000/api/register?campaignId=2495&appid=skavastore&username=createuser&userinfo={"verificationDetails":{"userName":"bhargavi@skava.com","password":"Skava@123"},"email":"bhargavi@skava.com","firstName":"dsfds","lastName":"dsfds","nickName":"dsfds","phone":"9832746873","addresses":[{"type":"userIdentities","value":"skava","customParams":{"type":["0"]}}],"customParams":{"resetMethod":["4"],"status":["1"],"contactPreferences":["string"],"additionalPreferences":[""],"promotions":["string"],"preferences":["string"]}}&customparams={"messageCampaignId":"","locale":"en_US","sendWelcomeEmail":"true","validationMethod":"4","skipValidations":"1"}
const register = new Request()
.debug(true)
.params(registerParams)
.url(registerBaseUrl)
.post()
const registerGuest = new Request()
.params(registerGuestParams)
.url(registerBaseUrl)
.post()
// http://localhost:3000/api/login?campaignId=2495&appid=skavastore&userinfo={"userName":"loyaltyuser@skava.com","password":"Skava@123"}&customparams={"type":"0","value":"skava","messageCampaignId":"","promocode":"","promocampaign":"","locale":"","channel":""}
// http://localhost:3000/api/login?campaignId=2495&appid=skavastoreuserinfo={"userName":"9677877887","password":"Skava@1234"}&customparams={"type":"0","value":"skava","messageCampaignId":"","promocode":"","promocampaign":"","locale":"","channel":""}
const login = new Request()
.debug(true)
.params(loginParams)
.url(loginBaseURL)
.post()
// http://localhost:3000/api/logout?campaignId=2495&appid=skavastore
const logout = new Request()
.params(logoutParams)
.url(logoutBaseUrl)
.post()
// http://localhost:3000/api/setshippingaddress/update?campaignId=2495&appid=skavastore&address={"addresses":[{"type":"shippingAddress","firstName":"dsf","lastName":"dsfdsf","phone":"234 - 324 - 2342","addressLine1":"1%20Front%20Street","addressLine2":"","city":"San Francisco","country":"US","state":"CA","postalCode":"94111","customParams":{"validated":["true"],"override":["false"],"default":["false"]}}]}&customparams={"locale":"en_US","messageCampaignId":""}
const addAddress = new Request()
.url(addaddressBaseUrl)
.params(addAddressParams)
.post()
// http:// localhost:3000/api/setshippingaddress/update?campaignId=2495&appid=skavastore&address={"addresses":[{"type":"shippingAddressToDelete","firstName":"qwe","lastName":"dsfdsf","phone":"234 - 324 - 2342","addressLine1":"1 Front Street","addressLine2":"","city":"San Francisco","country":"US","state":"CA","postalCode":"94111","id":"fcf8cf28-7f44-4ae0-a392-53a8ccd09867","customParams":{"validated":["true"],"override":["false"],"default":["false"]}}]}&customparams={"locale":"en_US","messageCampaignId":""}
// @todo remove all unwanted default params
const removeAddress = new Request().url(addaddressBaseUrl).post()
// http://localhost:3000/api/setshippingaddress/update?campaignId=2495&appid=skavastore&address={"addresses":[{"type":"shippingAddress","firstName":"qwe","lastName":"dsfdsf","phone":"234 - 324 - 2342","addressLine1":"1%20Front%20Street","addressLine2":"","city":"San Francisco","country":"US","state":"CA","postalCode":"94111","id":"fcf8cf28-7f44-4ae0-a392-53a8ccd09867","customParams":{"validated":["true"],"override":["false"],"default":["false"]}}]}&customparams={"locale":"en_US","messageCampaignId":""}
const updateAddress = new Request()
.url(addaddressBaseUrl)
.params(updateAddressParams)
.post()
// http://localhost:3000/api/setshippingaddress/update?campaignId=2495&appid=skavastore&address={"addresses":[{"type":"shippingAddress","firstName":"qwe","lastName":"dsfdsf","phone":"234 - 324 - 2342","addressLine1":"1%20Front%20Street","addressLine2":"","city":"San Francisco","country":"US","state":"CA","postalCode":"94111","id":"fcf8cf28-7f44-4ae0-a392-53a8ccd09867","customParams":{"validated":["true"],"override":["false"],"default":["false"]}}]}&customparams={"locale":"en_US","messageCampaignId":""}
const changeDefaultAddress = new Request()
.url(addaddressBaseUrl)
.params(changeDefaultAddressParams)
.post()
// http://localhost:3000/api/setpaymentmethod?campaignId=2495&appid=skavastore&payment={%22creditCard%22:[{%22type%22:%22001%22,%22number%22:%224111111111111111%22,%22expirationMonth%22:%2212%22,%22expirationYear%22:%2234%22,%22name%22:%22dsf%20sdfds%22,%22customParams%22:{%22cardBrand%22:%22001%22,%22default%22:%22true%22}}],%22address%22:[{%22type%22:%22billingAddress%22,%22addressLine1%22:%225%20Doktor-Fritz-Guth-Stra%C3%9Fe%22,%22city%22:%22Rielasingen-Worblingen%22,%22state%22:%22BW%22,%22postalCode%22:%2278239%22,%22country%22:%22DE%22,%22email%22:%22bhargavi@skava.com%22,%22firstName%22:%22bhargavi%22,%22lastName%22:%22krish%22,%22phone%22:%22342%20-%20342%20-%203432%22,%22customParams%22:{%22validated%22:[%22true%22],%22override%22:[%22false%22],%22default%22:[%22false%22]}}]}&customparams={%22locale%22:%22en_US%22,%22channel%22:%22web%22,%22linkBAddrToCard%22:%22true%22,%22messageCampaignId%22:%22%22}
const addCard = new Request()
.url(addcardBaseUrl)
// .params(addCardParams)
.post()
// http://localhost:3000/api/deletecard?carddetail={%22cards%22:[{%22id%22:%22ecae9aa2-eff3-41c4-94e5-ab9b77bf2c2d%22}]}&customparams={%22type%22:%220%22,%22value%22:%22skava%22,%22userId%22:%22bhargavi@skava.com%22,%22messageCampaignId%22:%22%22}&campaignId=2495&appid=skavastore
const deleteCard = new Request()
.url(deletecardBaseUrl)
//.params(deleteCardParams)
.post()
// http://localhost:3000/api/setpaymentmethod?appid=skavastore&campaignId=2495&payment={"creditCard":[{"type":"001","expirationMonth":"12","expirationYear":"2034","id":"ec2ca990-812b-4fea-b63c-be97ac22008d","identifier":"0139591803701111","customParams":{"cardBrand":"001","default":"true","paymentToken":"0139591803701111"}}],"address":[{"type":"billingAddress","email":"bhargavi@skava.com","firstName":"bhargavi","lastName":"krish","customParams":{"validated":["true"],"override":["false"],"default":["false"],"id":["3ec50dab-4b7e-4429-befa-a9198d9bd407"]}}]}&customparams={"locale":"en_US","channel":"web","linkBAddrToCard":"true","messageCampaignId":""}
const changeDefaultCard = new Request()
.url(addcardBaseUrl)
//.params(changeDefaultCardParams)
.post()
// get profile data: http://localhost:{{PORT_NO}}/api/profile/get?campaignId={{campaignId}}&appid=skavastore&locale=en_US
const getProfile = new Request()
.url(getProfileUrl)
.params(getProfileParams)
.post()
// update profile data: http://localhost:3000/api/profile/update?campaignId=2495&appid=skavastore&locale=en_US&userinfo={"firstName":"yyy","lastName":"xxx"}&customparams:{"type":"0","value":"skava","userId":"xxx@yyyy.com"}
const updateProfile = new Request().url(updateProfileUrl).post()
// update password URL: http://localhost:{{PORT_NO}}/api/updatepassword?campaignId={{campaignId}}&appid=skavastore&locale=en_US
const updatePassword = new Request()
.url(updatePasswordUrl)
// .params(updatePasswordParams)
.post()
// add / change security questions: http://localhost:{{PORT_NO}}/api/profile/update?campaignId={{campaignId}}&appid=skavastore&locale=en_US
const addSecurityQuestion = new Request()
.url(addSecurityQuestionUrl)
// .params(addSecurityQuestionParams)
.post()
// http:// localhost:3000/api/resetpassword/byemail?campaignId=2495&appid=skavastore&locale=en_US&userinfo={"addresses":[{"type":"userIdentities","value":"skava","id":"favtest@skava.com","customParams":{"type":["0"]}}]}&customparams={"messageCampaignId":"371","locale":"en_US","resetMethod":"1","channel":"WEB"},
const resetPasswordByEmail = new Request()
.url(resetPasswordByMailUrl)
// .params(resetPasswordByEmailParams)
.post()
// validateResetPasswordByEmail
const validateResetPasswordByEmail = new Request()
.url(validateResetEmailUrl)
// .params(validateResetPasswordByEmailParams)
.post()
// http:// localhost:3000/api/resetpassword/byemail?campaignId=2495&appid=skavastore&locale=en_US&userinfo={"addresses":[{"type":"userIdentities","value":"skava","id":"favtest@skava.com","customParams":{"type":["0"]}}]}&customparams={"messageCampaignId":"371","locale":"en_US","resetMethod":"2","channel":"WEB"},
const resetPasswordBySMS = new Request()
.url(resetPasswordByMailUrl)
// .params(resetPasswordBySMSParams)
.post()
// validateResetPasswordBySMS
const validateResetPasswordBySMS = new Request()
.url(validateResetSMSUrl)
.params(validateResetPasswordBySMSParams)
.post()
// get security questions: http://localhost:{{PORT_NO}}/api/getsecurityquestion?campaignId={{campaignId}}&appid=skavastore&locale=en_US
const getSecurityQuestions = new Request()
.url(getSecurityQuestionUrl)
//.params(getSecurityQuestionsParams)
.post()
// reset password by security question: http://localhost:{{PORT_NO}}/api/resetpassword/bysecurityquestion?campaignId={{campaignId}}&appid=skavastore&locale=en_US
const resetPasswordBySecurityQuestions = new Request()
.url(resetPasswordBySQUrl)
// .params(resetPasswordBySecurityQuestionsParams)
.post()
// const getTwitterToken = new Request()
// .url(getTokenForTwitterUrl)
// .params(twittertokenParams)
// .post()
export {
register,
registerGuest,
login,
getProfile,
updatePassword,
updateProfile,
addAddress,
removeAddress,
updateAddress,
changeDefaultAddress,
addCard,
deleteCard,
changeDefaultCard,
addSecurityQuestion,
resetPasswordBySMS,
validateResetPasswordBySMS,
validateResetPasswordByEmail,
resetPasswordByEmail,
resetPasswordBySecurityQuestions,
getSecurityQuestions,
logout,
getTwitterToken,
}
// register()
// login()
// getProfile()
// updatePassword()
// updateProfile()
// addSecurityQuestion()
// addaddress()
// removeAddress()
// updateAddress()
// changeDefaultAddress()
// addCard()
// deleteCard()
// changeDefaultCard()
// logout()
// getSecurityQuestions()
// resetPasswordBySecurityQuestions()
// resetPasswordByEmail()
// validateResetPasswordByEmail()
// resetPasswordBySMS()
// validateResetPasswordBySMS()