webdna / commerce-braintree

Braintree gateway for Craft Commerce
Other
2 stars 10 forks source link

Payments not working unless address has been set #7

Closed zackspear closed 5 years ago

zackspear commented 5 years ago

I'm currently not able to get a successful payment submission unless I'm 1) Signed into my CMS account and 2) even when I'm signed in an address is required. Both of which I can't have as we're only having a guest checkout and address isn't required for every customer type as we're selling Digital Products which aren't physically shipped.

I've successfully tested payments with the Braintree gateway disabled and the built-in Dummy gateway enabled. So this makes me believe the issue is coming from this plugin.

When I'm not signed in the error I receive when submitting is:

Unable to make payment at this time.

When an address is not set on the cart the error I receive when submitting is:

Trying to get property 'iso' of non-object

I'm using the Drop-in UI provided by the plugin via getPaymentFormHtml().

Happy to provide any additional info you need from me.

Thanks in advance 🙏

samuelbirch commented 5 years ago

thanks, we'll take a look

samuelbirch commented 5 years ago

v2.1.18 should fix the "Trying to get property 'iso' of non-object" issue.

Unable to make payment at this time = can you confirm that you have the digital products setting: Require a logged in user turned off?

zackspear commented 5 years ago

Thanks @samuelbirch. Just getting going here on the west coast of the states.

Still getting "Trying to get property 'iso' of non-object" with both CC & PayPal purchases after updating to v2.1.18. This happens when I don't set an address. If I do set an address the payments work.

Ahhhh thanks, turning that off now allows us to have guest checkout. Seems like "Require a logged in user turned off?" got turned on at one point. I know I had turned it off. Perhaps it happened when we enabled project config for this project.

zackspear commented 5 years ago

Looping in @eschultz as I will be out for the next few days on a camping trip.

samuelbirch commented 5 years ago

@eschultz can you send the test data you are using, in our testing its working fine.

zackspear commented 5 years ago

@samuelbirch sorry for the delay. Back from my camping trip and have some details for you.

I didn't want to directly share our staging URL publicly so I've created a pastebin that includes the URL & additional details. The link will expire in a week.

Please let me know if you need any additional info.

samuelbirch commented 5 years ago

can you let me know if the order has an address associated with it even its its a blank one?

I've updated the master branch with a fix, can you test against that version please?

zackspear commented 5 years ago

There is no address associated even if it's a blank one. I tried using isStoreLocation but didn't have any luck.

Will test out master and let you know.

zackspear commented 5 years ago

Updated to v2.2.0. Now when submitting the user details without the address requirement on /checkout I get the following ErrorException:

