developer:soap:methods:bulkcurrencyconversion

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Last revision Both sides next revision
developer:soap:methods:bulkcurrencyconversion [2008/02/13 09:14]
nell
developer:soap:methods:bulkcurrencyconversion [2009/01/19 11:05]
hmcgowan
Line 38: Line 38:
  
 ==== PHP ==== ==== PHP ====
 +
 +For directions on how to set up the WSDL link, create "​$token"​ and "​$client",​ go to [[developer:​soap:​howto:​php|PHP Soap How-to]].
  
 <code php> <code php>
 <?​php ​ <?​php ​
- 
-// for directions on how to set up the  ​ 
-// WSDL link and create "​$mctoken"​ and "​$client," ​ 
-// see: http://​usaepay.com/​developer/​howto/​php. ​ 
  
 try {  try { 
  
-   $ToCurrency='​978';​  +  ​$ToCurrency='​978';​  
-   ​$FromCurrency='​840';​  +  $FromCurrency='​840';​  
-   ​$Amounts=array(  +  $Amounts=array(  
-      50.10,  +    50.10,  
-      11.23,  +    11.23,  
-      34.21,  +    34.21,  
-      12.23  +    12.23  
-        );     +    );     
  
-   $res=$client->​bulkCurrencyConversion($mctoken,​ $FromCurrency,​ $ToCurrency,​ $Amounts);  +  ​$res=$client->​bulkCurrencyConversion($mctoken,​ $FromCurrency,​ $ToCurrency,​ $Amounts);  
-           ​print_r($res); ​+  print_r($res); ​
  
-   $this->​assertEquals(count($res),​ count($Amounts)); ​+  ​$this->​assertEquals(count($res),​ count($Amounts)); ​
                            
-   $this->​assertEquals($res[0]->​FromCurrency,​ $FromCurrency); ​+  ​$this->​assertEquals($res[0]->​FromCurrency,​ $FromCurrency); ​
  
-   $this->​assertEquals($res[0]->​Currency,​ $ToCurrency); ​+  ​$this->​assertEquals($res[0]->​Currency,​ $ToCurrency); ​
  
-   $this->​assertEquals($res[0]->​FromAmount,​ $Amounts[0]); ​+  ​$this->​assertEquals($res[0]->​FromAmount,​ $Amounts[0]); ​
  
-   $this->​assertTrue($res[0]->​Rate > 0); +  ​$this->​assertTrue($res[0]->​Rate > 0); 
  
-   $this->​assertTrue($res[0]->​Amount > 0); +  ​$this->​assertTrue($res[0]->​Amount > 0); 
                            
-} catch (SoapFault $e) {  +  ​ 
-     ​die('​Currency conversion failed : '​.$e->​getMessage()); ​+ 
 +catch (SoapFault $e) {  
 +  die('​Currency conversion failed : '​.$e->​getMessage()); ​
  
  
 ?>  ?> 
 </​code>​ </​code>​
developer/soap/methods/bulkcurrencyconversion.txt · Last modified: 2009/07/06 10:36 by epouchak

Page Tools