SDPPaymentNotificationResponse ProcessSDPPaymentNotification(ServerRequestBase serverRequest, ClientRequestResponseBase crrRequest) { SDPPaymentNotificationResponse response = null; SDPPaymentNotificationRequest req = serverRequest as SDPPaymentNotificationRequest; try { _paymentRequestRepository.Save(crrRequest); response = new SDPPaymentNotificationResponse { statusCode = "Success", statusDetail = "Success" }; } catch(Exception ex) { //error _auditLogRepository.AddLog(Guid.Empty, crrRequest.ClientRequestResponseType.ToString(), "To/From HSenid", "Error: " + ex.Message+"\n"+ex.InnerException.Message); response = new SDPPaymentNotificationResponse { statusCode = "Failed", statusDetail = "Failed" }; } return response; }
SDPPaymentNotificationResponse GenerateSampleSDPAsynchronousPaymentNotificationResponse(SDPPaymentNotificationRequest request) { SDPPaymentNotificationResponse sample = new SDPPaymentNotificationResponse(); sample.statusCode = "Success"; sample.statusDetail = "Success"; return sample; }
public async Task<SDPPaymentNotificationResponse> ReceiveAsynchPaymentNotificationTest(SDPPaymentNotificationRequest request) { SDPPaymentNotificationResponse _response = new SDPPaymentNotificationResponse(); HttpClient httpClient = setupHttpClient(); httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); string url = "api/bridge/payment/postpaymentnotification"; try { var response = await httpClient.PostAsJsonAsync(url, request); _response = await response.Content.ReadAsAsync<SDPPaymentNotificationResponse>(); } catch (Exception ex) { string error = "Failed to retrieve payment notification.\n" + (ex.InnerException == null ? "" : ex.InnerException.Message); _log.Error(error); _response.statusCode = "Error"; _response.statusDetail = error; } return _response; }