コード例 #1
1
ファイル: payment.py プロジェクト: Easyshop/Easyshop
    def handle_next_action(self, action, data):
        """
        """        
        customer = ICustomerManagement(self.context).getAuthenticatedCustomer()
        id = self.request.get("form.id")

        # figure out payment method type
        if id.startswith("bank_account"):
            payment_method = "direct-debit"
        elif id.startswith("credit_card"):
            payment_method = "credit-card"
        else:
            payment_method = id
        
        if id == "bank_account_new":
            depositor = self.request.get("form.depositor", u"")
            account_number = self.request.get("form.account_number", u"")
            bank_identification_code = self.request.get("form.bank_identification_code", u"")
            bank_name = self.request.get("form.bank_name", u"")

            id = self.context.generateUniqueId("BankAccount")
            bank_account = BankAccount(id)
            bank_account.account_number = account_number
            bank_account.bank_identification_code = bank_identification_code
            bank_account.bank_name = bank_name
            bank_account.depositor = depositor
        
            customer._setObject(id, bank_account)

        if id == "credit_card_new":            
            card_type = self.request.get("form.card_type", u"")
            card_number = self.request.get("form.card_number", u"")
            card_owner = self.request.get("form.card_owner", u"")
            card_expiration_date_month = self.request.get("form.card_expiration_date_month", u"")
            card_expiration_date_year = self.request.get("form.card_expiration_date_year", u"")
            
            id = self.context.generateUniqueId("CreditCard")
            credit_card = CreditCard(id)
            credit_card.card_type = card_type
            credit_card.card_number = card_number
            credit_card.card_owner = card_owner
            credit_card.card_expiration_date_month = card_expiration_date_month
            credit_card.card_expiration_date_year  = card_expiration_date_year
            
            customer._setObject(id, credit_card)
            
        elif id.startswith("bank_account_existing") or \
             id.startswith("credit_card_existing"):
            id = id.split(":")[1]
                
        customer.selected_payment_method      = payment_method
        customer.selected_payment_information = id
                    
        ICheckoutManagement(self.context).redirectToNextURL("SELECTED_PAYMENT_METHOD")
コード例 #2
0
    def handle_next_action(self, action, data):
        """
        """
        customer = ICustomerManagement(self.context).getAuthenticatedCustomer()
        id = self.request.get("form.id")

        # figure out payment method type
        if id.startswith("bank_account"):
            payment_method = "direct-debit"
        elif id.startswith("credit_card"):
            payment_method = "credit-card"
        else:
            payment_method = id

        if id == "bank_account_new":
            depositor = self.request.get("form.depositor", u"")
            account_number = self.request.get("form.account_number", u"")
            bank_identification_code = self.request.get(
                "form.bank_identification_code", u"")
            bank_name = self.request.get("form.bank_name", u"")

            id = self.context.generateUniqueId("BankAccount")
            bank_account = BankAccount(id)
            bank_account.account_number = account_number
            bank_account.bank_identification_code = bank_identification_code
            bank_account.bank_name = bank_name
            bank_account.depositor = depositor

            customer._setObject(id, bank_account)

        if id == "credit_card_new":
            card_type = self.request.get("form.card_type", u"")
            card_number = self.request.get("form.card_number", u"")
            card_owner = self.request.get("form.card_owner", u"")
            card_expiration_date_month = self.request.get(
                "form.card_expiration_date_month", u"")
            card_expiration_date_year = self.request.get(
                "form.card_expiration_date_year", u"")

            id = self.context.generateUniqueId("CreditCard")
            credit_card = CreditCard(id)
            credit_card.card_type = card_type
            credit_card.card_number = card_number
            credit_card.card_owner = card_owner
            credit_card.card_expiration_date_month = card_expiration_date_month
            credit_card.card_expiration_date_year = card_expiration_date_year

            customer._setObject(id, credit_card)

        elif id.startswith("bank_account_existing") or \
             id.startswith("credit_card_existing"):
            id = id.split(":")[1]

        customer.selected_payment_method = payment_method
        customer.selected_payment_information = id

        ICheckoutManagement(
            self.context).redirectToNextURL("SELECTED_PAYMENT_METHOD")
コード例 #3
0
ファイル: bank_account.py プロジェクト: Easyshop/Easyshop
    def createAndAdd(self, data):
        """
        """
        # add address
        id = self.context.generateUniqueId("BankAccount")

        direct_debit = BankAccount(id)
        direct_debit.account_number = data.get("account_number")
        direct_debit.bank_identification_code = data.get("bank_identification_code")
        direct_debit.depositor = data.get("depositor")
        direct_debit.bank_name = data.get("bank_name")
        
        self.context._setObject(id, direct_debit)

        direct_debit.reindexObject()
        self.nextUrl()
コード例 #4
0
    def createAndAdd(self, data):
        """
        """
        # add address
        id = self.context.generateUniqueId("BankAccount")

        direct_debit = BankAccount(id)
        direct_debit.account_number = data.get("account_number")
        direct_debit.bank_identification_code = data.get(
            "bank_identification_code")
        direct_debit.depositor = data.get("depositor")
        direct_debit.bank_name = data.get("bank_name")

        self.context._setObject(id, direct_debit)

        direct_debit.reindexObject()
        self.nextUrl()