Beispiel #1
0
    def getBankAccounts(self):
        """
        """
        if self._isValid("direct-debit") == False:
            return []

        cm = ICustomerManagement(self.context)
        customer = cm.getAuthenticatedCustomer()

        result = []
        pm = IPaymentInformationManagement(customer)

        for bank_account in pm.getPaymentInformations(interface=IBankAccount,
                                                      check_validity=True):

            selected_payment_information = \
                pm.getSelectedPaymentInformation(check_validity=True)

            if selected_payment_information and \
               selected_payment_information.getId() == bank_account.getId():
                checked = True
            else:
                checked = False

            result.append({
                "id": bank_account.getId(),
                "bic": bank_account.bank_identification_code,
                "account_no": bank_account.account_number,
                "depositor": bank_account.depositor,
                "bank_name": bank_account.bank_name,
                "checked": checked,
            })

        return result
Beispiel #2
0
    def getCreditCards(self):
        """
        """
        if self._isValid("credit-card") == False:
            return []

        cm = ICustomerManagement(self.context)
        customer = cm.getAuthenticatedCustomer()

        result = []
        pm = IPaymentInformationManagement(customer)
        for credit_card in pm.getPaymentInformations(interface=ICreditCard,
                                                     check_validity=True):

            selected_payment_information = \
                pm.getSelectedPaymentInformation(check_validity=True)

            if selected_payment_information and \
               selected_payment_information.getId() == credit_card.getId():
                checked = True
            else:
                checked = False

            exp_date = "%s/%s" % (credit_card.card_expiration_date_month,
                                  credit_card.card_expiration_date_year)
            result.append({
                "id": credit_card.getId(),
                "type": credit_card.card_type,
                "owner": credit_card.card_owner,
                "number": credit_card.card_number,
                "expiration_date": exp_date,
                "checked": checked,
            })

        return result
Beispiel #3
0
    def getBankAccounts(self):
        """
        """
        if self._isValid("direct-debit") == False:
            return []
        
        cm = ICustomerManagement(self.context)
        customer = cm.getAuthenticatedCustomer()
                
        result = []        
        pm = IPaymentInformationManagement(customer)

        for bank_account in pm.getPaymentInformations(
            interface=IBankAccount, check_validity=True):

            selected_payment_information = \
                pm.getSelectedPaymentInformation(check_validity=True)
                
            if selected_payment_information and \
               selected_payment_information.getId() == bank_account.getId():
                checked = True
            else:
                checked = False            
            
            result.append({
                "id"         : bank_account.getId(),
                "bic"        : bank_account.bank_identification_code,
                "account_no" : bank_account.account_number,
                "depositor"  : bank_account.depositor,
                "bank_name"  : bank_account.bank_name,
                "checked"    : checked,
            })
        
        return result
Beispiel #4
0
    def getCreditCards(self):
        """
        """
        if self._isValid("credit-card") == False:
            return []
        
        cm = ICustomerManagement(self.context)
        customer = cm.getAuthenticatedCustomer()

        result = []        
        pm = IPaymentInformationManagement(customer)
        for credit_card in pm.getPaymentInformations(
            interface=ICreditCard, check_validity=True):

            selected_payment_information = \
                pm.getSelectedPaymentInformation(check_validity=True)
                
            if selected_payment_information and \
               selected_payment_information.getId() == credit_card.getId():
                checked = True
            else:
                checked = False            
            
            exp_date = "%s/%s" % (credit_card.card_expiration_date_month, 
                                  credit_card.card_expiration_date_year)
            result.append({
                "id"               : credit_card.getId(),
                "type"             : credit_card.card_type,
                "owner"            : credit_card.card_owner,
                "number"           : credit_card.card_number,
                "expiration_date"  : exp_date,
                "checked"          : checked,
            })
        
        return result
Beispiel #5
0
 def isComplete(self):
     """
     """
     shop         = IShopManagement(self.context).getShop()
     customer     = ICustomerManagement(shop).getAuthenticatedCustomer()        
     pim          = IPaymentInformationManagement(customer)
     bank_account = pim.getSelectedPaymentInformation()
     
     if IBankAccount.providedBy(bank_account) == False or \
        ICompleteness(bank_account) == False:
         return False
     else:        
         return True
Beispiel #6
0
    def getSelectedPaymentData(self):
        """Returns selected payment method type and corresponding selected
        payment information.
        """
        customer = self.context.getCustomer()
        pm = IPaymentInformationManagement(customer)

        payment_information = pm.getSelectedPaymentInformation()
        selected_payment_method = pm.getSelectedPaymentMethod()

        return {
            "information": payment_information,
            "portal_type": selected_payment_method.portal_type,
            "payment_method": selected_payment_method
        }
Beispiel #7
0
    def getSelectedPaymentData(self):
        """Returns selected payment method type and corresponding selected
        payment information.
        """
        customer = self.context.getCustomer()
        pm = IPaymentInformationManagement(customer)

        payment_information     = pm.getSelectedPaymentInformation()
        selected_payment_method = pm.getSelectedPaymentMethod()

        return {
            "information"    : payment_information,
            "portal_type"    : selected_payment_method.portal_type,
            "payment_method" : selected_payment_method
        }
Beispiel #8
0
 def testGetSelectedPaymentInformation(self):
     """
     """
     pm = IPaymentInformationManagement(self.customer)
     result = pm.getSelectedPaymentInformation()
     self.failUnless(result is None)
Beispiel #9
0
 def getSelectedPaymentInformation(self):
     """
     """
     customer = ICustomerManagement(self.context).getAuthenticatedCustomer()
     pm = IPaymentInformationManagement(customer)
     return pm.getSelectedPaymentInformation()
 def testGetSelectedPaymentInformation(self):
     """
     """
     pm = IPaymentInformationManagement(self.customer)
     result = pm.getSelectedPaymentInformation()
     self.failUnless(result is None)
Beispiel #11
0
 def getSelectedPaymentInformation(self):
     """
     """
     customer = ICustomerManagement(self.context).getAuthenticatedCustomer()
     pm = IPaymentInformationManagement(customer)
     return pm.getSelectedPaymentInformation()