Changeset 12636 for main/waeup.ikoba/branches/uli-fake-gw-provider/src
- Timestamp:
- 28 Feb 2015, 13:56:26 (10 years ago)
- Location:
- main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments/interfaces.py
r12319 r12636 20 20 from zope import schema 21 21 from zope.component import getUtilitiesFor 22 from zope.container.interfaces import IContainer 23 from zope.container.constraints import containers, contains 22 24 from zope.interface import Interface 23 25 from waeup.ikoba.interfaces import ( … … 115 117 116 118 117 class IPayment(IIkobaObject): 119 class ICreditCard(Interface): 120 """A credit card. 121 122 A credit card is connected to a Payer. 123 """ 124 credit_card_id = schema.TextLine( 125 title=u'Internal Credit Card ID', 126 required=True, 127 ) 128 129 130 class IPaymentItem(Interface): 131 """Something to sell. 132 """ 133 item_id = schema.TextLine( 134 title=u'Payment Item ID', 135 required=True, 136 ) 137 138 title = schema.TextLine( 139 title=u'Title', 140 description=u'A short title of the good sold.', 141 required=True, 142 default=u'Unnamed' 143 ) 144 145 amount = schema.Decimal( 146 title=u'Amount', 147 description=u'Total amount, includung any taxes, fees, etc.', 148 required=True, 149 default=decimal.Decimal('0.00'), 150 ) 151 152 currency = schema.Choice( 153 title=u'Currency', 154 source=ISO_4217_CURRENCIES_VOCAB, 155 required=True, 156 default='USD', 157 ) 158 159 160 class IPayment(IContainer): 118 161 """A base representation of payments. 119 162 … … 139 182 we mark the payment 'failed'. 140 183 """ 184 contains(IPaymentItem) 185 141 186 payment_id = schema.TextLine( 142 187 title=u'Payment Identifier', … … 208 253 """ 209 254 210 211 class IOnlinePayment(IPayment):212 """A payment via payment gateways.213 214 """215 216 ac = schema.TextLine(217 title=_(u'Activation Code'),218 default=None,219 required=False,220 readonly=False,221 )222 223 r_amount_approved = schema.Float(224 title=_(u'Response Amount Approved'),225 default=0.0,226 required=False,227 readonly=False,228 )229 230 r_code = schema.TextLine(231 title=_(u'Response Code'),232 default=None,233 required=False,234 readonly=False,235 )236 237 r_desc = schema.TextLine(238 title=_(u'Response Description'),239 default=None,240 required=False,241 readonly=False,242 )243 244 def approve():245 "Approve an online payment and set to paid."246 247 248 class ICreditCard(Interface):249 """A credit card.250 251 A credit card is connected to a Payer.252 """253 credit_card_id = schema.TextLine(254 title=u'Internal Credit Card ID',255 required=True,256 )257 258 259 255 class IPayer(Interface): 260 256 """A payer. … … 283 279 required=True 284 280 ) 285 286 287 class IPaymentItem(Interface):288 """Something to sell.289 """290 item_id = schema.TextLine(291 title=u'Payment Item ID',292 required=True,293 )294 295 title = schema.TextLine(296 title=u'Title',297 description=u'A short title of the good sold.',298 required=True,299 default=u'Unnamed'300 )301 302 amount = schema.Decimal(303 title=u'Amount',304 description=u'Total amount, includung any taxes, fees, etc.',305 required=True,306 default=decimal.Decimal('0.00'),307 )308 309 currency = schema.Choice(310 title=u'Currency',311 source=ISO_4217_CURRENCIES_VOCAB,312 required=True,313 default='USD',314 ) -
main/waeup.ikoba/branches/uli-fake-gw-provider/src/waeup/ikoba/payments/payment.py
r12461 r12636 28 28 from waeup.ikoba.payments.interfaces import ( 29 29 IPayment, STATE_UNPAID, STATE_FAILED, STATE_PAID, 30 IPaymentGatewayService, IPayer, IPaymentItem, 30 IPaymentGatewayService, IPayer, IPaymentItem, IPayee, 31 31 ) 32 32 from waeup.ikoba.utils.logger import Logger … … 49 49 50 50 51 class Payment(grok.Model, Logger): 51 @attrs_to_fields 52 class Payment(grok.Container, Logger): 52 53 """This is a payment. 53 54 """ … … 64 65 self.payment_date = None 65 66 self.payment_id = u'PAY_' + unicode(uuid.uuid4().hex) 66 self.gateway_service = None67 #self.gateway_service = None 67 68 self.amount = decimal.Decimal("0.00") 68 self.payed_item_id = None69 self.payer_id = None69 #self.payed_item_id = None 70 #self.payer_id = None 70 71 self.state = STATE_UNPAID 71 72 return … … 97 98 98 99 @attrs_to_fields 100 class Payer(object): 101 """A Payment is for testing. 102 103 It cannot be stored in ZODB. 104 """ 105 grok.implements(IPayer) 106 107 108 @attrs_to_fields 99 109 class PaymentItem(grok.Model): 100 110 101 111 grok.implements(IPaymentItem) 112 113 def __init__(self): 114 super(PaymentItem, self).__init__() 115 116 117 118 @attrs_to_fields 119 class Payee(object): 120 """Someone being paid. 121 122 This is for testing only and cannot be stored in ZODB. 123 """ 124 grok.implements(IPayee)
Note: See TracChangeset for help on using the changeset viewer.