source: main/waeup.ikoba/trunk/src/waeup/ikoba/payments/testing.py @ 14292

Last change on this file since 14292 was 12813, checked in by uli, 10 years ago

Aggregate payment-related testing components.

File size: 1.7 KB
Line 
1## $Id$
2##
3## Copyright (C) 2015 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""
19Helpers for tests with payment components
20"""
21import decimal
22from zope.interface import implementer
23from waeup.ikoba.payments.payment import PaymentItem
24from waeup.ikoba.payments.interfaces import IPayer, IPayable
25
26
27@implementer(IPayer)
28class FakePayer(object):
29
30    def __init__(
31        self, payer_id=u'PAYER_01', first_name=u'Anna', last_name='Tester'):
32        self.payer_id = payer_id
33        self.first_name = first_name
34        self.last_name = last_name
35
36
37FAKE_PAYMENT_ITEMS = (
38    PaymentItem(u'Item title 1', decimal.Decimal("1.00")),
39    PaymentItem(u'Item title 2', decimal.Decimal("2.2")),
40    )
41
42
43@implementer(IPayable)
44class FakePayable(object):
45
46    payable_id = u'id1'
47
48    def __init__(self, payable_id=u'PAYABLE_01', title=u'title',
49                 currency=u'USD', payment_items=FAKE_PAYMENT_ITEMS):
50        self.payable_id = payable_id
51        self.title = title
52        self.currency = currency
53        self.payment_items = payment_items
Note: See TracBrowser for help on using the repository browser.