Skip to content

Commit

Permalink
Merge pull request #453 from Zaker237/payment-link-for-job
Browse files Browse the repository at this point in the history
Payment link for job
  • Loading branch information
Asam237 authored Aug 17, 2023
2 parents 35acb70 + c4de262 commit 2576a40
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 24 deletions.
38 changes: 34 additions & 4 deletions frontend/pages/confirm_job.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
{{ newjob.description }}
</p>
<p class="text-sm font-extralight pt-4 text-gray-600">
<span class="font-bold text-black">Employment type: </span
>{{ newjob.job_type }}
<span class="font-bold text-black">Phone Number: </span
>{{ newjob.application_phone_number }}
</p>
<p class="text-sm font-extralight pt-4 text-gray-600">
<!-- <span class="font-bold text-black">Apply at: </span>{{ mail }} -->
Expand Down Expand Up @@ -143,11 +143,41 @@ export default {
},
},
methods: {
resetStateJob() {
this.$store.commit('jobs/SETNEWJOB', {
company_name: '',
company_email: '',
job_title: '',
is_remote: false,
city: '',
country: 'Cameroon',
department: '',
salary_range_min: 0,
salary_range_max: 0,
description: '',
benefits: '',
how_to_apply: '',
application_url: '',
application_email_address: '',
application_phone_number: '',
tags: '',
})
},
async sendJob() {
const resp = await this.$store.dispatch('postJob', this.newjob)
if (resp.status) {
this.$router.push('/payment_instruction')
if (!resp.status) {
return
}
const linkrest = await this.$store.dispatch('getJobPaymentLink', {
email: resp.data.application_email_address,
tier: 'job_offer',
job_offer_id: `${resp.data.id}`,
})
if (!linkrest.status) {
return
}
this.resetStateJob()
this.$router.push('/payment_instruction')
},
},
}
Expand Down
7 changes: 5 additions & 2 deletions frontend/pages/payment_instruction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
</p>
</div>
<div class="md:w-1/4 py-6">
<NuxtLink to="/">
<a :href="`/${paymentlink}`">
<Button
show-picture="nothing"
my-style="background: #235365;padding: 20px;box-shadow: 0 1px 2px rgb(0 0 0 / 0.2); width: 164px;"
name="Proceed payment"
/>
</NuxtLink>
</a>
</div>
</div>
</div>
Expand Down Expand Up @@ -84,6 +84,9 @@ export default {
newjob() {
return this.$store.state.jobs.newjob
},
paymentlink() {
return this.$store.state.jobs.paymentlink
},
},
}
</script>
Expand Down
27 changes: 9 additions & 18 deletions frontend/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,24 +81,6 @@ export const actions = {
try {
const resp = await axios.post(this.$config.baseURL + '/jobs', data)
if (resp) {
commit('jobs/SETNEWJOB', {
company_name: '',
company_email: '',
job_title: '',
is_remote: false,
city: '',
country: 'Cameroon',
department: '',
salary_range_min: 0,
salary_range_max: 0,
description: '',
benefits: '',
how_to_apply: '',
application_url: '',
application_email_address: '',
application_phone_number: '',
tags: '',
})
return { status: true, data: resp.data }
}
} catch (error) {
Expand All @@ -113,6 +95,15 @@ export const actions = {
return undefined
}
},
async getJobPaymentLink({ commit }, data) {
try {
const resp = await axios.post(this.$config.baseURL + '/pay', data)
commit('jobs/SETPAYMENTLINK', resp.data)
return resp
} catch (error) {
return undefined
}
},
filterJob({ commit }, value) {
commit('jobtitles/SETFILTERJOB', value)
},
Expand Down
5 changes: 5 additions & 0 deletions frontend/store/jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const state = () => ({
application_phone_number: '',
tags: '',
},
paymentlink: '',
})

export const getters = {
Expand All @@ -29,6 +30,7 @@ export const getters = {
nbHits: (state) => state.nbHits,
jobs: (state) => state.jobs,
newjob: (state) => state.newjob,
paymentlink: (state) => state.paymentlink,
}

export const mutations = {
Expand All @@ -50,4 +52,7 @@ export const mutations = {
ADDJOB(state, payload) {
state.jobs = [{ ...payload }, ...state.jobs]
},
SETPAYMENTLINK(state, payload) {
state.paymentlink = payload.tier_url
},
}

0 comments on commit 2576a40

Please sign in to comment.