magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.5k stars 9.31k forks source link

Try to obtain the values of VatId, StreetLine 3 and 4 in your Gateway/Request/* #27485

Closed elisei closed 4 years ago

elisei commented 4 years ago

Preconditions (*)

  1. Magento Open Source 2.3.4 (perhaps earlier versions as well).
  2. The payment method tries to obtain address information, but there are no methods in the AddressAdapter (under quotation or order).

Steps to reproduce (*)

  1. Try to obtain the values of VatId, StreetLine 3 and 4 in your Gateway/Request/*...
        $billingAddress = $order->getBillingAddress();

        $taxDocument = $billingAddress->getVatId();

        $address3 = $billingAddress->getStreetLine3();

        $address4 = $billingAddress->getStreetLine4();

Using the payment gateway of the sample module you can enter the above code at: https://github.com/magento/magento2-samples/blob/master/sample-module-payment-gateway/Gateway/Request/AuthorizationRequest.php#L46

Expected result (*)

  1. Return values for VatId, StreetLine3, getStreetLine4

Actual result (*)

  1. Fatal Error: 'Uncaught Error: Call to undefined method Magento\Payment\Gateway\Data\Order\AddressAdapter::getVatId()
  2. Fatal Error: 'Uncaught Error: Call to undefined method Magento\Payment\Gateway\Data\Order\AddressAdapter::getStreetLine3()
  3. Fatal Error: 'Uncaught Error: Call to undefined method Magento\Payment\Gateway\Data\Order\AddressAdapter::getStreetLine4()
m2-assistant[bot] commented 4 years ago

Hi @elisei. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

@elisei do you confirm that you were able to reproduce the issue on vanilla Magento instance following steps to reproduce?


Stepa4man commented 4 years ago

@elisei I don't see any issue here. I close until you provide a clear explanation of why is it an issue.

elisei commented 4 years ago

Hello, I try to get three native information from the platform in my payment method, but they have no return in your API.

You can reproduce this error by injecting the code that I passed in your sample module to a payment gateway:

https://github.com/magento/magento2-samples/blob/master/sample-module-payment-gateway/Gateway/Request/AuthorizationRequest.php#L46

acampos1916 commented 4 years ago

Hey @elisei did you find a way to get the additional lines from the shipping/billing addresses? I'm also facing this issue trying to get those values from a Magento\Payment\Gateway\Data\Order\AddressAdapter object in a payment gateway.

acampos1916 commented 4 years ago

@elisei nevermind, I see you already fixed it in a PR, cheers!

elisei commented 4 years ago

Hi @acampos1916 ,

The operator in question ( @Stepa4man ) does not consider it pertinent to increase the Magento API and rejected my request. Apparently, the "payment / gateway" works only if you want to create an integration with paypal.

The solution only comes if implemented on your gateway/data/request/AddressAdapter

acampos1916 commented 4 years ago

@elisei,

Yes, makes sense that APIs are not updated in minor releases so service contracts with external implementations are upheld. I will have to create a preference for that interface.

Thanks.