public Task <PaymentResponseContext> ProcessSaleAsync(PaymentRequestContext paymentRequest) { if (paymentRequest == null) { throw new ArgumentNullException("paymentRequest"); } //validate the PaymentRequestContext instance comming in ICollection <ValidationResult> ctxValResults = validatePaymentRequestContext(paymentRequest); if (ctxValResults.Any()) { var invalidPaymentResponseCtx = new PaymentResponseContext { ResponseCode = PaymentResponseCode.InvalidPaymentRequestContext, ValidationResults = ctxValResults }; return(TaskHelpers.FromResult(invalidPaymentResponseCtx)); } //PaymentRequestContext instance is valid. Continue. var paymentServiceDescriptor = createPaymentServiceDescriptor(paymentRequest); var requestXML = seserializePaymentRequest(paymentServiceDescriptor); return(processPaymentRequest(requestXML)); }
public Task<PaymentResponseContext> ProcessSaleAsync(PaymentRequestContext paymentRequest) { if (paymentRequest == null) throw new ArgumentNullException("paymentRequest"); //validate the PaymentRequestContext instance comming in ICollection<ValidationResult> ctxValResults = validatePaymentRequestContext(paymentRequest); if (ctxValResults.Any()) { var invalidPaymentResponseCtx = new PaymentResponseContext { ResponseCode = PaymentResponseCode.InvalidPaymentRequestContext, ValidationResults = ctxValResults }; return TaskHelpers.FromResult(invalidPaymentResponseCtx); } //PaymentRequestContext instance is valid. Continue. var paymentServiceDescriptor = createPaymentServiceDescriptor(paymentRequest); var requestXML = seserializePaymentRequest(paymentServiceDescriptor); return processPaymentRequest(requestXML); }