Beispiel #1
0
 def test_preauth_custinfo(self):
     expected_out = ('<?xml version="1.0"?><request><store_id>moneris</st'
                     'ore_id><api_token>hurgle</api_token><res_preauth_cc'
                     '><data_key>C181e5921rj5v1iaKSMf83q86</data_key><ord'
                     'er_id>res-preauth-1289067953</order_id><cust_id>mj<'
                     '/cust_id><amount>1.00</amount><crypt_type>7</crypt_'
                     'type><cust_info><email>[email protected]</email><inst'
                     'ructions>Make it fast</instructions><billing><first'
                     '_name>Joe</first_name><last_name>Thompson</last_nam'
                     'e><company_name>Widget Company Inc.</company_name><'
                     'address>111 Bolts Ave.</address><city>Toronto</city'
                     '><province>Ontario</province><postal_code>M8T 1T8</'
                     'postal_code><country>Canada</country><phone_number>'
                     '416-555-5555</phone_number><fax>416-555-5555</fax><'
                     'tax1>123.45</tax1><tax2>12.34</tax2><tax3>15.45</ta'
                     'x3><shipping_cost>456.23</shipping_cost></billing><'
                     'shipping><first_name>Joe</first_name><last_name>Tho'
                     'mpson</last_name><company_name>Widget Company Inc.<'
                     '/company_name><address>111 Bolts Ave.</address><cit'
                     'y>Toronto</city><province>Ontario</province><postal'
                     '_code>M8T 1T8</postal_code><country>Canada</country'
                     '><phone_number>416-555-5555</phone_number><fax>416-'
                     '555-5555</fax><tax1>123.45</tax1><tax2>12.34</tax2>'
                     '<tax3>15.45</tax3><shipping_cost>456.23</shipping_c'
                     'ost></shipping><item><name>item 1 name</name><quant'
                     'ity>53</quantity><product_code>item 1 product code<'
                     '/product_code><extended_amount>1.00</extended_amoun'
                     't></item><item><name>item 2 name</name><quantity>53'
                     '</quantity><product_code>item 2 product code</produ'
                     'ct_code><extended_amount>1.00</extended_amount></it'
                     'em></cust_info></res_preauth_cc></request>')
     txn = Transaction(type='res_preauth_cc',
                       data_key='C181e5921rj5v1iaKSMf83q86',
                       order_id='res-preauth-1289067953',
                       cust_id='mj',
                       amount='1.00',
                       crypt_type='7')
     billing = dict(first_name='Joe',
                    last_name='Thompson',
                    company_name='Widget Company Inc.',
                    address='111 Bolts Ave.',
                    city='Toronto',
                    province='Ontario',
                    postal_code='M8T 1T8',
                    country='Canada',
                    phone_number='416-555-5555',
                    fax='416-555-5555',
                    tax1='123.45',
                    tax2='12.34',
                    tax3='15.45',
                    shipping_cost='456.23')
     shipping = dict(first_name='Joe',
                     last_name='Thompson',
                     company_name='Widget Company Inc.',
                     address='111 Bolts Ave.',
                     city='Toronto',
                     province='Ontario',
                     postal_code='M8T 1T8',
                     country='Canada',
                     phone_number='416-555-5555',
                     fax='416-555-5555',
                     tax1='123.45',
                     tax2='12.34',
                     tax3='15.45',
                     shipping_cost='456.23')
     items = [
         dict(name='item 1 name',
              quantity='53',
              product_code='item 1 product code',
              extended_amount='1.00'),
         dict(name='item 2 name',
              quantity='53',
              product_code='item 2 product code',
              extended_amount='1.00')
     ]
     txn.add_cust_info(email='*****@*****.**',
                       instructions='Make it fast',
                       shipping=shipping,
                       billing=billing,
                       item=items)
     test_out = self.svr._to_xml(txn)
     assert test_out == expected_out
 def test_preauth_custinfo(self):
     expected_out = ('<?xml version="1.0"?><request><store_id>moneris</st'
                     'ore_id><api_token>hurgle</api_token><res_preauth_cc'
                     '><data_key>C181e5921rj5v1iaKSMf83q86</data_key><ord'
                     'er_id>res-preauth-1289067953</order_id><cust_id>mj<'
                     '/cust_id><amount>1.00</amount><crypt_type>7</crypt_'
                     'type><cust_info><email>[email protected]</email><inst'
                     'ructions>Make it fast</instructions><billing><first'
                     '_name>Joe</first_name><last_name>Thompson</last_nam'
                     'e><company_name>Widget Company Inc.</company_name><'
                     'address>111 Bolts Ave.</address><city>Toronto</city'
                     '><province>Ontario</province><postal_code>M8T 1T8</'
                     'postal_code><country>Canada</country><phone_number>'
                     '416-555-5555</phone_number><fax>416-555-5555</fax><'
                     'tax1>123.45</tax1><tax2>12.34</tax2><tax3>15.45</ta'
                     'x3><shipping_cost>456.23</shipping_cost></billing><'
                     'shipping><first_name>Joe</first_name><last_name>Tho'
                     'mpson</last_name><company_name>Widget Company Inc.<'
                     '/company_name><address>111 Bolts Ave.</address><cit'
                     'y>Toronto</city><province>Ontario</province><postal'
                     '_code>M8T 1T8</postal_code><country>Canada</country'
                     '><phone_number>416-555-5555</phone_number><fax>416-'
                     '555-5555</fax><tax1>123.45</tax1><tax2>12.34</tax2>'
                     '<tax3>15.45</tax3><shipping_cost>456.23</shipping_c'
                     'ost></shipping><item><name>item 1 name</name><quant'
                     'ity>53</quantity><product_code>item 1 product code<'
                     '/product_code><extended_amount>1.00</extended_amoun'
                     't></item><item><name>item 2 name</name><quantity>53'
                     '</quantity><product_code>item 2 product code</produ'
                     'ct_code><extended_amount>1.00</extended_amount></it'
                     'em></cust_info></res_preauth_cc></request>')
     txn = Transaction(type='res_preauth_cc',
                       data_key='C181e5921rj5v1iaKSMf83q86',
                       order_id='res-preauth-1289067953',
                       cust_id='mj',
                       amount='1.00',
                       crypt_type='7')
     billing = dict(first_name='Joe',
                    last_name='Thompson',
                    company_name='Widget Company Inc.',
                    address='111 Bolts Ave.',
                    city='Toronto',
                    province='Ontario',
                    postal_code='M8T 1T8',
                    country='Canada',
                    phone_number='416-555-5555',
                    fax='416-555-5555',
                    tax1='123.45',
                    tax2='12.34',
                    tax3='15.45',
                    shipping_cost='456.23')
     shipping = dict(first_name='Joe',
                     last_name='Thompson',
                     company_name='Widget Company Inc.',
                     address='111 Bolts Ave.',
                     city='Toronto',
                     province='Ontario',
                     postal_code='M8T 1T8',
                     country='Canada',
                     phone_number='416-555-5555',
                     fax='416-555-5555',
                     tax1='123.45',
                     tax2='12.34',
                     tax3='15.45',
                     shipping_cost='456.23')
     items = [dict(name='item 1 name', 
                   quantity='53', 
                   product_code='item 1 product code',
                   extended_amount='1.00'),
              dict(name='item 2 name', 
                   quantity='53', 
                   product_code='item 2 product code',
                   extended_amount='1.00')]
     txn.add_cust_info(email='*****@*****.**',
                       instructions='Make it fast',
                       shipping=shipping,
                       billing=billing,
                       item=items)
     test_out = self.svr._to_xml(txn)
     assert test_out == expected_out