{"version":3,"sources":["webpack:///./src/mixins/use-action-status.js","webpack:///./node_modules/core-js/modules/es.array.join.js","webpack:///./src/mixins/use-users.js"],"names":["status","msg","store","commit","$","IndexedObject","toIndexedObject","arrayMethodIsStrict","nativeJoin","join","ES3_STRINGS","Object","STRICT_METHOD","target","proto","forced","separator","call","this","undefined","useConfig","config","ActionStatus","RetrievePassword","email","dispatch","then","response","includes","responseCode","responseMessage","catch","error","message","ChangePassword","data","ValidateEmail","token","toLowerCase","GetAdminUserByEmail","adminEmail","GetAllAdminUsers","CreateMerchantUser","errorMessagesObj","errors","serverErrorMessage","errorMessages_","key","prototype","hasOwnProperty","errorMessagesObjValue","push","length","GetAllMerchantUsers","merchantId","GetActivatedMerchantUsers","CreateFundRespostUser","Promise","all","GetFundDisbursementRequeryUserAll","GetFundDisbursementRequeryUserPending","ApproveFundRespostUser","DeactivateFundRespostUser","GetFundDisbursementRequeryUserApproved","ActivateFundRespostUser","GetFundDisbursementRequeryUserDeactivated"],"mappings":"0JAEe,kBACb,IAAMA,EAAM,yDAAG,WAAOA,EAAQC,GAAf,iFACbC,OAAMC,OAAO,gBAAiBH,GAC9BE,OAAMC,OAAO,iBAAkBF,GAFlB,2CAAH,wDAKZ,MAAO,CACLD,Y,kCCRJ,IAAII,EAAI,EAAQ,QACZC,EAAgB,EAAQ,QACxBC,EAAkB,EAAQ,QAC1BC,EAAsB,EAAQ,QAE9BC,EAAa,GAAGC,KAEhBC,EAAcL,GAAiBM,OAC/BC,EAAgBL,EAAoB,OAAQ,KAIhDH,EAAE,CAAES,OAAQ,QAASC,OAAO,EAAMC,OAAQL,IAAgBE,GAAiB,CACzEH,KAAM,SAAcO,GAClB,OAAOR,EAAWS,KAAKX,EAAgBY,WAAqBC,IAAdH,EAA0B,IAAMA,O,8rBCTlF,EAAmBI,iBAAXC,EAAR,EAAQA,OACR,EAAmBC,iBAAXtB,EAAR,EAAQA,OAIKuB,EAAgB,yDAAG,WAAMC,GAAN,wFAC9BH,EAAOG,M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,OAPAzB,OAAMC,OAAO,wBAAwB,GAGjC,CAAC,EAAG,IAAK,MAAMyB,SAAf,OAAwBD,QAAxB,IAAwBA,OAAxB,EAAwBA,EAAUE,eACpC3B,OAAMC,OAAO,8CAA+CwB,EAASQ,MAGhER,KAERI,OAAM,WACL7B,OAAMC,OAAO,wBAAwB,OAdM,2CAAH,qDAiBjCyD,EAAqC,yDAAG,uHAC5C1D,OAAMuB,SAAS,8CAA+CJ,GAClEK,MAAK,SAAAC,GASJ,OAPAzB,OAAMC,OAAO,wBAAwB,GAGjC,CAAC,EAAG,IAAK,MAAMyB,SAAf,OAAwBD,QAAxB,IAAwBA,OAAxB,EAAwBA,EAAUE,eACpC3B,OAAMC,OAAO,kDAAmDwB,EAASQ,MAGpER,KAERI,OAAM,WACL7B,OAAMC,OAAO,wBAAwB,OAdU,2CAAH,qDAiBrC4D,EAAsC,yDAAG,uHAC7C7D,OAAMuB,SAAS,+CAAgDJ,GACnEK,MAAK,SAAAC,GASJ,OAPAzB,OAAMC,OAAO,wBAAwB,GAGjC,CAAC,EAAG,IAAK,MAAMyB,SAAf,OAAwBD,QAAxB,IAAwBA,OAAxB,EAAwBA,EAAUE,eACpC3B,OAAMC,OAAO,mDAAoDwB,EAASQ,MAGrER,KAERI,OAAM,WACL7B,OAAMC,OAAO,wBAAwB,OAdW,2CAAH,qDAiBtC8D,EAAyC,yDAAG,uHAChD/D,OAAMuB,SAAS,kDAAmDJ,GACtEK,MAAK,SAAAC,GASJ,OAPAzB,OAAMC,OAAO,wBAAwB,GAGjC,CAAC,EAAG,IAAK,MAAMyB,SAAf,OAAwBD,QAAxB,IAAwBA,OAAxB,EAAwBA,EAAUE,eACpC3B,OAAMC,OAAO,sDAAuDwB,EAASQ,MAGxER,KAERI,OAAM,WACL7B,OAAMC,OAAO,wBAAwB,OAdc,2CAAH","file":"js/chunk-1b494a3d.07ccda78.js","sourcesContent":["import store from '@/store/index'\r\n\r\nexport default () => {\r\n const status = async (status, msg) => {\r\n store.commit('ACTION_STATUS', status)\r\n store.commit('ACTION_MESSAGE', msg)\r\n }\r\n\r\n return {\r\n status\r\n }\r\n}\r\n","'use strict';\nvar $ = require('../internals/export');\nvar IndexedObject = require('../internals/indexed-object');\nvar toIndexedObject = require('../internals/to-indexed-object');\nvar arrayMethodIsStrict = require('../internals/array-method-is-strict');\n\nvar nativeJoin = [].join;\n\nvar ES3_STRINGS = IndexedObject != Object;\nvar STRICT_METHOD = arrayMethodIsStrict('join', ',');\n\n// `Array.prototype.join` method\n// https://tc39.es/ecma262/#sec-array.prototype.join\n$({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {\n join: function join(separator) {\n return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator);\n }\n});\n","import router from '@/router/index'\r\nimport store from '@/store/index'\r\n\r\nimport useConfig from '@/mixins/use-api-config'\r\nimport ActionStatus from '@/mixins/use-action-status'\r\n\r\nconst { config } = useConfig()\r\nconst { status } = ActionStatus()\r\n\r\nconst url = {}\r\n\r\nexport const RetrievePassword = async email => {\r\n config.email = email\r\n return store.dispatch('users/RetrievePassword', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n // --------------------------------------\r\n return response\r\n }\r\n })\r\n .catch(error => {\r\n status('error', error.message)\r\n // -----------------------------\r\n return error\r\n })\r\n}\r\n\r\nexport const ChangePassword = async data => {\r\n config.data = data\r\n return store.dispatch('users/ChangePassword', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n // --------------------------------------\r\n return response\r\n }\r\n })\r\n .catch(error => {\r\n status('error', error.message)\r\n // -----------------------------\r\n return error\r\n })\r\n}\r\n\r\nexport const UserLogin = async data => {\r\n return store.dispatch('users/UserLogin', data)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n // validate access token to know the user type\r\n validateAccessToken(response.data?.accessToken)\r\n\r\n return response\r\n } else {\r\n // stop spinner\r\n store.commit('LOADING', false)\r\n // --------------------------------------\r\n status('error', response.responseMessage)\r\n // --------------------------------------\r\n return response\r\n }\r\n })\r\n .catch(error => {\r\n // stop spinner\r\n store.commit('LOADING', false)\r\n // -----------------------------\r\n status('error', error.message)\r\n // -----------------------------\r\n return error\r\n })\r\n}\r\n\r\nexport const ValidateEmail = async token => {\r\n return store.dispatch('users/ValidateEmail', token)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n status('success', response.responseMessage)\r\n // --------------------------------------\r\n return response\r\n } else\r\n // merchant email is activated\r\n if (response?.responseCode === '03' || response?.responseCode === 3) {\r\n // invalid token\r\n if (response.responseMessage.toLowerCase() === 'invalid token') {\r\n status('error', response.responseMessage)\r\n } else {\r\n // valid token\r\n status('success', response.responseMessage)\r\n }\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n // --------------------------------------\r\n return response\r\n }\r\n })\r\n .catch(error => {\r\n // -----------------------------\r\n status('error', error.message)\r\n // -----------------------------\r\n return error\r\n })\r\n}\r\nexport const validateAccessToken = async token => {\r\n // update api config header authorization\r\n config.headers.Authorization = `bearer ${token}`\r\n\r\n return store.dispatch('users/ValidateUser', config)\r\n .then(response => {\r\n // Check if user is valid\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n location.assign('/dashboard') // dashboard\r\n } else {\r\n // non app user(fetch non-app user detail, and redirect to registration page)\r\n return store.dispatch('users/GetNonAppUserDetails', config)\r\n .then(response => {\r\n // update form inputs\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n url.query.user = JSON.stringify(response.data)\r\n }\r\n // route to registration page to complete user registration\r\n url.name = 'User Registration'\r\n router.push(url)\r\n })\r\n .catch(() => {\r\n // route to registration page\r\n router.push('/register')\r\n })\r\n }\r\n })\r\n .catch(() => {\r\n // route to registration page\r\n router.push('/register')\r\n })\r\n}\r\n// ---------------------------------------------------------------\r\nexport const GetAdminUserByEmail = async adminEmail => {\r\n config.adminEmail = adminEmail\r\n return store.dispatch('users/GetAdminUserByEmail', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/ADMIN_USER', response.data)\r\n }\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\n// ---------------------------------------------------------------\r\n\r\n// Admin Related Endpoints\r\nexport const CreateUser = async data => {\r\n config.data = data\r\n return store.dispatch('users/CreateUser', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\n\r\nexport const ApproveUser = async userId => {\r\n config.data = userId\r\n return store.dispatch('users/ApproveUser', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n // refresh inhouse users table\r\n Promise.all([\r\n GetAllAdminUsers(),\r\n GetActivatedAdminUsers(),\r\n GetDeactivatedAdminUsers()\r\n ])\r\n // --------------------------------\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\nexport const ActivateAdminUser = async data => {\r\n config.data = data\r\n return store.dispatch('users/ActivateAdminUser', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n // refresh inhouse users table\r\n Promise.all([\r\n GetAllAdminUsers(),\r\n GetActivatedAdminUsers(),\r\n GetDeactivatedAdminUsers()\r\n ])\r\n // --------------------------------\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\nexport const DeactivateAdminUser = async data => {\r\n config.data = data\r\n return store.dispatch('users/DeactivateAdminUser', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n // refresh inhouse users table\r\n Promise.all([\r\n GetAllAdminUsers(),\r\n GetActivatedAdminUsers(),\r\n GetDeactivatedAdminUsers()\r\n ])\r\n // --------------------------------\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\n\r\nexport const GetAllAdminUsers = async () => {\r\n return store.dispatch('users/GetAllAdminUsers', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/ADMIN_USERS', response.data)\r\n }\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\nexport const GetActivatedAdminUsers = async () => {\r\n return store.dispatch('users/GetActivatedAdminUsers', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/ACTIVATED_ADMIN_USERS', response.data)\r\n }\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\nexport const GetDeactivatedAdminUsers = async () => {\r\n return store.dispatch('users/GetDeactivatedAdminUsers', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/DEACTIVATED_ADMIN_USERS', response.data)\r\n }\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\n\r\n// Merchant Related Endpoints\r\nexport const CreateMerchantUser = async data => {\r\n config.data = data\r\n return store.dispatch('users/CreateMerchantUser', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\nexport const UpdateAdminUser = async data => {\r\n config.data = data\r\n return store.dispatch('users/UpdateAdminUser', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\nexport const ApproveMerchantUser = async userId => {\r\n config.data = userId\r\n return store.dispatch('users/ApproveMerchantUser', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n // refresh inhouse users table\r\n Promise.all([\r\n GetAllAdminUsers(),\r\n GetActivatedAdminUsers(),\r\n GetDeactivatedAdminUsers()\r\n ])\r\n // --------------------------------\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\nexport const ActivateMerchantUser = async merchantId => {\r\n config.merchantId = merchantId\r\n return store.dispatch('users/ActivateMerchantUser', config)\r\n .then(async response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n // refresh table\r\n GetAllMerchantUsers(merchantId)\r\n GetActivatedMerchantUsers(merchantId)\r\n GetDeactivatedMerchantUsers(merchantId)\r\n // ------------------------------------------\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\nexport const DeactivateMerchantUser = async (merchantId, comment) => {\r\n config.merchantId = merchantId\r\n config.comment = comment\r\n // ----------------------------------\r\n return store.dispatch('users/DeactivateMerchantUser', config)\r\n .then(async response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n // refresh table\r\n GetAllMerchantUsers(merchantId)\r\n GetActivatedMerchantUsers(merchantId)\r\n GetDeactivatedMerchantUsers(merchantId)\r\n // ------------------------------------------\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\n\r\nexport const GetAllMerchantUsers = async merchantId => {\r\n config.merchantId = merchantId\r\n return store.dispatch('users/GetAllMerchantUsers', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/ALL_MERCHANT_USERS', response.data)\r\n }\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\nexport const GetActivatedMerchantUsers = async merchantId => {\r\n config.merchantId = merchantId\r\n return store.dispatch('users/GetActivatedMerchantUsers', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/ACTIVATED_MERCHANT_USERS', response.data)\r\n }\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\nexport const GetDeactivatedMerchantUsers = async merchantId => {\r\n config.merchantId = merchantId\r\n return store.dispatch('users/GetDeactivatedMerchantUsers', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/DEACTIVATED_MERCHANT_USERS', response.data)\r\n }\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\n\r\n// Merchant Related Endpoints\r\nexport const CreateFundRespostUser = async data => {\r\n config.data = data\r\n return store.dispatch('users/CreateFundRespostUser', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n // refresh users table\r\n Promise.all([\r\n GetFundDisbursementRequeryUserAll(),\r\n GetFundDisbursementRequeryUserPending()\r\n ])\r\n // --------------------------------\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\nexport const ApproveFundRespostUser = async data => {\r\n config.data = data\r\n return store.dispatch('users/ApproveFundRespostUser', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n // refresh users table\r\n Promise.all([\r\n GetFundDisbursementRequeryUserAll(),\r\n GetFundDisbursementRequeryUserPending()\r\n // GetFundDisbursementRequeryUserApproved()\r\n ])\r\n // --------------------------------\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\nexport const DeactivateFundRespostUser = async data => {\r\n config.data = data\r\n return store.dispatch('users/DeactivateFundRespostUser', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n // refresh users table\r\n Promise.all([\r\n GetFundDisbursementRequeryUserAll(),\r\n // GetFundDisbursementRequeryUserDeactivated(),\r\n GetFundDisbursementRequeryUserApproved()\r\n ])\r\n // --------------------------------\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\nexport const ActivateFundRespostUser = async data => {\r\n config.data = data\r\n return store.dispatch('users/ActivateFundRespostUser', config)\r\n .then(response => {\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n // refresh users table\r\n Promise.all([\r\n GetFundDisbursementRequeryUserAll(),\r\n GetFundDisbursementRequeryUserDeactivated()\r\n // GetFundDisbursementRequeryUserApproved()\r\n ])\r\n // --------------------------------\r\n status('success', response.responseMessage)\r\n return response\r\n } else {\r\n status('error', response.responseMessage)\r\n return response\r\n }\r\n })\r\n .catch((error) => {\r\n const errorMessagesObj = error?.response.data?.errors\r\n const serverErrorMessage = error.message\r\n\r\n const errorMessages_ = []\r\n\r\n for (const key in errorMessagesObj) {\r\n if (Object.prototype.hasOwnProperty.call(errorMessagesObj, key)) {\r\n const errorMessagesObjValue = errorMessagesObj[key]\r\n\r\n errorMessages_.push(errorMessagesObjValue[0])\r\n }\r\n }\r\n\r\n // update response message\r\n status('error', errorMessages_.length ? errorMessages_.join('* ') : serverErrorMessage)\r\n\r\n return error\r\n })\r\n}\r\n\r\nexport const GetFundDisbursementRequeryUserAll = async () => {\r\n return store.dispatch('users/GetFundDisbursementRequeryUserAll', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/ALL_TRANSACTION_REPOST_MERCHANT_USERS', response.data)\r\n }\r\n\r\n return response\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\nexport const GetFundDisbursementRequeryUserPending = async () => {\r\n return store.dispatch('users/GetFundDisbursementRequeryUserPending', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/PENDING_TRANSACTION_REPOST_MERCHANT_USERS', response.data)\r\n }\r\n\r\n return response\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\nexport const GetFundDisbursementRequeryUserApproved = async () => {\r\n return store.dispatch('users/GetFundDisbursementRequeryUserApproved', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/APPROVED_TRANSACTION_REPOST_MERCHANT_USERS', response.data)\r\n }\r\n\r\n return response\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\nexport const GetFundDisbursementRequeryUserDeactivated = async () => {\r\n return store.dispatch('users/GetFundDisbursementRequeryUserDeactivated', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/DEACTIVATED_TRANSACTION_REPOST_MERCHANT_USERS', response.data)\r\n }\r\n\r\n return response\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\n\r\nexport const GetFundDisbursementRequeryUserById = async userId => {\r\n config.userId = userId\r\n return store.dispatch('users/GetFundDisbursementRequeryUserById', config)\r\n .then(response => {\r\n // clear no connection error\r\n store.commit('HAS_CONNECTION_ERROR', false)\r\n // ---------------------------------------------\r\n\r\n if ([0, '0', '00'].includes(response?.responseCode)) {\r\n store.commit('users/TRANSACTION_REPOST_MERCHANT_USER', response.data)\r\n }\r\n\r\n return response\r\n })\r\n .catch(() => {\r\n store.commit('HAS_CONNECTION_ERROR', true)\r\n })\r\n}\r\n"],"sourceRoot":""}