Closed (fixed)
Project:
Commerce Square Connect
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Sep 2017 at 14:05 UTC
Updated:
5 Jan 2018 at 15:14 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
focal55 commentedHere is pass at adding notes to the transaction.
Comment #3
czigor commented'note' is not really good for this purpose. We can create an order in square (https://docs.connect.squareup.com/api/connect/v2#endpoint-createorder) that would hold the order items info. Then we can link this order to the transaction using the transaction's order_id parameter (https://docs.connect.squareup.com/api/connect/v2#endpoint-charge).
Comment #4
czigor commentedThe patch creates a square order based on the DC order line items and links it to the square transaction.
The square order total is required to match the payment amount. This is not the case if we have order promotions or other adjustments.
Case #1 The square order total is more than the payment amount.
SInce square does not allow negative amounts for line items, we decrease square line item prices until we make up for the difference.
Case #2 The square order total is less than the payment amount.
We create a fake square line item with name 'Adjustments' to make up for the difference.
Comment #5
czigor commentedWould be nice if someone could test this with live transactions too: sandbox transactions do not appear on the dashboard, I could only check square orders via the api.
Comment #6
czigor commentedInstead of juggling with square line item base prices we should probably use square line item discounts
$line_item->setDiscounts($discounts)Comment #7
czigor commentedUsing square discounts now. Code is shorter and easier to read this way.
Comment #8
czigor commentedComment #9
czigor commentedReroll for latest dev.
Comment #10
focal55 commentedThank you czigor!
Comment #11
mglamanfocal55 have you given this a test in production? I'm going to do a basic test. But we need some end-user confidence before we commit and put in a release.
Comment #12
mglamanI reached out to Square to see if we can find additional ways to test beyond: 1) Push to API and see no errors. 2) Use API to pull order down and verify.
Comment #13
focal55 commented@mglaman I should have some time with this today and will report back asap.
Comment #14
focal55 commentedI wasn't able to make czigor's patch at #9 work with latest dev version. Here is a new patch applied against commerce_square 8.x-1.x.
I can confirm with commerce 8.x-2.x and commerce_square 8.x-1.x this work as expected. When you view the transaction on Square website the transaction is clickable and shows the product and quantity purchased. See screenshot:
https://cl.ly/3C2q1s1I3A2e
Comment #15
mglamanfocal55, thanks! I'll commit this and then mark it for 7.x backport.
Comment #17
mglamanCommitted to 8.x.
Comment #18
mglamanI don't like the "Patch (to be ported)" status. Let's close this as fixed and just have a new issue, #2931511: Backport "Add purchase details to transaction notes" to 7.x
Comment #19
focal55 commentedWoot! Thanks mglaman and czigor