update routes

This commit is contained in:
Pete Matsyburka committed 2026-10-04 11:04:14 +03:00
1 parent 63a874528a
commit 25504e8cb1
5 files changed
+18 -19

No files matched your search

+4 -5
View File
@@ -483,7 +483,7 @@ export default {
this.clearCountdown() this.clearCountdown()
try { try {
const payload = { ...this.form, submitter_slug: this.submitterSlug } const payload = { ...this.form }
if (payload.dob) { if (payload.dob) {
payload.dob = payload.dob.replace(/-/g, '') payload.dob = payload.dob.replace(/-/g, '')
@@ -497,7 +497,7 @@ export default {
payload.phone = payload.phone.replace(/^\+1/, '') payload.phone = payload.phone.replace(/^\+1/, '')
} }
const resp = await fetch(this.baseUrl + '/api/kba', { const resp = await fetch(this.baseUrl + `/s/${this.submitterSlug}/kba`, {
method: 'POST', method: 'POST',
body: JSON.stringify(payload), body: JSON.stringify(payload),
...this.fetchOptions, ...this.fetchOptions,
@@ -548,13 +548,12 @@ export default {
}, {}) }, {})
try { try {
const resp = await fetch(this.baseUrl + `/api/kba/${this.field.uuid}`, { const resp = await fetch(this.baseUrl + `/s/${this.submitterSlug}/kba/${this.field.uuid}`, {
method: 'PUT', method: 'PUT',
body: JSON.stringify({ body: JSON.stringify({
token: this.token, token: this.token,
answers: formattedAnswers, answers: formattedAnswers,
reference: this.reference, reference: this.reference
submitter_slug: this.submitterSlug
}), }),
...this.fetchOptions, ...this.fetchOptions,
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers } headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers }
@@ -156,7 +156,7 @@ export default {
return this.provider === 'paypal' return this.provider === 'paypal'
}, },
paymentEndpoint () { paymentEndpoint () {
return this.isPaypal ? '/api/paypal_payments' : '/api/stripe_payments' return `/s/${this.submitterSlug}/${this.isPaypal ? 'paypal_payments' : 'stripe_payments'}`
}, },
sessionId () { sessionId () {
return this.queryParams.get('stripe_session_id') || this.queryParams.get('paypal_order_id') || (this.isPaypal && this.queryParams.get('token')) return this.queryParams.get('stripe_session_id') || this.queryParams.get('paypal_order_id') || (this.isPaypal && this.queryParams.get('token'))
@@ -255,9 +255,6 @@ export default {
if (this.sessionId) { if (this.sessionId) {
return fetch(this.baseUrl + this.paymentEndpoint + '/' + this.sessionId, { return fetch(this.baseUrl + this.paymentEndpoint + '/' + this.sessionId, {
method: 'PUT', method: 'PUT',
body: JSON.stringify({
submitter_slug: this.submitterSlug
}),
...this.fetchOptions, ...this.fetchOptions,
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers } headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers }
}).then(async (resp) => { }).then(async (resp) => {
@@ -294,7 +291,6 @@ export default {
fetch(this.baseUrl + this.paymentEndpoint, { fetch(this.baseUrl + this.paymentEndpoint, {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
submitter_slug: this.submitterSlug,
field_uuid: this.field.uuid, field_uuid: this.field.uuid,
check_status: checkStatus, check_status: checkStatus,
referer: this.normalizedPaymentUrl() referer: this.normalizedPaymentUrl()
@@ -285,7 +285,7 @@ export default {
}, 1000) }, 1000)
}, },
sendVerificationCode () { sendVerificationCode () {
return fetch(this.baseUrl + '/api/send_phone_verification_code', { const options = {
method: 'POST', method: 'POST',
body: JSON.stringify({ body: JSON.stringify({
submitter_slug: this.submitterSlug, submitter_slug: this.submitterSlug,
@@ -293,6 +293,14 @@ export default {
phone: this.fullInternationalPhoneValue phone: this.fullInternationalPhoneValue
}), }),
headers: { 'Content-Type': 'application/json' } headers: { 'Content-Type': 'application/json' }
}
return fetch(this.baseUrl + `/s/${this.submitterSlug}/send_phone_verification_code`, options).then((resp) => {
if (resp.status === 404) {
return fetch(this.baseUrl + '/api/send_phone_verification_code', options)
} else {
return resp
}
}).then(async (resp) => { }).then(async (resp) => {
if ([422, 429].includes(resp.status)) { if ([422, 429].includes(resp.status)) {
const data = await resp.json() const data = await resp.json()
@@ -162,10 +162,9 @@ export default {
}, },
methods: { methods: {
start () { start () {
return fetch(this.baseUrl + `/api/identity_verification/${this.field.uuid}`, { return fetch(this.baseUrl + `/s/${this.submitterSlug}/identity_verification/${this.field.uuid}`, {
method: 'PUT', method: 'PUT',
body: JSON.stringify({ body: JSON.stringify({
submitter_slug: this.submitterSlug,
redirect_url: document.location.href redirect_url: document.location.href
}), }),
...this.fetchOptions, ...this.fetchOptions,
@@ -206,11 +205,8 @@ export default {
}) })
}, },
async submit () { async submit () {
const resp = await fetch(this.baseUrl + '/api/identity_verification', { const resp = await fetch(this.baseUrl + `/s/${this.submitterSlug}/identity_verification`, {
method: 'POST', method: 'POST',
body: JSON.stringify({
submitter_slug: this.submitterSlug
}),
...this.fetchOptions, ...this.fetchOptions,
headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers } headers: { 'Content-Type': 'application/json', ...this.fetchOptions.headers }
}) })
@@ -414,7 +414,7 @@ export default {
checkStripeStatus () { checkStripeStatus () {
this.isLoading = true this.isLoading = true
fetch('/api/stripe_connect').then(async (resp) => { fetch('/stripe_connect').then(async (resp) => {
const { status } = await resp.json() const { status } = await resp.json()
if (status === 'connected') { if (status === 'connected') {
@@ -427,7 +427,7 @@ export default {
}) })
}, },
checkPaypalStatus () { checkPaypalStatus () {
fetch('/api/paypal_connect').then(async (resp) => { fetch('/paypal_connect').then(async (resp) => {
const { status } = await resp.json() const { status } = await resp.json()
if (status === 'connected') { if (status === 'connected') {