Skip to content

Money SDK

Greg Swindle edited this page Sep 6, 2017 · 7 revisions

Business archetypes logo

Money API and SDK Documentation ⍟ v1.0.0

The Money archetype represents an amount of a specific Currency.

Table of contents


Standards compliance

Standard Contents
OMG Currency Specification v1.0 A standard to support international currency.
ISO 4217 Three- and two-letter currency codes, currency numbers, and currency names.
ISO 3166 Two-letter country codes and country names.

Business archetypes defined

"A business archetype is a primordial thing that occurs consistently and universally in business domains and business software systems." (Arlow & Neustadt, Enterprise patterns and MDA: building better software with archetype patterns and UML, 2006, p. 5)

Explore other business archetype patterns

Open a Swagger-UI instance, then copy and paste the following Swagger specification URLs into the "Explore" text field and select the "Explore" button for additional APIs.

  1. Locale: http://api.swindle.net/archetypes/v1/schemas/locales/locales.yaml
  2. Money: http://api.swindle.net/archetypes/v1/schemas/money/money.yaml
  3. Party: http://api.swindle.net/archetypes/v1/schemas/parties/parties.yaml
  4. Quantity: http://api.swindle.net/archetypes/v1/schemas/quantities/quantities.yaml

Currency

Currency implements Metric and is acceptedIn one or more Locales. Currency's unique identifier is its alphabeticCode.

At present, there are two fundamentally different types of currency -- those that are specified by ISO and those that are not.

  1. IsoCurrency represents a type of Currency with ISO 4217 definitions for
  • name,
  • alphabeticCode, and
  • numericCode.
  1. NonIsoCurrency represents a type of Currency that is not defined in any ISO specification. These types of currency might unrecognized or arbitrary "rewards," like American Airlines AAdvantage Miles.

getCurrencies

Retrieve all currencies.

GET /currencies

Usage and SDK Samples

Curl

curl -X GET "http://api.swindle.net/archetypes/v1/money/currencies"

Java

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CurrencyApi;

import java.io.File;
import java.util.*;

public class CurrencyApiExample {

    public static void main(String[] args) {

        CurrencyApi apiInstance = new CurrencyApi();
        try {
            array[Currency_1] result = apiInstance.getCurrencies();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CurrencyApi#getCurrencies");
            e.printStackTrace();
        }
    }
}

Android

Java

import io.swagger.client.api.CurrencyApi;

public class CurrencyApiExample {

    public static void main(String[] args) {
        CurrencyApi apiInstance = new CurrencyApi();
        try {
            array[Currency_1] result = apiInstance.getCurrencies();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CurrencyApi#getCurrencies");
            e.printStackTrace();
        }
    }
}

Objective-C

CurrencyApi *apiInstance = [[CurrencyApi alloc] init];

// Retrieve all currencies.
[apiInstance getCurrenciesWithCompletionHandler:
              ^(array[Currency_1] output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];

JavaScript

const Money = require('money');

const api = new Money.CurrencyApi()

const callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getCurrencies(callback);

C#

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class getCurrenciesExample
    {
        public void main()
        {

            const apiInstance = new CurrencyApi();

            try
            {
                // Retrieve all currencies.
                array[Currency_1] result = apiInstance.getCurrencies();
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CurrencyApi.getCurrencies: " + e.Message );
            }
        }
    }
}

PHP

getCurrencies();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CurrencyApi->getCurrencies: ', $e->getMessage(), PHP_EOL;
}
?>

Perl

use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CurrencyApi;

my $api_instance = WWW::SwaggerClient::CurrencyApi->new();

eval {
    my $result = $api_instance->getCurrencies();
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CurrencyApi->getCurrencies: $@\n";
}

Python

from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

## create an instance of the API class
api_instance = swagger_client.CurrencyApi()

try:
    # Retrieve all currencies.
    api_response = api_instance.get_currencies()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CurrencyApi->getCurrencies: %s\n" % e)

Parameters

Responses

Status: 200 - OK


getCurrencyByAlphabeticCode

Retrieve a specific Currency by its alphabetic code.

GET /currencies/{alphabetic-code}

Usage and SDK Samples

Curl

curl -X GET "http://api.swindle.net/archetypes/v1/money/currencies/{alphabetic-code}"

Java

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.CurrencyApi;

import java.io.File;
import java.util.*;

public class CurrencyApiExample {

