Esempio n. 1
0
        /// <summary>
        /// Request a connect session with scopes [account_details, transactions_details] with access from a given start date.
        /// </summary>
        /// <param name="client">API client.</param>
        /// <param name="customerId">Customer ID.</param>
        /// <param name="returnUri">Redirect callback URI.</param>
        /// <param name="accessStart">Start date of requested access.</param>
        /// <returns>CreateConnectSessionResponse.</returns>
        public static async Task <CreateConnectSessionResponse> CreateConnectSession(this ISaltEdgeClient client, string customerId, Uri returnUri, DateTime accessStart)
        {
            return(await Wrap(async() =>
            {
                var result = await client.CreateConnectSessionCall(new ParamWrapper <CreateConnectSessionRequest>
                {
                    data = new CreateConnectSessionRequest
                    {
                        attempt = new Attempt
                        {
                            return_to = returnUri,
                        },
                        consent = new Consent
                        {
                            from_date = accessStart,
                            scopes = new[]
                            {
                                "account_details",
                                "transactions_details",
                            },
                        },
                        customer_id = customerId,
                    },
                }).ConfigureAwait(false);

                return result.data;
            }).ConfigureAwait(false));
        }
Esempio n. 2
0
 /// <summary>
 /// Get all accounts available through a given connection.
 /// </summary>
 /// <param name="client">API client.</param>
 /// <param name="connectionId">Connection ID.</param>
 /// <returns>An enumerable of all the accounts.</returns>
 public static async Task <IEnumerable <GetAccountsResponse> > GetAccounts(this ISaltEdgeClient client, string connectionId)
 {
     return(await Wrap(async() =>
     {
         var result = await client.GetAccountsCall(connectionId).ConfigureAwait(false);
         return result.data;
     }).ConfigureAwait(false));
 }
Esempio n. 3
0
        /// <summary>
        /// Get a list of all customers.
        /// </summary>
        /// <param name="client">API client.</param>
        /// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
        public static async Task <IEnumerable <GetCustomersResponse> > GetCustomers(this ISaltEdgeClient client)
        {
            return(await Wrap(async() =>
            {
                var result = await client.GetCustomersCall().ConfigureAwait(false);

                return result.data;
            }).ConfigureAwait(false));
        }
Esempio n. 4
0
        /// <summary>
        /// Create a customer just by specifying the desired identifier.
        /// </summary>
        /// <param name="client">API client.</param>
        /// <param name="desiredIdentifier">Identifier.</param>
        /// <returns>A <see cref="Task{TResult}"/> representing the result of the asynchronous operation.</returns>
        public static async Task <CreateCustomerResponse> CreateCustomer(this ISaltEdgeClient client, string desiredIdentifier)
        {
            return(await Wrap(async() =>
            {
                var result = await client.CreateCustomerCall(new ParamWrapper <CreateCustomerRequest>
                {
                    data = new CreateCustomerRequest
                    {
                        identifier = desiredIdentifier,
                    },
                }).ConfigureAwait(false);

                return result.data;
            }).ConfigureAwait(false));
        }