|
119 | 119 | <div v-if="!currentFieldsPageBreak && !isLastPage">
|
120 | 120 | {{ $t('forms.wrong_form_structure') }}
|
121 | 121 | </div>
|
| 122 | + <div |
| 123 | + v-if="paymentBlock" |
| 124 | + class="text-xs text-gray-500 mt-2" |
| 125 | + > |
| 126 | + <template v-if="isLastPage"> |
| 127 | + Your credit card will be charged upon clicking the "Submit" button. Payments are securely processed through Stripe. |
| 128 | + </template> |
| 129 | + <template v-else> |
| 130 | + Your credit card will be charged upon clicking the "Next" button. Payments are securely processed through Stripe. |
| 131 | + </template> |
| 132 | + </div> |
122 | 133 | </div>
|
123 | 134 | </form>
|
124 | 135 | </template>
|
@@ -302,6 +313,9 @@ export default {
|
302 | 313 | return {
|
303 | 314 | '--form-color': this.form.color
|
304 | 315 | }
|
| 316 | + }, |
| 317 | + paymentBlock() { |
| 318 | + return this.currentFields.find(field => field.type === 'payment') |
305 | 319 | }
|
306 | 320 | },
|
307 | 321 |
|
@@ -547,14 +561,13 @@ export default {
|
547 | 561 | async doPayment() {
|
548 | 562 | // If there is a payment block, process the payment
|
549 | 563 | const { state: stripeState, processPayment } = useStripeElements()
|
550 |
| - const paymentBlock = this.currentFields.find(field => field.type === 'payment') |
551 |
| - if (paymentBlock && !stripeState.value.intentId && (paymentBlock.required || !stripeState.value.card._empty)) { |
| 564 | + if (this.paymentBlock && !stripeState.value.intentId && (this.paymentBlock.required || !stripeState.value.card._empty)) { |
552 | 565 | try {
|
553 | 566 | // Process the payment
|
554 |
| - const result = await processPayment(this.form.slug, paymentBlock.required) |
| 567 | + const result = await processPayment(this.form.slug, this.paymentBlock.required) |
555 | 568 | console.log('result', result)
|
556 | 569 | if (result && result?.error) {
|
557 |
| - this.dataForm.errors.set(paymentBlock.id, result.error.message) |
| 570 | + this.dataForm.errors.set(this.paymentBlock.id, result.error.message) |
558 | 571 | useAlert().error(result.error.message)
|
559 | 572 | return false
|
560 | 573 | }
|
|
0 commit comments