private async Task <ResponseMOD> SendPaymentToBraspagAsync(HttpClient httpClient, PaymentMOD payment) { try { HttpResponseMessage httpResponseMessage = await httpClient.PostAsJsonAsync(UtilityMOD.API_BRASPAG_URL, SetJsonForBraspag(payment)); ResponseMOD response = await ValidateResponseFromBraspagAsync(httpResponseMessage); return(response); } catch (Exception exception) { return(SetCurrentException(exception)); } }
public async Task <ActionResult> Pay(PaymentViewModel paymentModel) { if (paymentModel != null) { if (ModelState.IsValid) { ResponseMOD response = await this._paymentBLL.PayWithBraspagAsync(ConfigurationFromPayment(paymentModel)); if (response.Status.Code == HttpStatusCode.OK) { return(PartialView("_Success", "Thank you! Your payment has been successfully made.")); } } } return(RedirectToAction("Home", paymentModel)); }