예제 #1
0
        /// <inheritdoc/>
        public async Task <GetPaymentProductGroupsResponse> GetProductGroups(GetProductGroupsParams query, CallContext context = null)
        {
            string uri = InstantiateUri("/v2/{merchantId}/productgroups", null);

            try
            {
                return(await _communicator.Get <GetPaymentProductGroupsResponse>(
                           uri,
                           ClientHeaders,
                           query,
                           context)
                       .ConfigureAwait(false));
            }
            catch (ResponseException e)
            {
                object errorObject = _communicator.Unmarshal <ErrorResponse>(e.Body);
                throw CreateException(e.StatusCode, e.Body, errorObject, context);
            }
        }
예제 #2
0
        public void TestToRequestParameters()
        {
            var lParams   = new GetProductGroupsParams();
            var paramList = new List <RequestParam>();

            Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList));

            lParams.Amount = 1000L;
            paramList.Add(new RequestParam("amount", "1000"));
            Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList));

            lParams.CountryCode = "NL";
            paramList.Add(new RequestParam("countryCode", "NL"));
            Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList));

            lParams.CurrencyCode = "EUR";
            paramList.Add(new RequestParam("currencyCode", "EUR"));
            Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList));

            lParams.IsRecurring = true;
            paramList.Add(new RequestParam("isRecurring", "true"));
            Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList));

            lParams.Locale = "nl_NL";
            paramList.Add(new RequestParam("locale", "nl_NL"));
            Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList));

            lParams.AddHide("fields");
            paramList.Add(new RequestParam("hide", "fields"));
            Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList));

            lParams.AddHide("accountsOnFile");
            paramList.Add(new RequestParam("hide", "accountsOnFile"));
            Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList));

            lParams.Amount = null;
            paramList.RemoveAt(0);
            Assert.That(lParams.ToRequestParameters(), Is.EquivalentTo(paramList));
        }