예제 #1
0
        public async void Example()
        {
#pragma warning disable 0168
            using (Client client = GetClient())
            {
                NetworksParams query = new NetworksParams();
                query.CountryCode  = "NL";
                query.CurrencyCode = "EUR";
                query.Amount       = 1000L;
                query.IsRecurring  = true;

                PaymentProductNetworksResponse response = await client.Merchant("merchantId").Products().Networks(320, query);
            }
#pragma warning restore 0168
        }
예제 #2
0
        /// <summary>
        /// Resource /{merchantId}/products/{paymentProductId}/networks
        /// <a href="https://developer.globalcollect.com/documentation/api/server/#__merchantId__products__paymentProductId__networks_get">Get payment product networks</a>
        /// </summary>
        /// <param name="paymentProductId">int?</param>
        /// <param name="query">NetworksParams</param>
        /// <param name="context">CallContext</param>
        /// <returns>PaymentProductNetworksResponse</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 <PaymentProductNetworksResponse> Networks(int?paymentProductId, NetworksParams query, CallContext context = null)
        {
            IDictionary <string, string> pathContext = new Dictionary <string, string>();

            pathContext.Add("paymentProductId", paymentProductId.ToString());
            string uri = InstantiateUri("/{apiVersion}/{merchantId}/products/{paymentProductId}/networks", pathContext);

            try
            {
                return(await _communicator.Get <PaymentProductNetworksResponse>(
                           uri,
                           ClientHeaders,
                           query,
                           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);
            }
        }