Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Peter 27 posts 192 karma points
    Apr 10, 2017 @ 12:37
    Peter
    0

    Understanding Merchellos sale history

    Hello,

    I am having some difficulties understanding how/when entries are added to the sale history.

    I have implemented a custom payment provider, and have a partial capture example where the checkout process authorizes an amount of 370 but only captures 200. Afterwards I capture the remaining amount using the "New Payment" button in the backend. When the total amount is captured (it seems) the 'Sale history' section becomes visible, but only displays the following entries:

    We successfully captured 170
    We were authorized to capture 370

    There is no entry for the initial partial capture of 200. The invoice rows "Total", "Collected" and "Balance due" are working perfectly though.

    My PerformAuthorizeCapturePayment looks roughly like this:

    protected override IPaymentResult PerformAuthorizeCapturePayment(IInvoice invoice, decimal amount, ProcessorArgumentCollection args)
        {
            var payment = GatewayProviderService.CreatePayment(PaymentMethodType.CreditCard, amount, PaymentMethod.Key);
            payment.Collected = false;
            payment.Authorized = true;
    
            GatewayProviderService.Save(payment);
    
            var captureResult = Helpers.Helpers.Payment.PerformCapturePayment(currencyInfo, amount, "", merchantNumber, paymentId , ""));
            payment.Collected = captureResult.Success;
    
            GatewayProviderService.Save(payment);
    
            var result = payment.Collected
                ? new PaymentResult(Attempt<IPayment>.Succeed(payment), invoice, true)
                : new PaymentResult(Attempt<IPayment>.Fail(new Exception(errorMessage)), invoice, false);
    
            if (!result.Payment.Success)
            {
                GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Denied, result.Payment.Exception.Message, 0);
            }
            else
            {
                GatewayProviderService.ApplyPaymentToInvoice(payment.Key, invoice.Key, AppliedPaymentType.Debit, "Payment authorized and captured", amount);
            }
    
            return result;
        }
    

    Can someone tell me what I am missing?

    BR Peter

  • Peter 27 posts 192 karma points
    Apr 11, 2017 @ 06:25
    Peter
    0

    Update: The payments tab correctly displays the initial capture of 200

    Payments tab

    ...but the sale tab is still not correct Sale tab

Please Sign in or register to post replies

Write your reply to:

Draft