public void Retrieving_A_Collection_Of_Payments_For_An_Invoice_After_Capture_Returns_Unique_Payments()
        {
            //// Arrange
            var authorized = _invoice.AuthorizePayment(_merchelloContext, _paymentMethodKey, new ProcessorArgumentCollection());
            var caputered  = _invoice.CapturePayment(_merchelloContext, authorized.Payment.Result, _paymentMethodKey, _invoice.Total, new ProcessorArgumentCollection());

            //// Act
            var payments = _invoice.Payments(_merchelloContext);

            //// Assert
            Assert.NotNull(payments);
            Assert.AreEqual(1, payments.Count());
        }
Example #2
0
        /// <summary>
        /// Captures a payment for the <see cref="IInvoice"/>
        /// </summary>
        /// <param name="invoice">The invoice to be payed</param>
        /// <param name="merchelloContext">The <see cref="IMerchelloContext"/></param>
        /// <param name="payment">The</param>
        /// <param name="paymentMethodKey">The <see cref="IPaymentMethod"/> key</param>
        /// <param name="amount">The amount to the payment to be captured</param>
        /// <param name="args">Additional arguements required by the payment processor</param>
        /// <returns>A <see cref="IPaymentResult"/></returns>
        internal static IPaymentResult CapturePayment(this IInvoice invoice, IMerchelloContext merchelloContext,
                                                      IPayment payment, Guid paymentMethodKey, decimal amount, ProcessorArgumentCollection args)
        {
            var paymentGatewayMethod = merchelloContext.Gateways.Payment.GetPaymentGatewayMethodByKey(paymentMethodKey);

            return(invoice.CapturePayment(payment, paymentGatewayMethod, amount, args));
        }
Example #3
0
 /// <summary>
 /// Captures a payment for the <see cref="IInvoice"/>
 /// </summary>
 /// <param name="invoice">The invoice to be payed</param>
 /// <param name="payment">The</param>
 /// <param name="paymentMethodKey">The <see cref="IPaymentMethod"/> key</param>
 /// <param name="amount">The amount to the payment to be captured</param>
 /// <param name="args">Additional arguements required by the payment processor</param>
 /// <returns>A <see cref="IPaymentResult"/></returns>
 public static IPaymentResult CapturePayment(this IInvoice invoice, IPayment payment, Guid paymentMethodKey,
                                             decimal amount, ProcessorArgumentCollection args)
 {
     return(invoice.CapturePayment(MerchelloContext.Current, payment, paymentMethodKey, amount, args));
 }
Example #4
0
 /// <summary>
 /// Captures a payment for the <see cref="IInvoice"/>
 /// </summary>
 /// <param name="invoice">The invoice to be payed</param>
 /// <param name="payment">The</param>
 /// <param name="amount">The amount to the payment to be captured</param>
 /// <param name="paymentGatewayMethod"></param>
 /// <returns>A <see cref="IPaymentResult"/></returns>
 public static IPaymentResult CapturePayment(this IInvoice invoice, IPayment payment,
                                             IPaymentGatewayMethod paymentGatewayMethod, decimal amount)
 {
     return(invoice.CapturePayment(payment, paymentGatewayMethod, amount, new ProcessorArgumentCollection()));
 }