    public static void main(String[] args) {

        CurrencyApi apiInstance = new CurrencyApi();
        String alphabeticCode = alphabeticCode_example; // String | An alphabetic code that represents the currency.
        try {
            Currency_1 result = apiInstance.getCurrencyByAlphabeticCode(alphabeticCode);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CurrencyApi#getCurrencyByAlphabeticCode");
            e.printStackTrace();
        }
    }
}

Android

import io.swagger.client.api.CurrencyApi;

public class CurrencyApiExample {

    public static void main(String[] args) {
        CurrencyApi apiInstance = new CurrencyApi();
        String alphabeticCode = alphabeticCode_example; // String | An alphabetic code that represents the currency.
        try {
            Currency_1 result = apiInstance.getCurrencyByAlphabeticCode(alphabeticCode);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling CurrencyApi#getCurrencyByAlphabeticCode");
            e.printStackTrace();
        }
    }
}

Objective-C

String *alphabeticCode = alphabeticCode_example; // An alphabetic code that represents the currency.

CurrencyApi *apiInstance = [[CurrencyApi alloc] init];

// Retrieve a Currency by alphabetic code.
[apiInstance getCurrencyByAlphabeticCodeWith:alphabeticCode
              completionHandler: ^(Currency_1 output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];

JavaScript

const Money = require('money');

const api = new Money.CurrencyApi()

const alphabeticCode = alphabeticCode_example; // {String} An alphabetic code that represents the currency.

const callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getCurrencyByAlphabeticCode(alphabeticCode, callback);

C#

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class getCurrencyByAlphabeticCodeExample
    {
        public void main()
        {

            const apiInstance = new CurrencyApi();
            const alphabeticCode = alphabeticCode_example;  // String | An alphabetic code that represents the currency.

            try
            {
                // Retrieve a Currency by alphabetic code.
                Currency_1 result = apiInstance.getCurrencyByAlphabeticCode(alphabeticCode);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling CurrencyApi.getCurrencyByAlphabeticCode: " + e.Message );
            }
        }
    }
}

PHP

getCurrencyByAlphabeticCode($alphabeticCode);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CurrencyApi->getCurrencyByAlphabeticCode: ', $e->getMessage(), PHP_EOL;
}
?>

Perl

use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::CurrencyApi;

my $api_instance = WWW::SwaggerClient::CurrencyApi->new();
my $alphabeticCode = alphabeticCode_example; # String | An alphabetic code that represents the currency.

eval {
    my $result = $api_instance->getCurrencyByAlphabeticCode(alphabeticCode => $alphabeticCode);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling CurrencyApi->getCurrencyByAlphabeticCode: $@\n";
}

Python

from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# create an instance of the API class
api_instance = swagger_client.CurrencyApi()
alphabeticCode = alphabeticCode_example # String | An alphabetic code that represents the currency.

try:
    # Retrieve a Currency by alphabetic code.
    api_response = api_instance.get_currency_by_alphabetic_code(alphabeticCode)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling CurrencyApi->getCurrencyByAlphabeticCode: %s\n" % e)

Parameters

Path parameters

Name Description
alphabetic-code* String An alphabetic code that represents the currency. Required

Responses

Status: 200 - OK


Payment

The Payment archetype represents Money paid by one Party to another in return for goods or services.

getPayments

Retrieve all payments.

GET /payments

Usage and SDK Samples

Curl

curl -X GET "http://api.swindle.net/archetypes/v1/money/payments"

Java

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.PaymentApi;

import java.io.File;
import java.util.*;

public class PaymentApiExample {

    public static void main(String[] args) {

        PaymentApi apiInstance = new PaymentApi();
        try {
            array[Payment_1] result = apiInstance.getPayments();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling PaymentApi#getPayments");
            e.printStackTrace();
        }
    }
}

Android

import io.swagger.client.api.PaymentApi;

public class PaymentApiExample {

    public static void main(String[] args) {
        PaymentApi apiInstance = new PaymentApi();
        try {
            array[Payment_1] result = apiInstance.getPayments();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling PaymentApi#getPayments");
            e.printStackTrace();
        }
    }
}

Objective-C

PaymentApi *apiInstance = [[PaymentApi alloc] init];

// Retrieve all payments.
[apiInstance getPaymentsWithCompletionHandler:
              ^(array[Payment_1] output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];

JavaScript

const Money = require('money');

const api = new Money.PaymentApi()

const callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getPayments(callback);

C#

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class getPaymentsExample
    {
        public void main()
        {

            const apiInstance = new PaymentApi();

            try
            {
                // Retrieve all payments.
                array[Payment_1] result = apiInstance.getPayments();
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PaymentApi.getPayments: " + e.Message );
            }
        }
    }
}

