示例#1
0
 def _show_payment_form(self, context, payment):
     amount_available = self.get_credit_available_for_user(context.user.name)
     remaining_to_pay = payment['amount'] - amount_available
     # Partial payment
     if remaining_to_pay > decimal('0'):
         # Delete credit
         users_credit = self.get_resource('users-credit')
         results = users_credit.handler.search(user=context.user.name)
         if len(results) == 0:
             raise ValueError, 'Error, credit do not exist'
         record = results[0]
         old_amount = users_credit.handler.get_record_value(record, 'amount')
         new_amount = old_amount - payment['amount']
         if new_amount < decimal('0'):
             users_credit.del_record(record.id)
         else:
             kw = {'amount': new_amount}
             users_credit.update_recod(record.id, **kw)
         # Encapsulate in pay view
         payment['mode'] = 'paybox' # XXX (Can have another name ?)
         payment['amount'] = remaining_to_pay
         return self.parent.show_payment_form(context, payment)
     # Complete payment
     return PaymentWay._show_payment_form(self, context, payment)
示例#2
0
文件: cash.py 项目: nicolasderam/shop
 def get_metadata_schema(cls):
     return merge_dicts(PaymentWay.get_metadata_schema(), address=Unicode)
示例#3
0
 def get_metadata_schema(cls):
     return merge_dicts(PaymentWay.get_metadata_schema(),
                        deposit_schema)
示例#4
0
文件: paybox.py 项目: hforge/shop
 def get_metadata_schema(cls):
     schema = PaymentWay.get_metadata_schema()
     # Paybox account configuration
     schema.update(cls.base_schema)
     return schema
示例#5
0
 def get_metadata_schema(cls):
     schema = PaymentWay.get_metadata_schema()
     # Paybox account configuration
     schema.update(cls.base_schema)
     return schema
示例#6
0
文件: check.py 项目: hforge/shop
 def get_metadata_schema(cls):
     return merge_dicts(PaymentWay.get_metadata_schema(),
                        to=Unicode,
                        address=Unicode)
示例#7
0
 def _make_resource(cls, folder, name, *args, **kw):
     # Create resource
     PaymentWay._make_resource(cls, folder, name, *args, **kw)
     CreditAvailable_Table._make_resource(CreditAvailable_Table, folder,
         '%s/users-credit' % name)
示例#8
0
 def get_metadata_schema(cls):
     return merge_dicts(PaymentWay.get_metadata_schema(),
                        RIB=RIB,
                        IBAN=IBAN)
示例#9
0
文件: transfer.py 项目: hforge/shop
 def get_metadata_schema(cls):
     return merge_dicts(PaymentWay.get_metadata_schema(),
                        RIB=RIB,
                        IBAN=IBAN)