Adjustments under one label only in Square dashboard

Created on 15 August 2021, almost 3 years ago
Updated 22 March 2023, over 1 year ago

Problem/Motivation

Various adjustments (tax, shipping for example) are being totalled under one heading titled "Adjustments" in Square.

Example of an order in Drupal Commerce (notice the tax and shipping costs):

Exampe of a transaction in Square (notice that tax and shipping costs fall under one general label titled "Adjustments"):

Steps to reproduce

Go through a typical checkout scenario using the Square payment gateway. Ensure that taxes are being applied to products and properly configured. Ensure that there is a shipping method available for users to select during checkout and a cost for shipping. Submit and pay for the order using the Commerce Square Connect payment gateway (which should be configured using a sandbox account).

Verify the transaction in the Square dashboard. Both adjustments will be combined as one.

Proposed resolution

Adjustments should be labelled as they are seen in Drupal. For example, taxes and shipping are clearly separate line items when viewing an order's details in Drupal, but when viewing the transaction in Square the two are combined under the label "Adjustments". This is specifically an issue when organizations need to calculate the amount of taxes that have been paid since the all amounts are combined.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

1.5

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada joelseguin Ontario, Canada

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Needs work over 1 year ago
  • πŸ‡ΊπŸ‡ΈUnited States sah62 US

    Would something like this work to mark an order item each time is payment is processed?

    foreach ($payment->getOrder()->getItems() as $item) {
      $square_item_processed = $item->getData('square_item_processed', FALSE);
      if ($square_item_processed) continue;
      // Process the order item.
      ...
      $item->setData('square_item_processed', TRUE);
    }
    

    I've tried to test this idea. Nothing "bad" seems to happen when I process a first payment for a single item. If I edit the order and add an item, though, when I try to process the second payment the value of $square_item_processed is FALSE for both items in the order and the payment process fails because the amount of the order (2 items, plus tax, plus shipping) doesn't match the payment (1 new item plus tax). I'm clearly still missing something.

Production build 0.69.0 2024