Exemple #1
0
        static void AccountValidationExample(Configuration configuration)
        {
            // See https://docs.transferzero.com/docs/additional-features/#bank-account-name-enquiry
            // for more information on how this feature can be used
            AccountValidationRequest accountValidationRequest = new AccountValidationRequest(
                bankAccount: "90400999999999",
                bankCode: "190100",
                country: AccountValidationRequest.CountryEnum.GH,
                currency: AccountValidationRequest.CurrencyEnum.GHS,
                method: AccountValidationRequest.MethodEnum.Bank
                );

            AccountValidationApi accountValidationApi = new AccountValidationApi(configuration);

            try
            {
                var result = accountValidationApi.PostAccountValidations(accountValidationRequest);
                System.Console.WriteLine(result);
            }
            catch (ApiException e)
            {
                if (e.IsValidationError)
                {
                    var result = e.ParseObject <AccountValidationResponse>();
                    System.Console.WriteLine(result);
                }
                else
                {
                    throw e;
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Validates the existence of a bank account or a mobile phone number Validates the existence of a bank account or mobile phone number and returns the associated customer name
        /// </summary>
        /// <exception cref="TransferZero.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountValidationRequest"></param>
        /// <returns>Task of AccountValidationResponse</returns>
        public async System.Threading.Tasks.Task <AccountValidationResponse> PostAccountValidationsAsync(AccountValidationRequest accountValidationRequest)
        {
            ApiResponse <AccountValidationResponse> localVarResponse = await PostAccountValidationsAsyncWithHttpInfo(accountValidationRequest);

            return(localVarResponse.Data);
        }
Exemple #3
0
        /// <summary>
        /// Validates the existence of a bank account or a mobile phone number Validates the existence of a bank account or mobile phone number and returns the associated customer name
        /// </summary>
        /// <exception cref="TransferZero.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountValidationRequest"></param>
        /// <returns>Task of ApiResponse (AccountValidationResponse)</returns>
        public async System.Threading.Tasks.Task <ApiResponse <AccountValidationResponse> > PostAccountValidationsAsyncWithHttpInfo(AccountValidationRequest accountValidationRequest)
        {
            // verify the required parameter 'accountValidationRequest' is set
            if (accountValidationRequest == null)
            {
                throw new ApiException(400, "Missing required parameter 'accountValidationRequest' when calling AccountValidationApi->PostAccountValidations");
            }

            var    localVarPath         = "/account_validations";
            var    localVarPathParams   = new Dictionary <String, String>();
            var    localVarQueryParams  = new List <KeyValuePair <String, String> >();
            var    localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader);
            var    localVarFormParams   = new Dictionary <String, String>();
            var    localVarFileParams   = new Dictionary <String, FileParameter>();
            Object localVarPostBody     = null;

            // to determine the Content-Type header
            String[] localVarHttpContentTypes = new String[] {
                "application/json"
            };
            String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes);

            // to determine the Accept header
            String[] localVarHttpHeaderAccepts = new String[] {
                "application/json"
            };
            String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts);

            if (localVarHttpHeaderAccept != null)
            {
                localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept);
            }

            if (accountValidationRequest != null && accountValidationRequest.GetType() != typeof(byte[]))
            {
                localVarPostBody = this.Configuration.ApiClient.Serialize(accountValidationRequest); // http body (model) parameter
            }
            else
            {
                localVarPostBody = accountValidationRequest; // byte array
            }

            var request = new RestRequest(localVarPath, Method.POST);

            // add path parameter, if any
            foreach (var param in localVarPathParams)
            {
                request.AddParameter(param.Key, param.Value, ParameterType.UrlSegment);
            }

            foreach (var param in localVarQueryParams)
            {
                request.AddQueryParameter(param.Key, param.Value);
            }

            // generate full URL
            string fullUri = this.Configuration.ApiClient.RestClient.BuildUri(request).AbsoluteUri;

            string nonce         = System.Guid.NewGuid().ToString();
            string authSignature = this.Configuration.GetSignature(nonce, fullUri, "POST", localVarPostBody == null ? "" : localVarPostBody.ToString());

            localVarHeaderParams.Add("Authorization-Key", this.Configuration.ApiKey);
            localVarHeaderParams.Add("Authorization-Nonce", nonce);
            localVarHeaderParams.Add("Authorization-Signature", authSignature);

            // make the HTTP request
            IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath,
                                                                                                            Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams,
                                                                                                            localVarPathParams, localVarHttpContentType);

            int localVarStatusCode = (int)localVarResponse.StatusCode;

            if (ExceptionFactory != null)
            {
                Exception exception = ExceptionFactory("PostAccountValidations", localVarResponse);
                if (exception != null)
                {
                    throw exception;
                }
            }

            return(new ApiResponse <AccountValidationResponse>(localVarStatusCode,
                                                               localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)),
                                                               (AccountValidationResponse)this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(AccountValidationResponse))));
        }
Exemple #4
0
        /// <summary>
        /// Validates the existence of a bank account or a mobile phone number Validates the existence of a bank account or mobile phone number and returns the associated customer name
        /// </summary>
        /// <exception cref="TransferZero.Sdk.Client.ApiException">Thrown when fails to make API call</exception>
        /// <param name="accountValidationRequest"></param>
        /// <returns>AccountValidationResponse</returns>
        public AccountValidationResponse PostAccountValidations(AccountValidationRequest accountValidationRequest)
        {
            ApiResponse <AccountValidationResponse> localVarResponse = PostAccountValidationsWithHttpInfo(accountValidationRequest);

            return(localVarResponse.Data);
        }