Age verification

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 лет назад
Hi,

For selling alcohol, I need to add some kind of age verification.

My ideas are:

1. Birthdate is required
-> Option isn't available, but easy to add. Would be nice if the attribute 'ValidationProperty' is added by default to the NopDatePicker

2. Checking for the age
-> Adding a CustomValidator

3. Adding a textbox, where he needs to confirm again that he is older than the minimum age
-> Adding another Field and CustomValidator

4. First payment needs to be done with a credit card, afterwards other payment methods are allowed
-> Is this possible? Any hints how to add this functionality?

Beside point 4, the necessary changes are clear. But how to change the PaymentMethod by user and by order?
Why not adding the functionality by default?

Thanks
Eric
13 лет назад
bluesware wrote:
Hi,

For selling alcohol, I need to add some kind of age verification.

My ideas are:

1. Birthdate is required
-> Option isn't available, but easy to add. Would be nice if the attribute 'ValidationProperty' is added by default to the NopDatePicker

2. Checking for the age
-> Adding a CustomValidator

3. Adding a textbox, where he needs to confirm again that he is older than the minimum age
-> Adding another Field and CustomValidator

4. First payment needs to be done with a credit card, afterwards other payment methods are allowed
-> Is this possible? Any hints how to add this functionality?

Beside point 4, the necessary changes are clear. But how to change the PaymentMethod by user and by order?
Why not adding the functionality by default?

Thanks
Eric


Hi eric,

Your first 3 points are available in nopCommerce project.

1) Go to admin section > Configuration > Global Settings > 3rd Tab "Customer Profiles"

Now scroll down and you will see section that says "Form Fields: "

Now check the 2nd option that says "'Date of Birth' enabled:" (and SAVE CHANGES)

Now this field will be available in registration form in which who ever will register will have to fill out his/her date of brith.

To make it mandatory, you can easily add a "Required Field Validator" in the CustomerRegister.ascx module in the date of birth field.


2) Go to admin section > Configuration > Global Settings > Last Tab "Other"

4th option that says "Registration method:" CHOOSE ADMIN APPROVAL"

and SAVE CHANGES

Now whoever will register you  as admin (or store owner) will only approve people who fulfill the age criteria.



3) See point 2  because it's the same thing (but if you still need it, you can add a checkbox)



4) don't understand your question - please mention what exactly you're trying to accomplish or mean by your 4th point.
13 лет назад
Hi Mike,

Thanks for answering.

I have done it more or less like you said.
A little catch was the validator for the date control, because the control isn't enabled for validation.

Point 4:
Let's say you have enabled as payment method Paypal, CreditCard, Bill and others.
Now I want to force the people that they pay the first order by CC,
afterwards they may use what they want and what is enabled.

The reason behind this is, that here you are only allowed to have a CC when you're 18.
So this is another check to pass.

Browsing through the code, I thought to change the payment module directly, but perhaps there's an easier way.

Eric
13 лет назад
I don't know about in Switzerland, but here in the States ANYONE can have a credit card. Parents can get credit cards for their minor children and children can get Visa gift cards that work just like credit cards - a lot of children get them as presents for their birthday or Christmas... so though I applaud your efforts to check for legal age, a credit card doesn't fully enable that.

The one thing that most companies that sell alcohol online do that I've experienced is they send their orders with an adult signature required. You can check all you want online for age, and get fooled, but when it comes time for delivery then an adult MUST sign for it. I don't know if there are companies in Switzerland that offer adult signature required as a shipping option...

Also, I don't believe that you can have a Paypal account without a credit card or a bank account... both of which you have to be of a certain age to have, or have your parents set up for you. Either way, the adult signature thing is what really stops minors from getting alcohol in the mail.
13 лет назад
Thanks Barry,

Yes, here it's different. You need to be 18 for a CC (to avoid debts).
But a bank account, you can have with earlier age (starting with 12y). So Paypal isn't an option or prove.

Adult signature whould be great, but doesn't exist here as service.

To get an alcohol selling license, I need to prove that I take the necessary steps to verify the age.
I know that I can't get 100% prove, but better a check too much.

Eric
13 лет назад
Well, that being the case, and since I like your cheese so much... I'll give you some code:

in "CheckoutPaymentMethod.ascx.cs" - where the payment methods are added to the checkout page - find the code that looks like this (around line 233):


var boundPaymentMethods = new List<PaymentMethod>();
var paymentMethods = this.PaymentService.GetAllPaymentMethods(filterByCountryId);
   foreach (var pm in paymentMethods)
   {
      switch (pm.PaymentMethodType)
      {
         case PaymentMethodTypeEnum.Unknown:
         case PaymentMethodTypeEnum.Standard:
            {
               if (!Cart.IsRecurring || this.PaymentService.SupportRecurringPayments(pm.PaymentMethodId) != RecurringPaymentTypeEnum.NotSupported)
                  boundPaymentMethods.Add(pm);
             }
             break;


and make it look like this:

var boundPaymentMethods = new List<PaymentMethod>();
var paymentMethods = this.PaymentService.GetAllPaymentMethods(filterByCountryId);
foreach (var pm in paymentMethods)
   {
      switch (pm.PaymentMethodType)
      {
         case PaymentMethodTypeEnum.Unknown:
         case PaymentMethodTypeEnum.Standard:
            {
               //if the current user does not have any orders - they should be logged in by now
               if (NopContext.Current.User.Orders.Count == 0)
               {
                  //only show options that have the visible name of "Credit Card"
                  if (pm.VisibleName == "Credit Card")
                  {
                     if (!Cart.IsRecurring || this.PaymentService.SupportRecurringPayments(pm.PaymentMethodId) != RecurringPaymentTypeEnum.NotSupported)
                        boundPaymentMethods.Add(pm);
                  }
              }
              else //customer has already used a credit card so give them all the options
              {
                 if (!Cart.IsRecurring || this.PaymentService.SupportRecurringPayments(pm.PaymentMethodId) != RecurringPaymentTypeEnum.NotSupported)
                    boundPaymentMethods.Add(pm);
               }
         }
         break;

This will require a compile and I have not tested to see if it works... this is straight from the hip. It should restrict payment options to those that are credit card payments if it is the first order a customer has made. Let me know if it works. Good luck!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.