PHP

getPayments();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling PaymentApi->getPayments: ', $e->getMessage(), PHP_EOL;
}
?>

Perl

use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::PaymentApi;

my $api_instance = WWW::SwaggerClient::PaymentApi->new();

eval {
    my $result = $api_instance->getPayments();
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling PaymentApi->getPayments: $@\n";
}

Python

from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

## create an instance of the API class
api_instance = swagger_client.PaymentApi()

try:
    # Retrieve all payments.
    api_response = api_instance.get_payments()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling PaymentApi->getPayments: %s\n" % e)

Parameters

Responses

Status: 200 - OK


PaymentMethod

A PaymentMethod is a medium by which Money is transferred.

PaymentMethods include (but are not limited to):

  • PaymentCard
  • CreditCard
  • DebitCard
  • GiftCard
  • Donation
  • Cash
  • DigitalCurrency
  • Check

getPaymentMethods

Retrieve all payment method types.

GET /payment-methods

Usage and SDK Samples

Curl

curl -X GET "http://api.swindle.net/archetypes/v1/money/payment-methods"

Java

import io.swagger.client.*;
import io.swagger.client.auth.*;
import io.swagger.client.model.*;
import io.swagger.client.api.PaymentMethodApi;

import java.io.File;
import java.util.*;

public class PaymentMethodApiExample {

    public static void main(String[] args) {

        PaymentMethodApi apiInstance = new PaymentMethodApi();
        try {
            array[Object] result = apiInstance.getPaymentMethods();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling PaymentMethodApi#getPaymentMethods");
            e.printStackTrace();
        }
    }
}

Android

import io.swagger.client.api.PaymentMethodApi;

public class PaymentMethodApiExample {

    public static void main(String[] args) {
        PaymentMethodApi apiInstance = new PaymentMethodApi();
        try {
            array[Object] result = apiInstance.getPaymentMethods();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling PaymentMethodApi#getPaymentMethods");
            e.printStackTrace();
        }
    }
}

Objective-C

PaymentMethodApi *apiInstance = [[PaymentMethodApi alloc] init];

// Retrieve all payment method types.
[apiInstance getPaymentMethodsWithCompletionHandler:
              ^(array[Object] output, NSError* error) {
                            if (output) {
                                NSLog(@"%@", output);
                            }
                            if (error) {
                                NSLog(@"Error: %@", error);
                            }
                        }];

JavaScript

const Money = require('money');

const api = new Money.PaymentMethodApi()

const callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getPaymentMethods(callback);

C#

using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class getPaymentMethodsExample
    {
        public void main()
        {

            const apiInstance = new PaymentMethodApi();

            try
            {
                // Retrieve all payment method types.
                array[Object] result = apiInstance.getPaymentMethods();
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling PaymentMethodApi.getPaymentMethods: " + e.Message );
            }
        }
    }
}

PHP

getPaymentMethods();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling PaymentMethodApi->getPaymentMethods: ', $e->getMessage(), PHP_EOL;
}
?>

Perl

use Data::Dumper;
use WWW::SwaggerClient::Configuration;
use WWW::SwaggerClient::PaymentMethodApi;

my $api_instance = WWW::SwaggerClient::PaymentMethodApi->new();

eval {
    my $result = $api_instance->getPaymentMethods();
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling PaymentMethodApi->getPaymentMethods: $@\n";
}

Python

from __future__ import print_statement
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

### create an instance of the API class
api_instance = swagger_client.PaymentMethodApi()

try:
    # Retrieve all payment method types.
    api_response = api_instance.get_payment_methods()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling PaymentMethodApi->getPaymentMethods: %s\n" % e)

Parameters

Responses

Status: 200 - OK


Suggestions, contact, support and error reporting; Contact Info: [email protected]

Apache 2.0 http://www.apache.org/licenses/LICENSE-2.0.html Generated 2017-09-05T07:16:36.039Z

APIs and SDKs (v1.0.0)

  1. Party: an identifiable, addressable entity that may have a legal status and that normally has autonomous control over (at least some of) its actions.
  2. Money: represents an amount of a specific Currency.

Tools

  1. swagger-codegen: servers compared

References

  1. HTTP Status Codes
  2. MDA Guide rev. 2.0
  3. REST Tutorial

Product delivery roadmap

  1. Epics (all archetypes Projects)
  2. MVPs (all archetypes Milestones)
  3. Issues (all, open)
Clone this wiki locally