def create_card_payment(self, date=None, provider_id=u'AMEX', device=None): from stoqlib.domain.payment.card import CreditCardData from stoqlib.domain.payment.card import CreditProvider if date is None: date = localnow() provider = self.store.find(CreditProvider, provider_id=provider_id).one() payment = self.create_payment(date=date, method=self.get_payment_method(u'card')) CreditCardData(payment=payment, provider=provider, device=device or self.create_card_device(), store=self.store) return payment
def payment_create(self, payment): return CreditCardData(store=payment.store, payment=payment)
def payment_delete(self, payment): store = payment.store credit_card_data = self.get_card_data_by_payment(payment) CreditCardData.delete(credit_card_data.id, store=store)