Ignore:
Timestamp:
11 Mar 2015, 10:16:58 (10 years ago)
Author:
uli
Message:

Remove obsolete func.

Location:
main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/contracts.py

    r12727 r12728  
    6161
    6262
    63 def payment_items_from_contract(contract):
    64     """Turn contract product options into payment items.
    65     """
    66     result = []
    67     for num, option in enumerate(contract.product_options):
    68         item = PaymentItem()
    69         item.item_id = u'%s' % num
    70         item.title = option.title
    71         item.amount = option.fee
    72         result.append(item)
    73     return result
    74 
    75 
    7663class ContractPayer(grok.Adapter):
    7764    """Adapter to turn contracts into IPayers.
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/customers/tests/test_contract.py

    r12727 r12728  
    2828    IContractsContainer, IContract)
    2929from waeup.ikoba.customers.contracts import (
    30     ContractsContainer, SampleContract, payment_items_from_contract,
    31     ContractPayer, ContractFinder, PayableContract,
     30    ContractsContainer, SampleContract, ContractPayer, ContractFinder,
     31    PayableContract,
    3232    )
    3333from waeup.ikoba.app import Company
     
    105105    layer = FunctionalLayer
    106106
    107     def test_payment_items_from_contract(self):
    108         # we can turn contracts into lists of payment items
    109         contract = SampleContract()
    110         option1 = ProductOption(u"Fee 1", decimal.Decimal("31.10"), "USD")
    111         option2 = ProductOption(u"Fee 2", decimal.Decimal("12.12"), "USD")
    112         contract.product_options = [option1, option2]
    113         payment_items = payment_items_from_contract(contract)
    114         assert len(payment_items) == 2
    115         item1, item2 = payment_items
    116         assert IPaymentItem.providedBy(item1)
    117         assert IPaymentItem.providedBy(item2)
    118         assert item1.item_id == "0"
    119         assert item2.item_id == "1"
    120         assert item1.title == u'Fee 1'
    121         assert item2.title == u'Fee 2'
    122         assert item1.amount == decimal.Decimal("31.10")
    123         assert item2.amount == decimal.Decimal("12.12")
    124 
    125     def test_payment_item_from_contract_no_options(self):
    126         # we cope with empty contracts
    127         contract = SampleContract()
    128         payment_items = payment_items_from_contract(contract)
    129         assert payment_items == []
    130 
    131107    def test_payer_adapter(self):
    132108        # we can adapt IContract to IPayer (i.e. create a payer)
Note: See TracChangeset for help on using the changeset viewer.