Ejemplo n.º 1
0
    def validate(self):
        try:
            self.address.clean_fields()
        except ValidationError as e:
            raise InvalidData(e.messages)

        if not self.email:
            raise InvalidData()
Ejemplo n.º 2
0
    def validate(self, checkout_id):
        checkout = self.client.get_checkout(checkout_id)
        customer = session.get('customer', None)
        if customer is None:
            raise InvalidData('Session Error')

        if checkout['status'] == 'PAID':
            self.submit_sales_order()
            self.make_payment_entry()
            self.clear_cart()
        else:
            raise InvalidData('Payment not accepted')
Ejemplo n.º 3
0
    def validate(self, checkout_id):
        checkout = self.client.get_checkout(checkout_id)
        customer = session.get("customer", None)
        if customer is None:
            raise InvalidData("Session Error")

        if checkout["status"] == "PAID":
            self.submit_sales_order()
            self.make_payment_entry()
            self.clear_cart()
        else:
            raise InvalidData("Payment not accepted")
Ejemplo n.º 4
0
    def validate(self, checkout_id):
        intent = stripe.PaymentIntent.retrieve(checkout_id)

        customer = session.get('customer', None)
        if customer is None:
            raise InvalidData('Session Error')

        if intent['status'] == "succeeded":
            self.submit_sales_order()
            self.make_payment_entry(self.sales_order['name'], customer, float(intent['amount'])/100.0, intent['id'])
            self.clear_cart()
        else:
            raise InvalidData('Payment not accepted')
Ejemplo n.º 5
0
    def validate(self, checkout_id):
        intent = stripe.PaymentIntent.retrieve(checkout_id)

        customer = session.get("customer", None)
        if customer is None:
            raise InvalidData("Session Error")

        if intent["status"] == "succeeded":
            self.submit_sales_order()
            self.make_payment_entry(
                self.sales_order["name"],
                customer,
                float(intent["amount"]) / 100.0,
                intent["id"],
            )
            self.clear_cart()
        else:
            raise InvalidData("Payment not accepted")
Ejemplo n.º 6
0
 def validate(self):
     raise InvalidData()
Ejemplo n.º 7
0
 def validate(self):
     if not 'email' in self.storage:
         raise InvalidData()
Ejemplo n.º 8
0
 def validate(self):
     super(ShippingStep, self).validate()
     if 'delivery_method' not in self.storage:
         raise InvalidData()
Ejemplo n.º 9
0
 def validate(self):
     super(BillingAddressStep, self).validate()
     if 'anonymous' in self.forms and not self.anonymous_user_email:
         raise InvalidData()
Ejemplo n.º 10
0
 def validate(self):
     if not self.forms_are_valid():
         raise InvalidData()
Ejemplo n.º 11
0
 def validate(self):
     if not 'email' in self.group:
         raise InvalidData()
Ejemplo n.º 12
0
 def validate(self):
     selected_method_name = self.storage.get('shipping_method')
     valid_methods = [d['method'].name for d in self.available_shipping]
     if selected_method_name not in valid_methods:
         raise InvalidData(_('Select a valid shipping method'))