Business-OnlinePayment-InternetSecure

 view release on metacpan or  search on metacpan

t/20emit.t  view on Meta::CPAN

		currency	=> 'USD',
		taxes		=> 'HST',

		description => [
				{
				amount		=> 9.99,
				quantity	=> 5,
				sku		=> 'a:001',
				description	=> 'Some product',
				},
				{
				amount		=> 5.65,
				description	=> 'Shipping',
				taxes		=> 'GST PST',
				},
				{
				amount		=> 10.00,
				description	=> 'Some HST example',
				taxes		=> [ 'GST', 'PST' ],
				},
				],
	},
	{
		_test		=> 1,

		action		=> 'Normal Authorization',

		card_number	=> '5111-1111-1111-1111',
		expiration	=> '7/2004',

		name		=> "\x{201c}Fr\x{e9}d\x{e9}ric Bri\x{e8}re\x{201d}",

		amount		=> 12.95,
		description	=> "Box o' goodies",
		currency	=> 'USD',
		taxes		=> 'GST',
	},
	{
		_test		=> -1,

		action		=> 'Normal Authorization',

		card_number	=> '5111-1111-1111-1111',
		expiration	=> '0704',

		name		=> "Fr\x{e9}d\x{e9}ric Bri\x{e8}re",

		amount		=> 13.95,
	},
);


my $txn = new Business::OnlinePayment 'InternetSecure', merchant_id => '0000';

foreach (TRANSACTIONS) {
	$txn->test_transaction(delete $_->{_test});
	$txn->content(%$_);

	my $data = do {
		# Work around bug #17687
		local $/ = '';
		scalar <DATA>;
	};

	is_deeply(
		xml_in($txn->to_xml),
		xml_in($data)
	);
}


__DATA__
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<TranxRequest>
  <MerchantNumber>0000</MerchantNumber>
  <xxxCard_Number>4111111111111111</xxxCard_Number>
  <xxxCCMonth>07</xxxCCMonth>
  <xxxCCYear>2004</xxxCCYear>
  <CVV2>000</CVV2>
  <CVV2Indicator>1</CVV2Indicator>
  <Products>9.99::5::a 001::Some product::{USD}{HST}|5.65::1::::Shipping::{USD}{GST}{PST}|10.00::1::::Some HST example::{USD}{GST}{PST}</Products>
  <xxxName>Frédéric Brière</xxxName>
  <xxxCompany></xxxCompany>
  <xxxAddress>123 Street</xxxAddress>
  <xxxCity>Metropolis</xxxCity>
  <xxxProvince>ZZ</xxxProvince>
  <xxxPostal>A1A 1A1</xxxPostal>
  <xxxCountry>CA</xxxCountry>
  <xxxPhone>(555) 555-1212</xxxPhone>
  <xxxEmail>fbriere@fbriere.net</xxxEmail>
  <xxxShippingName></xxxShippingName>
  <xxxShippingCompany></xxxShippingCompany>
  <xxxShippingAddress></xxxShippingAddress>
  <xxxShippingCity></xxxShippingCity>
  <xxxShippingProvince></xxxShippingProvince>
  <xxxShippingPostal></xxxShippingPostal>
  <xxxShippingCountry></xxxShippingCountry>
  <xxxShippingPhone></xxxShippingPhone>
  <xxxShippingEmail></xxxShippingEmail>
</TranxRequest>

<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<TranxRequest>
  <MerchantNumber>0000</MerchantNumber>
  <xxxCard_Number>5111111111111111</xxxCard_Number>
  <xxxCCMonth>07</xxxCCMonth>
  <xxxCCYear>2004</xxxCCYear>
  <CVV2></CVV2>
  <CVV2Indicator>0</CVV2Indicator>
  <Products>12.95::1::::Box o' goodies::{USD}{GST}{TEST}</Products>
  <xxxName>?Frédéric Brière?</xxxName>
  <xxxCompany></xxxCompany>
  <xxxAddress></xxxAddress>
  <xxxCity></xxxCity>
  <xxxProvince></xxxProvince>
  <xxxPostal></xxxPostal>
  <xxxCountry></xxxCountry>
  <xxxPhone></xxxPhone>
  <xxxEmail></xxxEmail>
  <xxxShippingName></xxxShippingName>
  <xxxShippingCompany></xxxShippingCompany>

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.380 second using v1.00-cache-2.02-grep-82fe00e-cpan-d29e8ade9f55 )