예제 #1
0
        public PaymentResultDisplay AuthorizeCapturePayment(PaymentRequest request)
        {
            var processor = new PaymentProcessor(MerchelloContext, request);

            var authorizeCapture = processor.AuthorizeCapture();

            var result = new PaymentResultDisplay()
            {
                Success = authorizeCapture.Payment.Success,
                Invoice = authorizeCapture.Invoice.ToInvoiceDisplay(),
                Payment = authorizeCapture.Payment.Result.ToPaymentDisplay(),
                ApproveOrderCreation = authorizeCapture.ApproveOrderCreation
            };

            if (!authorizeCapture.Payment.Success)
            {
                authorizeCapture.Payment.Result.AuditPaymentDeclined();
            }
            else
            {
                authorizeCapture.Payment.Result.AuditPaymentAuthorize(authorizeCapture.Invoice);
                authorizeCapture.Payment.Result.AuditPaymentCaptured(request.Amount);
            }

            return(result);
        }
예제 #2
0
        public PaymentDisplay AuthorizeCapturePayment(PaymentRequest request)
        {
            var processor = new PaymentProcessor(MerchelloContext, request);

            var authorizeCapture = processor.AuthorizeCapture();

            if (!authorizeCapture.Payment.Success)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            return(authorizeCapture.Payment.Result.ToPaymentDisplay());
        }
예제 #3
0
        public PaymentResultDisplay AuthorizeCapturePayment(PaymentRequestDisplay request)
        {
            var processor = new PaymentProcessor(MerchelloContext, request);

            var authorizeCapture = processor.AuthorizeCapture();

            var result = new PaymentResultDisplay()
            {
                Success = authorizeCapture.Payment.Success,
                Invoice = authorizeCapture.Invoice.ToInvoiceDisplay(),
                Payment = authorizeCapture.Payment.Result.ToPaymentDisplay(),
                ApproveOrderCreation = authorizeCapture.ApproveOrderCreation
            };

            if (!authorizeCapture.Payment.Success)
            {
                authorizeCapture.Payment.Result.AuditPaymentDeclined();
            }
            else
            {
                authorizeCapture.Payment.Result.AuditPaymentAuthorize(authorizeCapture.Invoice);
                authorizeCapture.Payment.Result.AuditPaymentCaptured(request.Amount);
            }

            return result;
        }