developer:soap-1.6:methods:bulkcurrencyconversion

Differences

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

Link to this comparison view

developer:soap-1.6:methods:bulkcurrencyconversion [2012/08/04 11:27] (current)
tem created
Line 1: Line 1:
 +<embed ..:​contents/>​====== bulkCurrencyConversion ======
  
 +Converts multiple amounts in a single method call.
 +
 +===== Description =====
 +
 +This method allows you to complete a large batch of currency conversions all at once without having to use the [[currencyConversion]] method for each conversion.
 +
 +Currently this method supports bulk conversions from a single currency to another single currency and not several currencies simultaneously. (ie: if you want to convert fifty amounts from USD [US dollars] to CAD [Canadian dollars] and twenty amounts from USD to EUR [Euros] you would need to run two separate **bulkCurrencyConversion** method calls.)
 +
 +To determine if a currency is supported by a merchant account, use either the [[getSupportedCurrencies]] or the [[getAccountDetails]] method.
 +
 +Each currency type is assigned a three digit numeric code (ie: USD=840, Japanese yen=392). You must enter the three digit code for both the original currency and the converted currency in a conversion. The Currency Code list provides all of the three digit codes and their corresponding currencies for international currency conversion.
 +
 +If you would like to add support for multi-currency transactions to a merchant account please contact the merchant'​s service provider or customer service.
 +
 +See also [[currencyConversion]],​ [[getSupportedCurrencies]] ​
 +
 +===== Syntax =====
 +
 +[[..:​objects:​CurrencyConversion]] **bulkCurrencyConversion** ( [[..:​objects:​ueSecurityToken]] Token, integer FromCurrency,​ integer ToCurrency, double Amounts ) 
 +
 +
 +===== Arguments =====
 +
 +^Type    ^Name     ​^Description ​   ^
 +|[[..:​objects:​ueSecurityToken]] |Token |Merchant security token: used to identify merchant and validate transaction.|
 +|integer |FromCurrency |Currency code funds will be converted from.|
 +|integer |ToCurrency |Currency code funds will be converted to.|
 +|double |Amounts |Array of Amounts being converted. |
 +
 +
 +===== Return Value =====
 +
 +|[[..:​objects:​CurrencyConversion]] |Returns conversion rates and amounts of currency converted. |
 +
 +===== Examples =====
 +
 +==== 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>
 +<?​php ​
 +
 +try { 
 +
 +  $ToCurrency='​978'; ​
 +  $FromCurrency='​840'; ​
 +  $Amounts=array( ​
 +    50.10, ​
 +    11.23, ​
 +    34.21, ​
 +    12.23 
 +    );     
 +
 +  $res=$client->​bulkCurrencyConversion($mctoken,​ $FromCurrency,​ $ToCurrency,​ $Amounts); ​
 +  print_r($res); ​
 +
 +  $this->​assertEquals(count($res),​ count($Amounts)); ​
 +             
 +  $this->​assertEquals($res[0]->​FromCurrency,​ $FromCurrency); ​
 +
 +  $this->​assertEquals($res[0]->​Currency,​ $ToCurrency); ​
 +
 +  $this->​assertEquals($res[0]->​FromAmount,​ $Amounts[0]); ​
 +
 +  $this->​assertTrue($res[0]->​Rate > 0); 
 +
 +  $this->​assertTrue($res[0]->​Amount > 0); 
 +             
 +  } 
 +
 +catch (SoapFault $e) { 
 +  die('​Currency conversion failed : '​.$e->​getMessage()); ​
 +
 +
 +?> 
 +</​code>​
 +
 +==== .NET VB ====
 +<code vb>
 +Dim from As String
 +        Dim convert As String
 +        Dim amount(0 To 2) As Double
 +        from = "​036"​
 +        convert = "​826"​
 +        amount(0) = 10
 +        amount(1) = 20
 +        amount(2) = 30
 +
 +        Dim response() As usaepay.CurrencyConversion
 +
 +        response = client.bulkCurrencyConversion(token,​ from, convert, amount)
 +        MsgBox(response.Length)
 +</​code>​
 +
 +==== .NET C# ====
 +<code c>
 +            string from = "​124";​
 +            string to = "​826";​
 +            double[] amount = new double[3];
 +            amount[0] = 10;
 +            amount[1] = 5;
 +            amount[2] = 19.99;
 +
 +            //​usaepay.CurrencyConversion response = new usaepay.CurrencyConversion();​
 +
 +            try
 +            {
 +                usaepay.CurrencyConversion[] response = client.bulkCurrencyConversion(token,​ from, to, amount);
 +                MessageBox.Show(string.Concat(response.Length));​
 +            }
 +
 +            catch (Exception err)
 +            {
 +                MessageBox.Show(err.Message);​
 +            }
 +</​code>​
 +
 +===== Change History =====
 +
 +^ Version ^ Change ^
 +| [[developer:​soap-1.1:​methods:​bulkcurrencyconversion|1.1]] | Method added prior to soap-1.1 |
developer/soap-1.6/methods/bulkcurrencyconversion.txt ยท Last modified: 2012/08/04 11:27 by tem

Page Tools