Troubleshooting Invoicing Problems

Delivery fails to invoice

If a delivery fails to invoice, it's probably an issue with the discounts calculating incorrectly on the order. The easiest way to resolve that is to recalculate the discounts:

o = Order.find(1234)
o.force_total_reset = true
o.save

One you've done that, you can now try to invoice the delivery again:

d = Delivery.find(5678)
d.trigger_invoiced

If this still fails then the error message it returns should give you a clue of what needs to be fixed.

If the problem is a specific line discount not applying correctly and you need to remove that line discount, do something like this:

o.discounts.to_a[2].line_discounts.to_a[1].destroy
o.reload
o.force_total_reset = true
o.save

If the issue is the tax rate doesn't match in the delivery and the oder, then do this;
order.refresh_tax_rate
delivery.trigger_invoiced

Invoice created but receipt not created

For orders with credit card payment, if the invoice was created but you get an email saying 'Receipt Creation Failed' or 'CC CAPTURE ERROR' then you need to check on Braintree if the authorization was captured and manually create a receipt.

First, open the invoice in Heatwave. If the invoice is already marked as Paid then there is nothing to do, if it's marked as unpaid then you need to check the receipts.

Click the Recipts tab, if there are receipts in there then ask Accounting to investigate as they may have applied receipts already. If there are no receipts then you need to check the authorizations.

Click the Authorizations tab and you will see the authorization which failed there, it could be in any state but will probably be in the declined state. Copy the transaction ID to the clipboard, you'll need it for the next step.

We will next check on Braintree if the capture happened. Go to Braintree and login with your personalized Braintree login.

  1. On the left menu, click Reports (underneath Trans Reports)
  2. Paste the tranaction ID you had stored in the clipboard into the Transaction ID field
  3. Check the dates are covering the date the capture would have happened (or just make it cover the whole year)
  4. Click submit
  5. You should see the transaction come up, click the link in the ID column to open it up

If the transaction status is Complete or you see in the Transaction History that there is a successful authorization and capture (settle may or may not have happened yet) then you have confirmed that the capture was successful and you need to manually create a receipt in Heatwave. If the capture did not happen or it failed then contact Accounting who will need to investigate further why it failed or manually do the capture.

You may also see the status of 'Unsuccessful card capture', this usually means that over 7 days passed between the authorization and attempted capture and the authorization has expired. An expired authorization can usually be re-authorized as long as less than 30 days have passed since the initial authorization, but this varies depending on the card issuer. You should contact accounting if this is the case for the authorization you're investigating and they will take care of the re-authorization and receipt creation.

Assuming the capture happened correctly then we need to create the receipt now, so leave the transaction open on Braintree (we will copy some details over in a minute) but go back to Heatwave for the next step.

Now we'll create a new receipt and link it to the invoice.

  1. From the invoice, click the Receipts tab
  2. Click New Receipt, the new receipt form will come up with most of the details filled in
  3. Change the category to Credit Card (don't check capture payment now)
  4. Copy the credit card number from Braintree (e.g 414718******5273) and paste it into the Reference field
  5. Select the correct card type (cc type on Braintree)
  6. Copy the Auth. Code from Braintree and paste it into the Authorization Code field
  7. Check the amount captured on Braintree (look at the Card Capture entry on the Transaction History) matches the full invoice balance which has been entered by default on the receipt. Adjust the receipt amount to what was actually captured if they differ. You will also need to adjust the amount on the Receipt Details table below so it matches.
  8. Update the G/L Date to the date the capture on Braintree happened (look at the Card Capture entry on the Transaction History) - this will usually be the same day the order shipped
  9. In the Remark, enter something like 'Manually creating as HW receipt creation failed'
  10. Click Create

The receipt should now have been created and the invoice should be in the Paid state (unless receipt was not for the full balance of the order).

You should also click Regenerate PDF to ensure the new receipt is on any invoice which gets sent to the customer.