// AuthorizeCapturePayment will save the invoice with an Invoice Number.
        private IPaymentResult ProcessPayment(SalePreparationBase preparation, IPaymentMethod paymentMethod, string paymentMethodNonce)
        {
            // You need a ProcessorArgumentCollection for this transaction to store the payment method nonce
            // The braintree package includes an extension method off of the ProcessorArgumentCollection - SetPaymentMethodNonce([nonce]);
            var args = new ProcessorArgumentCollection();
            args.SetPaymentMethodNonce(paymentMethodNonce);

            // We will want this to be an AuthorizeCapture(paymentMethod.Key, args);
            return preparation.AuthorizeCapturePayment(paymentMethod.Key, args);
        }
Esempio n. 2
0
        /// <summary>
        /// The process payment.
        /// </summary>
        /// <param name="checkoutManager">
        /// Merchello's <see cref="ICheckoutManagerBase"/>.
        /// </param>
        /// <param name="paymentMethod">
        /// The payment method.
        /// </param>
        /// <param name="paymentMethodNonce">
        /// The payment method nonce.
        /// </param>
        /// <returns>
        /// The <see cref="IPaymentResult"/>.
        /// </returns>
        /// <remarks>
        /// AuthorizeCapturePayment will save the invoice with an Invoice Number.
        /// </remarks>
        protected virtual IPaymentResult ProcessPayment(ICheckoutManagerBase checkoutManager, IPaymentMethod paymentMethod, string paymentMethodNonce)
        {
            // You need a ProcessorArgumentCollection for this transaction to store the payment method nonce
            // The braintree package includes an extension method off of the ProcessorArgumentCollection - SetPaymentMethodNonce([nonce]);
            var args = new ProcessorArgumentCollection();

            args.SetPaymentMethodNonce(paymentMethodNonce);

            // We will want this to be an AuthorizeCapture(paymentMethod.Key, args);
            return(checkoutManager.Payment.AuthorizeCapturePayment(paymentMethod.Key, args));
        }
Esempio n. 3
0
        // AuthorizeCapturePayment will save the invoice with an Invoice Number.
        private IPaymentResult ProcessPayment(SalePreparationBase preparation, IPaymentMethod paymentMethod, string paymentMethodNonce)
        {
            // You need a ProcessorArgumentCollection for this transaction to store the payment method nonce
            // The braintree package includes an extension method off of the ProcessorArgumentCollection - SetPaymentMethodNonce([nonce]);
            var args = new ProcessorArgumentCollection();

            args.SetPaymentMethodNonce(paymentMethodNonce);

            // We will want this to be an AuthorizeCapture(paymentMethod.Key, args);
            return(preparation.AuthorizeCapturePayment(paymentMethod.Key, args));
        }
        /// <summary>
        /// Performs the work of processing the payment with Braintree.
        /// </summary>
        /// <param name="nonce">
        /// The 'nonce' generated by Braintree that we use to bill against.
        /// </param>
        /// <param name="invoice">
        /// The invoice.
        /// </param>
        /// <returns>
        /// The <see cref="IPaymentResult"/>.
        /// </returns>
        protected virtual IPaymentResult ProcessPayment(string nonce, IInvoice invoice = null)
        {
            // gets the payment method
            var paymentMethod = CheckoutManager.Payment.GetPaymentMethod();

            // You need a ProcessorArgumentCollection for this transaction to store the payment method nonce
            // The braintree package includes an extension method off of the ProcessorArgumentCollection - SetPaymentMethodNonce([nonce]);
            var args = new ProcessorArgumentCollection();

            args.SetPaymentMethodNonce(nonce);

            // We want this to be an AuthorizeCapture(paymentMethod.Key, args);
            return(invoice == null
                       ? CheckoutManager.Payment.AuthorizeCapturePayment(paymentMethod.Key, args)
                       : invoice.AuthorizeCapturePayment(paymentMethod.Key, args));
        }