Beispiel #1
0
        /// <summary>
        /// Create BACSBankAccount
        /// </summary>
        /// <param name="BACSBankAccount">BACSBankAccount</param>
        /// <returns>BACSBankAccount</returns>
        public BacsBankAccounts Create(BacsBankAccounts account)
        {
            account.SetRequiredFields(new List <string> {
                GlobalConstants.ProfileId
            });
            account.CheckRequiredFields();
            account.SetRequiredFields(new List <string> {
                GlobalConstants.AccountNumber,
                GlobalConstants.SortCode,
                GlobalConstants.AccountHolderName,
                GlobalConstants.BillingAddressId,
            });
            account.CheckRequiredFields();
            account.SetOptionalFields(new List <string> {
                GlobalConstants.Mandates,
                GlobalConstants.NickName,
                GlobalConstants.MerchantRefNum,
            });

            Request request = new Request(
                method: RequestType.Post,
                uri: PrepareUri("/profiles/" + account.ProfileId() + "/bacsbankaccounts"),
                body: account
                );
            dynamic response = _client.ProcessRequest(request);

            BacsBankAccounts returnVal = new BacsBankAccounts(response);

            returnVal.ProfileId(account.ProfileId());
            return(returnVal);
        }
Beispiel #2
0
        /// <summary>
        ///Delete BACSBankAccount
        /// </summary>
        /// <param name="BACSBankAccount">BACSBankAccount</param>
        /// <returns>bool</returns>
        public bool Delete(BacsBankAccounts account)
        {
            account.SetRequiredFields(new List <string> {
                GlobalConstants.ProfileId,
                GlobalConstants.Id
            });
            account.CheckRequiredFields();

            Request request = new Request(
                method: RequestType.Delete,
                uri: PrepareUri("/profiles/" + account.ProfileId() + "/bacsbankaccounts/" + account.Id())
                );

            _client.ProcessRequest(request);
            return(true);
        }
Beispiel #3
0
        /// <summary>
        /// Get BACSBankAccount
        /// </summary>
        /// <param name="BACSBankAccount">BACSBankAccount</param>
        /// <returns>BACSBankAccount</returns>
        public BacsBankAccounts Get(BacsBankAccounts account)
        {
            account.SetRequiredFields(new List <string> {
                GlobalConstants.ProfileId,
                GlobalConstants.Id
            });
            account.CheckRequiredFields();
            Request request = new Request(
                method: RequestType.Get,
                uri: PrepareUri("/profiles/" + account.ProfileId() + "/bacsbankaccounts/" + account.Id())
                );

            dynamic response = _client.ProcessRequest(request);

            BacsBankAccounts returnVal = new BacsBankAccounts(response);

            returnVal.ProfileId(account.ProfileId());
            return(returnVal);
        }