Пример #1
0
        protected async override Task <object> OnPerform()
        {
            var contract = JsonConvert.SerializeObject(_paymentByAccountContract);
            var content  = new StringContent(contract, Encoding.UTF8, ApplicationJSON);
            var response = await _restClient.PaymentByAccount(content);

            var data = await response.Content.ReadAsStringAsync();

            switch (response.StatusCode)
            {
            case HttpStatusCode.OK:
                var paymentComplete = new DeSerializer().MapTenderSummary(data);
                return(new Mapper().MapTenderSummary(paymentComplete));

            case HttpStatusCode.NotFound:
                throw PurchaseOrderRequiredException(data);

            default:
                return(await HandleExceptions(response));
            }
        }