iOS SDK Samples - Currencies Operations
Get Currencies
//company is the object of getCompanyInfo()
$company.getCurrencies() { result in
switch result
{
case .success( let currencies, let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}
Get Currencies from the Server
//company is the object of getCompanyInfo()
$company.getCurrenciesFromServer() { result in
switch result
{
case .success( let currencies, let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}
Get a Currency by its ID
//company is the object of getCompanyInfo()
$company.getCurrency(id : 345xxx56) { result in
switch result
{
case .success( let currencies, let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}
Get a Currency by its ID from the Server
//company is the object of getCompanyInfo()
$company.getCurrenciesFromServer(id : 345xxx456) { result in
switch result
{
case .success( let currencies, let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}
Enable Multi-currency
// currency is the object of newCurrency
//company is the object of getCompanyInfo()
$company.enableMultiCurrency(currency) { result in
switch result
{
case .success( let currency, let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}
Add a List of Currencies
// currency and currency1 are the objects of newCurrency
//company is the object of getCompanyInfo()
$company.addCurrencies([currency, currency1]) { result in
switch result
{
case .success( let currency, let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}
Update Currencies
// currency1 and currency2 are the objects of newCurrency
//company is the object of getCompanyInfo()
$company.updateCurrencies( [ currency1, currency2 ] ) { result in
switch result
{
case .success( let updatedCurrencies, let response) :
print ("ResponseJSON : \( response.responseJSON )")
case .failure(let error) :
print ( "Throws exception : \(error)" )
}
}