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
Next revision
Previous revision
developer:soap:methods:bulkcurrencyconversion [2008/02/13 09:14]
nell
developer:soap:methods:bulkcurrencyconversion [2009/07/06 10:36]
epouchak
Line 1: Line 1:
-====== bulkCurrencyConversion ======+<embed ..:​contents/>​====== bulkCurrencyConversion ======
  
 Converts multiple amounts in a single method call. Converts multiple amounts in a single method call.
Line 19: Line 19:
 ===== Syntax ===== ===== Syntax =====
  
-[[developer:​soap:​objects:​CurrencyConversion]] **bulkCurrencyConversion** ( [[developer:​soap:​objects:​ueSecurityToken]] Token, integer FromCurrency,​ integer ToCurrency, double Amounts ) +[[..:​objects:​CurrencyConversion]] **bulkCurrencyConversion** ( [[..:​objects:​ueSecurityToken]] Token, integer FromCurrency,​ integer ToCurrency, double Amounts ) 
  
  
Line 25: Line 25:
  
 ^Type    ^Name     ​^Description ​   ^ ^Type    ^Name     ​^Description ​   ^
-|[[developer:​soap:​objects:​ueSecurityToken]] |Token |Merchant security token: used to identify merchant and validate transaction.|+|[[..:​objects:​ueSecurityToken]] |Token |Merchant security token: used to identify merchant and validate transaction.|
 |integer |FromCurrency |Currency code funds will be converted from.| |integer |FromCurrency |Currency code funds will be converted from.|
 |integer |ToCurrency |Currency code funds will be converted to.| |integer |ToCurrency |Currency code funds will be converted to.|
Line 33: Line 33:
 ===== Return Value ===== ===== Return Value =====
  
-|[[developer:​soap:​objects:​CurrencyConversion]] |Returns conversion rates and amounts of currency converted. |+|[[..:​objects:​CurrencyConversion]] |Returns conversion rates and amounts of currency converted. |
  
 ===== Examples ===== ===== Examples =====
  
 ==== PHP ==== ==== PHP ====
 +
 +For directions on how to set up the WSDL link, create "​$token"​ and "​$client",​ go to [[..:​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