Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 56 additions & 10 deletions frontend/src/pages/Billing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,16 @@
</Button>
</div>
</div>

<p
class="bg-surface-amber-2 text-ink-amber-2 text-sm leading-5 p-2 rounded-md"
>
{{
__(
'Please ensure that the billing name you enter is correct, as it will be used on your invoice.'
)
}}
</p>
</div>

<div class="flex-1 lg:mr-10">
Expand All @@ -104,16 +114,22 @@
<FormControl
:label="__('Billing Name')"
v-model="billingDetails.billing_name"
:required="true"
/>
<FormControl
:label="__('Address Line 1')"
v-model="billingDetails.address_line1"
:required="true"
/>
<FormControl
:label="__('Address Line 2')"
v-model="billingDetails.address_line2"
/>
<FormControl :label="__('City')" v-model="billingDetails.city" />
<FormControl
:label="__('City')"
v-model="billingDetails.city"
:required="true"
/>
<FormControl
:label="__('State/Province')"
v-model="billingDetails.state"
Expand All @@ -125,20 +141,24 @@
:value="billingDetails.country"
@change="(option) => changeCurrency(option)"
:label="__('Country')"
:required="true"
/>
<FormControl
:label="__('Postal Code')"
v-model="billingDetails.pincode"
:required="true"
/>
<FormControl
:label="__('Phone Number')"
v-model="billingDetails.phone"
:required="true"
/>
<Link
doctype="LMS Source"
:value="billingDetails.source"
@change="(option) => (billingDetails.source = option)"
:label="__('Where did you hear about us?')"
:required="true"
/>
<FormControl
v-if="billingDetails.country == 'India'"
Expand All @@ -152,14 +172,29 @@
/>
</div>
</div>
<div class="flex items-center justify-between border-t pt-4 mt-8">
<p class="text-ink-gray-5">
{{
__(
'Make sure to enter the correct billing name as the same will be used in your invoice.'
)
}}
</p>
<div
class="flex flex-col lg:flex-row items-start lg:items-center justify-between border-t pt-4 mt-8 space-y-4 lg:space-y-0"
>
<div>
<FormControl
:label="
__(
'I consent to my personal information being stored for invoicing'
)
"
type="checkbox"
class="leading-6"
v-model="billingDetails.member_consent"
/>
<div
v-if="showConsentWarning"
class="mt-1 text-xs text-ink-red-3"
>
{{
__('Please provide your consent to proceed with the payment')
}}
</div>
</div>
<Button variant="solid" size="md" @click="generatePaymentLink()">
{{ __('Proceed to Payment') }}
</Button>
Expand Down Expand Up @@ -194,14 +229,15 @@ import {
toast,
call,
} from 'frappe-ui'
import { reactive, inject, onMounted, computed, ref } from 'vue'
import { reactive, inject, onMounted, computed, ref, watch } from 'vue'
import { sessionStore } from '../stores/session'
import Link from '@/components/Controls/Link.vue'
import NotPermitted from '@/components/NotPermitted.vue'
import { X } from 'lucide-vue-next'

const user = inject('$user')
const { brand } = sessionStore()
const showConsentWarning = ref(false)

onMounted(() => {
const script = document.createElement('script')
Expand Down Expand Up @@ -296,6 +332,10 @@ const generatePaymentLink = () => {
if (!billingDetails.source) {
return __('Please let us know where you heard about us from.')
}
if (!billingDetails.member_consent) {
showConsentWarning.value = true
return __('Please provide your consent to proceed with the payment.')
}
return validateAddress()
},
onSuccess(data) {
Expand Down Expand Up @@ -406,6 +446,12 @@ const redirectTo = computed(() => {
}
})

watch(billingDetails, () => {
if (billingDetails.member_consent) {
showConsentWarning.value = false
}
})

usePageMeta(() => {
return {
title: __('Billing Details'),
Expand Down
9 changes: 8 additions & 1 deletion lms/lms/doctype/lms_payment/lms_payment.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"payment_for_document",
"payment_received",
"payment_for_certificate",
"member_consent",
"payment_details_section",
"original_amount",
"discount_amount",
Expand Down Expand Up @@ -181,6 +182,12 @@
"fieldtype": "Currency",
"label": "Original Amount",
"options": "currency"
},
{
"default": "0",
"fieldname": "member_consent",
"fieldtype": "Check",
"label": "Member Consent"
}
],
"index_web_pages_for_search": 1,
Expand All @@ -194,7 +201,7 @@
"link_fieldname": "payment"
}
],
"modified": "2025-11-12 12:39:52.466297",
"modified": "2025-12-19 17:55:25.968384",
"modified_by": "sayali@frappe.io",
"module": "LMS",
"name": "LMS Payment",
Expand Down
1 change: 1 addition & 0 deletions lms/lms/payments.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ def record_payment(
"payment_for_document_type": doctype,
"payment_for_document": docname,
"payment_for_certificate": payment_for_certificate,
"member_consent": address.member_consent,
}
)
if coupon_code:
Expand Down
Loading