Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagec#
themeRDark
titleC# - Create business transactions
linenumberstrue
//Create a business event for a deposit with four business transactions using the CreateBusinessTransaction method
var client = new BFSServiceReference.bfsapiSoapClient();

var credentials = new BFSServiceReference.Credentials()
{
    UserName = bfsusername, //Username of administrative user in your instance of BFS
    Password = bfspassword, //Password of the administrative user in your instance of BFS
};

var response = client.CreateBusinessTransactions(new BFSServiceReference.CreateBusinessTransactionRequest()
{
    Credentials = credentials,

    identify = bfsidentifier, //Identifier is a unique token for your instance of BFS        

    Entities = new[]
    {
        new SuperTransaction()
        {
            BusinessTransactions = new BusinessTransaction[]
            {
                //Transaction for customer BFS-account
              new BusinessTransaction()
              {
                  Account = new Guid("cbfe4a0d-bf05-4a7e-bdc8-1ee809817bee"),
                  BusinessTransactionType = "Default_Transfer_Trade_Cash",
                  TransactionReference = "Test",
                  Asset1 = new Guid("21b0718c-bce9-4c6b-b1c9-520b65121ff6"),
                  AmountAsset1 = 100M,
                  //Since the transaction type is for only the Trade dimension as suggested by the transaction name 
                  TradeDate = DateTime.Parse("2016-04-18")
              },
              //Transaction for customer BFS-account
              new BusinessTransaction()
              {
                  Account = new Guid("cbfe4a0d-bf05-4a7e-bdc8-1ee809817bee"),
                  BusinessTransactionType = "Default_Transfer_Settle_Cash",
                  TransactionReference = "Test",
                  Asset1 = new Guid("21b0718c-bce9-4c6b-b1c9-520b65121ff6"),
                  AmountAsset1 = 100M,
                  //Since the transaction type is for only the Settle dimension as suggested by the transaction name 
                  SettlementDate = DateTime.Parse("2016-04-18"),
                  ValueDate = DateTime.Parse("2016-04-18")
              },
              //Transaction for house Custody account
              new BusinessTransaction()
              {
                  Account = new Guid("25c7b534-c2b6-47a9-a3df-1dcc88b1f49c"),
                  BusinessTransactionType = "Default_Transfer_Trade_Cash",
                  TransactionReference = "Test",
                  Asset1 = new Guid("21b0718c-bce9-4c6b-b1c9-520b65121ff6"),
                  AmountAsset1 = 100M,
                  //Since the transaction type is for only the Trade dimension as suggested by the transaction name 
                  TradeDate = DateTime.Parse("2016-04-18")
              },
              //Transaction for house Custody account
              new BusinessTransaction()
              {
                  Account = new Guid("25c7b534-c2b6-47a9-a3df-1dcc88b1f49c"),
                  BusinessTransactionType = "Default_Transfer_Settle_Cash",
                  TransactionReference = "Test",
                  Asset1 = new Guid("21b0718c-bce9-4c6b-b1c9-520b65121ff6"),
                  AmountAsset1 = 100M,
                  //Since the transaction type is for only the Settle dimension as suggested by the transaction name 
                  SettlementDate = DateTime.Parse("2016-04-18"),
                  ValueDate = DateTime.Parse("2016-04-18")
              },
            },
        },                    
    }

});

foreach (var c in response.Entities)
{
    Console.WriteLine(c.BrickId + ", " + c.TransactionReference);
}

We have used the Asset ID of SEK and we retrieved the BrickId by using GetCash with the following code as well as the BrickId of the default Custody Account to use:

Code Block
languagec#
themeRDark
titleC# - GetCash
linenumberstrue
//Use the GetCash method to retreive information about the asset class cash
var client = new BFSServiceReference.bfsapiSoapClient();

var credentials = new BFSServiceReference.Credentials()
{
    UserName = bfsusername, //Username of administrative user in your instance of BFS
    Password = bfspassword, //Password of the administrative user in your instance of BFS
};

var cash = client.GetCash(new BFSServiceReference.GetCashRequest()
{
    Credentials = credentials,

    identify = bfsidentifier, //Identifier is a unique token for your instance of BFS 

    Args = new GetCashArgs()
    {
        Keys = new[]
        {
            "SEK"
        }
    },

    Fields = new BFSServiceReference.GetCashFields()
    {
        BrickId = true,
        Name = true,
        Currency = true,
        DefaultCustodyAccount = true,
        DecimalPlaces = true,
        InstrumentStatus = true
    },

});

foreach (var c in cash.Result)
{
    Console.WriteLine(c.BrickId + ";" + c.Name + ";" + c.Currency + ";" + c.DefaultCustodyAccount + ";" + c.DecimalPlaces);
}

In the GUI we can see the following for the customer:

Image Added

And for the Custody Account the following is shown:

Image Added