1 use Test::More tests => 1 + 2 * 6;
3 BEGIN { use_ok('Business::OnlinePayment') };
6 use constant FIELDS => (qw( result_code authorization total_amount
9 use constant RESULTS => (
10 [ 1, '2000', 'T00000', 3.88, 'Test Approved' ],
11 [ 0, '98e05', undef, 3.88, 'Real error message' ],
15 my $txn = new Business::OnlinePayment 'InternetSecure', merchant_id => '0000';
22 $txn->parse_response($xml);
24 is($txn->server_response, $xml, 'server_response');
27 ok($txn->is_success, 'expecting success');
29 ok(!$txn->is_success, 'expecting failure');
34 is($txn->$_, shift @results, $_);
40 <?xml version="1.0" encoding="UTF-8"?>
42 <MerchantNumber>4994</MerchantNumber>
43 <ReceiptNumber>1096019995.5012</ReceiptNumber>
44 <SalesOrderNumber>0</SalesOrderNumber>
45 <xxxName>John Smith</xxxName>
46 <Date>2003/12/17 09:59:58</Date>
47 <CardType>Test Card Number</CardType>
49 <ApprovalCode>T00000</ApprovalCode>
50 <Verbiage>Test Approved</Verbiage>
51 <TotalAmount>3.88</TotalAmount>
55 <description>Test Product 1</description>
56 <quantity>1</quantity>
58 <subtotal>3.10</subtotal>
67 <description>Test Product 2</description>
68 <quantity>1</quantity>
70 <subtotal>0.20</subtotal>
78 <description>Test Product 3</description>
79 <quantity>1</quantity>
81 <subtotal>0.33</subtotal>
89 <description>Canadian GST Charged</description>
90 <quantity>1</quantity>
92 <subtotal>0.25</subtotal>
95 <flag>{CALCULATED}</flag>
99 <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>
104 <?xml version="1.0" encoding="UTF-8"?>
106 <MerchantNumber>4994</MerchantNumber>
107 <ReceiptNumber>1096021915.5853</ReceiptNumber>
108 <SalesOrderNumber>729</SalesOrderNumber>
109 <xxxName>John Smith</xxxName>
110 <Date>2003/12/17 10:31:58</Date>
111 <CardType>VI</CardType>
114 <Verbiage>Incorrect Card Number - Please Retry</Verbiage>
115 <Error>Real error message</Error>
116 <TotalAmount>3.88</TotalAmount>
120 <description>Test Product 1</description>
121 <quantity>1</quantity>
123 <subtotal>3.10</subtotal>
131 <description>Test Product 2</description>
132 <quantity>1</quantity>
134 <subtotal>0.20</subtotal>
141 <description>Test Product 3</description>
142 <quantity>1</quantity>
144 <subtotal>0.33</subtotal>
151 <description>Canadian GST Charged</description>
152 <quantity>1</quantity>
154 <subtotal>0.25</subtotal>
157 <flag>{CALCULATED}</flag>
161 <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>