1 use Test::More tests => 1 + 2 * 5;
3 BEGIN { use_ok('Business::OnlinePayment') };
6 use constant FIELDS => (qw( result_code authorization total_amount ));
8 use constant RESULTS => (
9 [ 1, '2000', 'T00000', 3.88 ],
10 [ 0, '98e05', undef, 3.88 ],
14 my $txn = new Business::OnlinePayment 'InternetSecure', merchant_id => '0000';
21 $txn->parse_response($xml);
23 is($txn->server_response, $xml, 'server_response');
26 ok($txn->is_success, 'expecting success');
28 ok(!$txn->is_success, 'expecting failure');
33 is($txn->$_, shift @results, $_);
39 <?xml version="1.0" encoding="UTF-8"?>
41 <MerchantNumber>4994</MerchantNumber>
42 <ReceiptNumber>1096019995.5012</ReceiptNumber>
43 <SalesOrderNumber>0</SalesOrderNumber>
44 <xxxName>John Smith</xxxName>
45 <Date>2003/12/17 09:59:58</Date>
46 <CardType>Test Card Number</CardType>
48 <ApprovalCode>T00000</ApprovalCode>
49 <Verbiage>Test Approved</Verbiage>
50 <TotalAmount>3.88</TotalAmount>
54 <description>Test Product 1</description>
55 <quantity>1</quantity>
57 <subtotal>3.10</subtotal>
66 <description>Test Product 2</description>
67 <quantity>1</quantity>
69 <subtotal>0.20</subtotal>
77 <description>Test Product 3</description>
78 <quantity>1</quantity>
80 <subtotal>0.33</subtotal>
88 <description>Canadian GST Charged</description>
89 <quantity>1</quantity>
91 <subtotal>0.25</subtotal>
94 <flag>{CALCULATED}</flag>
98 <DoubleColonProducts>3.10::1::001::Test Product 1::{USD}{GST}{TEST}|0.20::1::010::Test Product 2::{GST}{TEST}|0.33::1::020::Test Product 3::{GST}{TEST}|0.25::1::GST::Canadian GST Charged::{TAX}{CALCULATED}</DoubleColonProducts>
103 <?xml version="1.0" encoding="UTF-8"?>
105 <MerchantNumber>4994</MerchantNumber>
106 <ReceiptNumber>1096021915.5853</ReceiptNumber>
107 <SalesOrderNumber>729</SalesOrderNumber>
108 <xxxName>John Smith</xxxName>
109 <Date>2003/12/17 10:31:58</Date>
110 <CardType>VI</CardType>
113 <Verbiage>Incorrect Card Number - Please Retry</Verbiage>
114 <TotalAmount>3.88</TotalAmount>
118 <description>Test Product 1</description>
119 <quantity>1</quantity>
121 <subtotal>3.10</subtotal>
129 <description>Test Product 2</description>
130 <quantity>1</quantity>
132 <subtotal>0.20</subtotal>
139 <description>Test Product 3</description>
140 <quantity>1</quantity>
142 <subtotal>0.33</subtotal>
149 <description>Canadian GST Charged</description>
150 <quantity>1</quantity>
152 <subtotal>0.25</subtotal>
155 <flag>{CALCULATED}</flag>
159 <DoubleColonProducts>3.10::1::001::Test Product 1::{USD}{GST}|0.20::1::010::Test Product 2::{GST}|0.33::1::020::Test Product 3::{GST}|0.25::1::GST::Canadian GST Charged::{TAX}{CALCULATED}</DoubleColonProducts>