コード例 #1
0
        /// <summary>
        /// delete profile
        /// </summary>
        /// <param name="profile">Profile</param>
        /// <returns>bool</returns>
        public bool delete(Profile profile)
        {
            profile.setRequiredFields(new List <string> {
                CustomerVaultConstants.id
            });
            profile.checkRequiredFields();

            Request request = new Request(
                method: RequestType.DELETE,
                uri: this.prepareURI("/profiles/" + profile.id())
                );

            this.client.processRequest(request);

            return(true);
        }
コード例 #2
0
        /// <summary>
        /// get profile with subcomponents
        /// </summary>
        /// <param name="profile">Profile</param>
        /// <returns>Profile</returns>
        public Profile get(Profile profile, bool includeAddresses = false, bool includeCards           = false, bool includeACHBankAccounts  = false,
                           bool includeBACSBankAccounts           = false, bool includeEFTBankAccounts = false, bool includeSEPABankAccounts = false)
        {
            profile.setRequiredFields(new List <string> {
                CustomerVaultConstants.id
            });
            profile.checkRequiredFields();

            Dictionary <string, string> queryStr = new Dictionary <string, string>();
            StringBuilder toInclude = new StringBuilder();

            if (includeAddresses)
            {
                toInclude.Append("addresses");
            }
            if (includeCards)
            {
                if (toInclude.Length > 0)
                {
                    toInclude.Append(",");
                }
                toInclude.Append("cards");
            }
            if (includeACHBankAccounts)
            {
                if (toInclude.Length > 0)
                {
                    toInclude.Append(",");
                }
                toInclude.Append("achbankaccounts");
            }
            if (includeBACSBankAccounts)
            {
                if (toInclude.Length > 0)
                {
                    toInclude.Append(",");
                }
                toInclude.Append("bacsbankaccounts");
            }
            if (includeEFTBankAccounts)
            {
                if (toInclude.Length > 0)
                {
                    toInclude.Append(",");
                }
                toInclude.Append("eftbankaccounts");
            }
            if (includeSEPABankAccounts)
            {
                if (toInclude.Length > 0)
                {
                    toInclude.Append(",");
                }
                toInclude.Append("sepabankaccounts");
            }

            queryStr.Add("fields", toInclude.ToString());
            Request request = new Request(
                method: RequestType.GET,
                uri: this.prepareURI("/profiles/" + profile.id()),
                queryString: queryStr
                );

            dynamic response = this.client.processRequest(request);

            return(new Profile(response));
        }