yii\base\ErrorException: Trying to get property 'iso' of non-object in /home/vagrant/code/unraid/craft-unraid/vendor/kuriousagency/commerce-braintree/src/gateways/Gateway.php:826
Stack trace:
#0 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/Extension/CoreExtension.php(1485): kuriousagency\commerce\braintree\gateways\Gateway->format3DSAddress()
#1 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/helpers/Template.php(79): ::twig_get_attribute()
#2 /home/vagrant/code/unraid/craft-unraid/storage/runtime/compiled_templates/3d/3d7820956e4fd3dc53d7f4d5237a1fd9d824033f1e9e5e5f4de2100412b06fc4.php(57): craft\helpers\Template::attribute()
#3 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/Template.php(407): __TwigTemplate_9dea7c6bcd9fcd483b9bc03e0ad7b9fb8caae344134c2ef074e618a0f9c46ccf->doDisplay()
#4 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/web/twig/Template.php(52): __TwigTemplate_9dea7c6bcd9fcd483b9bc03e0ad7b9fb8caae344134c2ef074e618a0f9c46ccf->displayWithErrorHandling()
#5 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/Template.php(380): __TwigTemplate_9dea7c6bcd9fcd483b9bc03e0ad7b9fb8caae344134c2ef074e618a0f9c46ccf->displayWithErrorHandling()
#6 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/web/twig/Template.php(34): __TwigTemplate_9dea7c6bcd9fcd483b9bc03e0ad7b9fb8caae344134c2ef074e618a0f9c46ccf->display()
#7 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/Template.php(392): __TwigTemplate_9dea7c6bcd9fcd483b9bc03e0ad7b9fb8caae344134c2ef074e618a0f9c46ccf->display()
#8 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/TemplateWrapper.php(45): __TwigTemplate_9dea7c6bcd9fcd483b9bc03e0ad7b9fb8caae344134c2ef074e618a0f9c46ccf->render()
#9 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render()
#10 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/web/View.php(344): craft\web\twig\Environment->render()
#11 /home/vagrant/code/unraid/craft-unraid/vendor/kuriousagency/commerce-braintree/src/gateways/Gateway.php(695): craft\web\View->renderTemplate()
#12 /home/vagrant/code/unraid/craft-unraid/vendor/kuriousagency/commerce-braintree/src/gateways/Gateway.php(127): kuriousagency\commerce\braintree\gateways\Gateway->getSitePaymentFormHtml()
#13 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/Extension/CoreExtension.php(1485): kuriousagency\commerce\braintree\gateways\Gateway->getPaymentFormHtml()
#14 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/helpers/Template.php(79): ::twig_get_attribute()
#15 /home/vagrant/code/unraid/craft-unraid/storage/runtime/compiled_templates/73/7318a2da62edc0babe10aefe122899a3307972ff50448e109c5b0b2c7f30e181.php(90): craft\helpers\Template::attribute()
#16 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/Template.php(407): __TwigTemplate_996e12af77eea5d2f2719704c448640334036edf693ca389072a3e62933a2e95->doDisplay()
#17 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/web/twig/Template.php(52): __TwigTemplate_996e12af77eea5d2f2719704c448640334036edf693ca389072a3e62933a2e95->displayWithErrorHandling()
#18 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/Template.php(380): __TwigTemplate_996e12af77eea5d2f2719704c448640334036edf693ca389072a3e62933a2e95->displayWithErrorHandling()
#19 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/web/twig/Template.php(34): __TwigTemplate_996e12af77eea5d2f2719704c448640334036edf693ca389072a3e62933a2e95->display()
#20 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/Template.php(392): __TwigTemplate_996e12af77eea5d2f2719704c448640334036edf693ca389072a3e62933a2e95->display()
#21 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/TemplateWrapper.php(45): __TwigTemplate_996e12af77eea5d2f2719704c448640334036edf693ca389072a3e62933a2e95->render()
#22 /home/vagrant/code/unraid/craft-unraid/vendor/twig/twig/src/Environment.php(318): Twig\TemplateWrapper->render()
#23 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/web/View.php(344): craft\web\twig\Environment->render()
#24 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/web/View.php(394): craft\web\View->renderTemplate()
#25 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/web/Controller.php(243): craft\web\View->renderPageTemplate()
#26 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/controllers/TemplatesController.php(95): craft\controllers\TemplatesController->renderTemplate()
#27 /home/vagrant/code/unraid/craft-unraid/vendor/yiisoft/yii2/base/InlineAction.php(57): craft\controllers\TemplatesController->actionRender()
#28 /home/vagrant/code/unraid/craft-unraid/vendor/yiisoft/yii2/base/InlineAction.php(57): ::call_user_func_array:{/home/vagrant/code/unraid/craft-unraid/vendor/yiisoft/yii2/base/InlineAction.php:57}()
#29 /home/vagrant/code/unraid/craft-unraid/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams()
#30 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/web/Controller.php(187): craft\controllers\TemplatesController->runAction()
#31 /home/vagrant/code/unraid/craft-unraid/vendor/yiisoft/yii2/base/Module.php(528): craft\controllers\TemplatesController->runAction()
#32 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/web/Application.php(299): craft\web\Application->runAction()
#33 /home/vagrant/code/unraid/craft-unraid/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction()
#34 /home/vagrant/code/unraid/craft-unraid/vendor/craftcms/cms/src/web/Application.php(284): craft\web\Application->handleRequest()
#35 /home/vagrant/code/unraid/craft-unraid/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest()
#36 /home/vagrant/code/unraid/craft-unraid/web/index.php(21): craft\web\Application->run()
#37 {main}

When trying our form that requires address it works as expected.

samuelbirch commented 5 years ago

if you can update to the master branch:

composer require kuriousagency/commerce-braintree:dev-master

that will get the very latest unreleased version.

zackspear commented 5 years ago

Gotcha, thanks. Giving that a go right now.

zackspear commented 5 years ago

I can successfully purchase without setting an address now. With address works as well.

Thanks for diligently working on this to get it solved.

In the Braintree dashboard do you know if there's a way to submit the user details (name & email, etc.) as a part of the "Customer Info" for the transaction? Currently blank for both address and address-less transactions. This way we can cross reference orders within Craft Commerce to Braintree if need be. More than happy to create a separate issue for this as its an "enhancement".

samuelbirch commented 5 years ago

@zackspear if you can create a new issue for the customer info that would be great.

samuelbirch commented 5 years ago

fix in v2.2.1