Undefined array key "organization" in Drupal\commerce_unzer\Utility\UnzerAddressConverter::convertAddressToUnzerData()

Created on 25 June 2024, 3 months ago
Updated 16 July 2024, 2 months ago

Problem/Motivation

Currently, when the Address field has the "organization" property marked "Hidden", it results in a Warning when the donation process is completed using this module:

Warning: Undefined array key "organization" in Drupal\commerce_unzer\Utility\UnzerAddressConverter::convertAddressToUnzerData()

Steps to reproduce

  1. Create an address field in the customer profile.
  2. Mark the Organization property as Hidden.
  3. Make a donation using Unzer as your payment method. (Previously you will have to have configured that payment method)

Proposed resolution

Use the null coalescing operator just as the module does with the rest of the properties. See patch attached. I have also removed the casting because the null coalescing operator already creates an empty string if the element does not exist.

๐Ÿ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

๐Ÿ‡ช๐Ÿ‡ธSpain dimaro

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

Merge Requests

Comments & Activities

  • Issue created by @dimaro
  • Issue was unassigned.
  • Status changed to Needs review 3 months ago
  • ๐Ÿ‡ช๐Ÿ‡ธSpain dimaro
  • ๐Ÿ‡ช๐Ÿ‡ธSpain dimaro
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia abhishek_virasat

    abhishek_gupta1 โ†’ made their first commit to this issueโ€™s fork.

  • Merge request !4fix the issue โ†’ (Merged) created by abhishek_virasat
  • Status changed to RTBC 3 months ago
  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia abhishek_virasat

    @dimaro, I have tested your Patch locally following mentioned step to reproduce. Issue has Fixed now, its working well for me. Also I created MR easy to merge. moving RTBC++

  • Status changed to Fixed 3 months ago
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany cspitzlay ๐Ÿ‡ฉ๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Looks good. Thanks to both of you.

    @dimaro

    • In your opinion, does this warrant a new alpha release or is it enough that it is fixed in the dev version?
    • Just out of interest: You mentioned that you have donations. Is there anything different from a regular order that has products with respect to the Unzer payment?
  • ๐Ÿ‡ช๐Ÿ‡ธSpain dimaro

    Hey @cspitzlay,

    In your opinion, does this warrant a new alpha release or is it enough that it is fixed in the dev version?

    I would say not yet, I'm upgrading to address 2.x and I would like to create a new issue to include some of the new properties that address 2.x incorporates. Perhaps when that is resolved a new alpha release could be created.

    Just out of interest: You mentioned that you have donations. Is there anything different from a regular order that has products with respect to the Unzer payment?

    If I understand your question correctly, I would say that there is nothing different in terms of the amount donated. However, I do have a local patch in which it includes the Card holder property, something the module does not currently do.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany cspitzlay ๐Ÿ‡ฉ๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Ah, you are using the on-site gateway, don't you?

    I was wondering what a donation checkout looked like on the offsite paypage.
    For example, if you needed to add a custom donation item to the cart so it all adds up in the cart display on that external page.

  • ๐Ÿ‡ช๐Ÿ‡ธSpain dimaro

    Heey @cspitzlay,

    Yes, right now I'm using Unzer OnSite, but I'm planning to use the Hosted Payment Page provided by Unzer. I don't think I can answer your question because I haven't checked how Unzer OffSite works yet, so right now I have no idea how an item is displayed there, but I'm still happy to contribute with this task and any other that improves the code base. This module and how the integration with Unzer is written is something that I continue to discover thanks to the fact that we used it on one of the projects.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024