Ignore:
Timestamp:
17 Mar 2015, 18:41:43 (10 years ago)
Author:
Henrik Bettermann
Message:

Add payment_items to IPayment.

Export attributes too.

Location:
main/waeup.ikoba/trunk/src/waeup/ikoba/payments
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/export.py

    r12777 r12779  
    3838    @property
    3939    def fields(self):
    40         return tuple(sorted(iface_names(self.iface)))
     40        return tuple(sorted(iface_names(self.iface, exclude_attribs=False)))
    4141
    4242    def mangle_value(self, value, name, context=None):
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/interfaces.py

    r12773 r12779  
    358358        )
    359359
     360    payment_items = Attribute("Tuple of payment items")
     361
    360362    amount = Attribute("Sum of amounts of items contained")
    361363
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/payment.py

    r12774 r12779  
    257257        self.amount = amount
    258258
     259    def to_string(self):
     260        """A string representation that can be used in exports.
     261
     262        Returned is a unicode string of format ``(u'<TITLE>',u'<FEE>',u'<CURR>')``.
     263        """
     264        string = u"(u'%s', u'%s', u'%s')" % (self.item_id, self.title, self.amount)
     265        string = string.replace("u'None'", "None")
     266        return string
     267
    259268
    260269@attrs_to_fields
  • main/waeup.ikoba/trunk/src/waeup/ikoba/payments/tests/test_export.py

    r12777 r12779  
    105105        self.assertTrue(
    106106            'creation_date,currency,gateway_service,payable_id,payee_id,'
    107             'payer_id,payment_date,payment_id,state,title\r\n'
     107            'payer_id,payment_date,payment_id,payment_items,state,title\r\n'
    108108            in result)
    109109        self.assertMatches(
    110110            '...2015-03-16 16:07:33.273297#,EUR,demo_creditcard,CON1,'
    111             ',K1000000,,%s,64,My Contract...' % self.payment.payment_id,
     111            ',K1000000,,%s,"[(u\'0\', u\'Any product option\', u\'88.8\')]",'
     112            '64,My Contract...' % self.payment.payment_id,
    112113            result
    113114            )
     
    121122        self.assertTrue(
    122123            'creation_date,currency,gateway_service,payable_id,payee_id,'
    123             'payer_id,payment_date,payment_id,state,title\r\n'
     124            'payer_id,payment_date,payment_id,payment_items,state,title\r\n'
    124125            in result)
    125126        self.assertMatches(
    126127            '...2015-03-16 16:07:33.273297#,EUR,demo_creditcard,CON1,'
    127             ',K1000000,,%s,64,My Contract...' % self.payment.payment_id,
     128            ',K1000000,,%s,"[(u\'0\', u\'Any product option\', u\'88.8\')]",'
     129            '64,My Contract...' % self.payment.payment_id,
    128130            result
    129131            )
Note: See TracChangeset for help on using the changeset viewer.