Esempio n. 1
0
        /// <summary>
        /// Resource /{merchantId}/services/getIINdetails
        /// <a href="https://developer.globalcollect.com/documentation/api/server/#__merchantId__services_getIINdetails_post">Get IIN details</a>
        /// </summary>
        /// <param name="body">GetIINDetailsRequest</param>
        /// <param name="context">CallContext</param>
        /// <returns>GetIINDetailsResponse</returns>
        /// <exception cref="ValidationException">if the request was not correct and couldn't be processed (HTTP status code BadRequest)</exception>
        /// <exception cref="AuthorizationException">if the request was not allowed (HTTP status code Forbidden)</exception>
        /// <exception cref="IdempotenceException">if an idempotent request caused a conflict (HTTP status code Conflict)</exception>
        /// <exception cref="ReferenceException">if an object was attempted to be referenced that doesn't exist or has been removed,
        ///            or there was a conflict (HTTP status code NotFound, Conflict or Gone)</exception>
        /// <exception cref="GlobalCollectException">if something went wrong at the GlobalCollect platform,
        ///            the GlobalCollect platform was unable to process a message from a downstream partner/acquirer,
        ///            or the service that you're trying to reach is temporary unavailable (HTTP status code InternalServerError, BadGateway or ServiceUnavailable)</exception>
        /// <exception cref="ApiException">if the GlobalCollect platform returned any other error</exception>
        public async Task <GetIINDetailsResponse> GetIINdetails(GetIINDetailsRequest body, CallContext context = null)
        {
            string uri = InstantiateUri("/{apiVersion}/{merchantId}/services/getIINdetails", null);

            try
            {
                return(await _communicator.Post <GetIINDetailsResponse>(
                           uri,
                           ClientHeaders,
                           null,
                           body,
                           context));
            }
            catch (ResponseException e)
            {
                object errorObject;
                switch (e.StatusCode)
                {
                case HttpStatusCode.NotFound:
                    errorObject = _communicator.Marshaller.Unmarshal <ErrorResponse>(e.Body);
                    break;

                default:
                    errorObject = _communicator.Marshaller.Unmarshal <ErrorResponse>(e.Body);
                    break;
                }
                throw CreateException(e.StatusCode, e.Body, errorObject, context);
            }
        }
        public async void Example()
        {
#pragma warning disable 0168
            using (Client client = GetClient())
            {
                GetIINDetailsRequest body = new GetIINDetailsRequest();
                body.Bin = "4567350000427977";

                GetIINDetailsResponse response = await client.Merchant("merchantId").Services().GetIINdetails(body);
            }
#pragma warning restore 0168
        }
Esempio n. 3
0
        /// <inheritdoc/>
        public async Task <GetIINDetailsResponse> GetIINDetails(GetIINDetailsRequest body, CallContext context = null)
        {
            string uri = InstantiateUri("/v2/{merchantId}/services/getIINdetails", null);

            try
            {
                return(await _communicator.Post <GetIINDetailsResponse>(
                           uri,
                           ClientHeaders,
                           null,
                           body,
                           context)
                       .ConfigureAwait(false));
            }
            catch (ResponseException e)
            {
                object errorObject = _communicator.Unmarshal <ErrorResponse>(e.Body);
                throw CreateException(e.StatusCode, e.Body, errorObject, context);
            }
        }