示例#1
0
        /// <summary>
        /// Create Mandates
        /// </summary>
        /// <param name="Mandates">Mandates</param>
        /// <returns>Mandates</returns>
        public Mandates Create(Mandates account, string accountName)
        {
            account.SetRequiredFields(new List <string> {
                GlobalConstants.Reference,
                GlobalConstants.ProfileId,
                GlobalConstants.BankAccountId
            });

            account.CheckRequiredFields();

            if (accountName.Equals("SEPA"))
            {
                accountName = "/sepabankaccounts/";
            }
            else
            {
                accountName = "/bacsbankaccounts/";
            }

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

            Mandates returnVal = new Mandates(response);

            returnVal.ProfileId(account.ProfileId());
            return(returnVal);
        }
        /// <summary>
        /// Create Mandates
        /// </summary>
        /// <param name="Mandates">Mandates</param>
        /// <returns>Mandates</returns>
        public Mandates create(Mandates account, string accountName)
        {
            account.setRequiredFields(new List <string> {
                CustomerVaultConstants.reference,
                CustomerVaultConstants.profileId,
                CustomerVaultConstants.bankAccountId
            });

            account.checkRequiredFields();

            if (accountName.Equals("SEPA"))
            {
                accountName = "/sepabankaccounts/";
            }
            else
            {
                accountName = "/bacsbankaccounts/";
            }

            Request request = new Request(
                method: RequestType.POST,
                uri: this.prepareURI("/profiles/" + account.profileId() + accountName + account.bankAccountId() + "/mandates"),
                body: account
                );
            dynamic response = this.client.processRequest(request);

            Mandates returnVal = new Mandates(response);

            returnVal.profileId(account.profileId());
            return(returnVal);
        }
示例#3
0
        /// <summary>
        ///Delete Mandates
        /// </summary>
        /// <param name="Mandates">Mandates</param>
        /// <returns>bool</returns>
        public bool Delete(Mandates account)
        {
            account.SetRequiredFields(new List <string> {
                GlobalConstants.ProfileId,
                GlobalConstants.Id,
                GlobalConstants.BankAccountId
            });
            Request request = new Request(
                method: RequestType.Delete,
                uri: PrepareUri("/profiles/" + account.ProfileId() + "/mandates/" + account.Id())
                );

            _client.ProcessRequest(request);
            return(true);
        }
        /// <summary>
        ///Delete Mandates
        /// </summary>
        /// <param name="Mandates">Mandates</param>
        /// <returns>bool</returns>
        public bool delete(Mandates account)
        {
            account.setRequiredFields(new List <string> {
                CustomerVaultConstants.profileId,
                CustomerVaultConstants.id,
                CustomerVaultConstants.bankAccountId
            });
            Request request = new Request(
                method: RequestType.DELETE,
                uri: this.prepareURI("/profiles/" + account.profileId() + "/mandates/" + account.id())
                );

            this.client.processRequest(request);
            return(true);
        }
示例#5
0
        /// <summary>
        /// update Mandates
        /// </summary>
        /// <param name="Mandates">Mandates</param>
        /// <returns>Mandates</returns>
        public Mandates Update(Mandates account)
        {
            account.SetRequiredFields(new List <string> {
                GlobalConstants.Status
            });
            account.CheckRequiredFields();
            Request request = new Request(
                method: RequestType.Put,
                uri: PrepareUri("/profiles/" + account.ProfileId() + "/mandates/" + account.Id()),
                body: account
                );
            dynamic response = _client.ProcessRequest(request);

            Mandates returnVal = new Mandates(response);

            returnVal.ProfileId(account.ProfileId());
            return(returnVal);
        }
        /// <summary>
        /// update Mandates
        /// </summary>
        /// <param name="Mandates">Mandates</param>
        /// <returns>Mandates</returns>
        public Mandates update(Mandates account)
        {
            account.setRequiredFields(new List <string> {
                CustomerVaultConstants.status
            });
            account.checkRequiredFields();
            Request request = new Request(
                method: RequestType.PUT,
                uri: this.prepareURI("/profiles/" + account.profileId() + "/mandates/" + account.id()),
                body: account
                );
            dynamic response = this.client.processRequest(request);

            Mandates returnVal = new Mandates(response);

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