Git Product home page Git Product logo

amazon-pay-oxid's Introduction

Amazon Pay & Login for OXID eShop

Build Status

Pay with Amazon is fast, easy and secure and can help you add new customers, increase sales, and reduce fraud costs. It provides a seamless experience for your customers. All buyer interactions take place in widgets, so they never leave your site. Customers simply log in using their Amazon credentials, select a shipping address and payment method, and confirm their order

The Login and Pay with Amazon for Oxideshop extension adds two components to your OxideShop installation:

  • A ‘Login with Amazon’ module that allows customers to seamlessly register and log in using their Amazon account credentials.
  • A payments module ‘Pay with Amazon’ that allows customers to complete the checkout using the payment methods stored in their Amazon account.

Enable Login and Pay with Amazon on your OXID eShop, you will benefit from:

  • Online identity

Your customers save time and hassle by using their Amazon credentials to login and pay; so you increase repeat buyers by offering a trusted and convenient payment method.

  • A smooth payment process

Your customers won’t leave your website to login or enter their payment/shipping information; so you capture sales from buyers who are reluctant to enter their information.

You will need to create an Amazon Payments Seller Account to use the Pay with Amazon for OXID eShop extension. This account is where you will receive payments, update your account settings and view settlement reports.

Development Setup

In order to run a oxid 6 instance locally to develop or test features, you have to run the following steps:

Starting the docker stack

$ docker-compose up -d

The first time will build the images and this could take some time!

Build the instance

$ docker-compose exec web /bin/bash -c "chmod +x ./scripts/build.sh && ./scripts/build.sh <version> dev"

This command will build an local oxid with the given version (use for example 5.3, for version lower than 6.0 or dev-b-6.0-ce, for version from 6.0 on) instance with installed demodata and the symlinked module. You are now ready to develop or tests your changes. The shop will be accessible via the url http://localhost:8100 and the admin will be reachable via http://localhost:8100 or with https under https://localhost:4444 and the credentials admin:admin.

Running the tests

Just run the following command:

$ docker-compose exec web /bin/bash -c "chmod +x ./scripts/build.sh && ./scripts/build.sh <version>"

This will create a fresh instance and runs the tests. May also want to login to your previous build test instance and run the test there just access the docker container by running the following command.

$ docker-compose exec web bash

Now you are logged in and are able to run the test from the instance vendor dir vendor/bin/runtests.

amazon-pay-oxid's People

Contributors

4takte avatar avareldev avatar b3nl avatar baumann-bestit avatar bgutmann avatar gm-alex avatar migo315 avatar mknoop avatar pirxdanford avatar ralfnitzer avatar robertblank avatar terhuerne avatar vilmal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

amazon-pay-oxid's Issues

3.2.0 phpunit errors

Hi,

with https://github.com/OXID-eSales/oxideshop_ce/tree/b-6.1.x we are getting the errors as attached below.

=========
running php version 7.1.19

============
Adding unit tests from /srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests//unit/ext/*Test.php
Adding unit tests from /srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests//unit/application/controllers/*Test.php
Adding unit tests from /srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests//unit/application/models/*Test.php
Adding unit tests from /srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests//unit/application/controllers/admin/*Test.php
PHPUnit 4.8.26 by Sebastian Bergmann and contributors.

.....................E......E.......................E.......... 63 / 145 ( 43%)
..E...................EE.....................E.....EE.E........ 126 / 145 ( 86%)
.EE........E.....EE

Time: 7.35 seconds, Memory: 34.00MB

There were 15 errors:

  1. bestitAmazonPay4OxidOxDeliverySetListTest::testGetDeliverySetData
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/ext/bestitAmazonPay4OxidOxDeliverySetListTest.php:129
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidOxOrderTest::testPreFinalizeOrder
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/ext/bestitAmazonPay4OxidOxOrderTest.php:440
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidPaymentTest::testSetPrimaryAmazonUserData
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/ext/bestitAmazonPay4OxidPaymentTest.php:339
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidAddressUtilTest::testParseAmazonAddress
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/models/bestitAmazonPay4OxidAdressUtilTest.php:76
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidClientTest::testRefund
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/models/bestitAmazonPay4OxidClientTest.php:1422
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidClientTest::testGetRefundDetails
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/models/bestitAmazonPay4OxidClientTest.php:1538
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidIpnHandlerTest::testProcessIPNAction
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/models/bestitAmazonPay4OxidIpnHandlerTest.php:164
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidLoginClientTest::testAmazonUserIdExists
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/models/bestitAmazonPay4OxidLoginClientTest.php:267
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidLoginClientTest::testOxidUserExists
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/models/bestitAmazonPay4OxidLoginClientTest.php:315
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidLoginClientTest::testDeleteUser
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/models/bestitAmazonPay4OxidLoginClientTest.php:433
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidTest::testIsActive
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/models/bestitAmazonPay4OxidTest.php:208
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidTest::testCleanAmazonPay
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/models/bestitAmazonPay4OxidTest.php:327
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidInitTest::testOnDeactivate
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/controllers/admin/bestitAmazonPay4OxidInitTest.php:422
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidMainTest::testGetRefunds
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/controllers/admin/bestitAmazonPay4OxidMainTest.php:436
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

  1. bestitAmazonPay4OxidMainTest::testGetRefundsStatus
    Error: Class 'MatchIgnoreWhitespace' not found

/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/source/modules/bestit/amazonpay4oxid/tests/unit/application/controllers/admin/bestitAmazonPay4OxidMainTest.php:472
/srv/pool/public_html/compilation_tests_unit_EDITION_ce_label_unit/5840/vendor/oxid-esales/testing-library/library/UnitTestCase.php:149

FAILURES!
Tests: 145, Assertions: 413, Errors: 15.

[Question]: sAmazonPaymentChangeLink empty?

In modules/bestit/amazonpay4oxid/ext/bestitamazonpay4oxid_oxorder.php::getAmazonChangePaymentLink() Line 397. Here the module try to get the sAmazonPaymentChangeLink Property. But this gives us nothing back. For example the property _sAmazonPaymentChangeLinkDESandbox does not exist.

User returns to wrong shop language after login via Amazon

Shop Configuration:

  • Multiple frontend languages:
    • English with language ID 0
    • German with language ID 1 (default language)

Scenario:

  • You are using the Safari browser
  • You are on the german shop frontend (basket page) and click the amazon pay button
  • You successfully log in with your Amazon credentials
  • After the shop page gets reloaded you are on the english shop frontend (checkout user page)

Solution:
Add the following language parameter to all return urls: &lang=[{$oViewConf->getActLanguageId()}]

Example bestitamazonpay4oxid_paybutton.tpl (line 85):

var newLocation = '[{$oViewConf->getSslSelfLink()|html_entity_decode}]'
    + 'cl=user&fnc=amazonLogin&redirectCl=user&lang=[{$oViewConf->getActLanguageId()}]'
    + '&amazonOrderReferenceId=' + amazonOrderReferenceId
    + '&access_token=' + addressConsentToken;

add parent constructor

please call parent constructor before using it, eg. bestitAmazonPay4Oxid_oxEmail::__construct()

/** * bestitAmazonPay4Oxid_oxEmail constructor. */ public function __construct() { parent::__construct(); $this->_oLogger = $this->_getContainer()->getLogger(); }

only in bestitAmazonPay4Oxid_oxViewConfig::__construct() it´s used.

had some problems with rendering html mails in order modules ...

Beginning slash causes wrong redirection on subfolder-Shopurls

When a shop is located in a subfolder (mydomain.tld/myShop/), the Script calls & redirect to mydomain.tld/index.php.

Todo:
Remove the beginning slashes on these 2 lines:

window.location = '/index.php?cl=user&fnc=cleanAmazonPay';

Editor:
Kristian Hempel

`bestitAmazonCron::amazonCall()` returns unsupposed value and leads to an exception being thrown

bestitAmazonCron::amazonCall() is called by oxView::executeFunction() (which is called \OxidEsales\Eshop\Core\Controller\BaseController since version 6.0) which expects a new controller string as return value.
Passing true or false leads to a dispatch exception because there is no class named true/false.

You can trigger that exception when you click on one of the expert links in the oxid eshop backend (select an order which was payed with amazon pay and go to the amazon pay tab).
image

The unit test could look at the assigned view variables instead of checking the return value and and integration test would have covered that exception case.

Due to missing contribution guidelines (e.g. CLA required?) I did not provide a pull request but I think it is trivial to fix for you.

Side note: This issue is also present in module (v2.5.1) for OXID eShop 4.10.

modalLoading.init() redirecting to the start page

I have recognized the following error in V 3.6.4 / Oxid 6.2.1:

In some browsers the buy button forces a redirect to the start page instead of showing the thankyou page. I placed all return Urls in the seller central but this did not help. Safari did not work at all, other browsers worked randomly.

I think the reason is that I am using a custom theme that is still based on azure. I could not reproduce the error in flow and wave.

I finally fixed it by removing line 12 in bestitamazonpay4oxid_order_confirm_button.tpl.

window.location.href = "#openModalLoading";

I hope some kind of fix for my issue in the next version.

Regards,
Bernhard

Amazon user creation deletes OXID user

Hi,

we recently found a big issue in the module in combination with OXID EE.
On amazon user creation / update the OXID user gets deleted/overwritten and gets a new oxid, wich cause a lot of internal problems.

I think the problem is in:
modules/bestit/amazonpay4oxid/ext/bestitamazonpay4oxid_oxcmp_user.php -> amazonLogin().

It seems that every oxid user that dosnt have an password gets deleted, wich would be all oxid guest users. It deletes only the actual oxuser entry not the data in all related tables, wich makes sense, to keep existing orders..., but cause troubles in other parts.

The specific problem we have, is that the OXID EE Version removes the unique key on the oxnewssubscribed table, in combination with the deletion/new creaton of the oxid user on amazon login, we have the same email multiple times in the oxnewssubscribed with different oxuserids and and newsletter subscriptions, wich can cause legal problems and could affect
business if newsletters cant be sended.

In our case we were lucky because we use an external service and only have one shop, so we readded the unique key to oxnewssubscribed, deleted the duplicate mails and imported them
correctly from the external service.

At the moment we cant fully see all effects of the user deletion/new creation and hope it dosnt cause more trouble, it would be good if you could look into that issue and maybe rework the login/user creation process.

OXID 6.1.6
Module: 3.6.8

Greetings
Oliver

"window.location.href" causing redirect to frontpage

I installed the new plugin 3.6.8 in Oxid 4.10.4 with a azure based child theme.

When clicking on confirmation button, the shops redirects to "mydomain.com/#openModalLoading", without saving the order. Browser: firefox

The problem is located in "bestitamazonpay4oxid_order_confirm_button.tpl" in line 12. So i fixed it.

Before:
window.location.href = "#openModalLoading";

After:
window.location.href = window.location.href+"#openModalLoading";

Order should be checked if it was payed with bestitamazon before capturing and should not capture more than once

When the module is configured to capture automatically when orders are shipped it needs to be checked if the order's payment type is "bestitamazon".
image

Otherwise the internal state of every order not payed with "bestitamazon" will change to "AMZ-Error-InvalidParameterValu" because the capture fails.

A quick fix which worked for me was:

--- a/code/modules/bestit/amazonpay4oxid/application/models/bestitamazonpay4oxidclient.php
+++ b/code/modules/bestit/amazonpay4oxid/application/models/bestitamazonpay4oxidclient.php
@@ -694,6 +694,14 @@ class bestitAmazonPay4OxidClient extends bestitAmazonPay4OxidContainer
      */
     public function capture($oOrder = null, $aRequestParameters = array())
     {
+        if ($oOrder !== null && $aRequestParameters === []) {
+            $paymentType = $oOrder->getFieldData('oxpaymenttype');
+            if ($paymentType !== 'bestitamazon') {
+                return;
+            }
+        }
+
         $oData = $this->_callOrderRequest(
             'capture',
             $oOrder,

Side note: This issue is also present in module (v2.5.1) for OXID eShop 4.10.

Exception thrown when deactivating the module

When deactivating the module (v2.5.1) in OXID eShop 4.10 an exception (oxSystemComponentException) is thrown in bestitAmazonPay4Oxid_oxViewConfig::getSelfLink() when calling $this->_getContainer().

I don't know if this issue is still relevant in OXID eShop 6.0.

A quick fix that worked for me was:

--- a/modules/bestit/amazonpay4oxid/ext/bestitamazonpay4oxid_oxviewconfig.php
+++ b/modules/bestit/amazonpay4oxid/ext/bestitamazonpay4oxid_oxviewconfig.php
@@ -127,6 +127,14 @@ class bestitAmazonPay4Oxid_oxViewConfig extends bestitAmazonPay4Oxid_oxViewConfi
      */
     public function getSelfLink()
     {
+        // quick fix (when module was deactivated before within the same request)
+        try {
+            $this->_getContainer();
+        }
+        catch (oxSystemComponentException $ex) {
+            return parent::getSelfLink();
+        }
+
         if ((bool)$this->_getContainer()->getConfig()->getConfigParam('sSSLShopURL') === true
             && !$this->isAdmin()
             && $this->getAmazonLoginIsActive()

Excerpt from EXCEPTION_LOG.txt:

oxSystemComponentException-oxException (time: 2018-02-07 21:50:04): [0]: EXCEPTION_SYSTEMCOMPONENT_CLASSNOTFOUND 
 Stack Trace: #0 <SHOP_BASE_DIR>\core\oxutilsobject.php(188): oxUtilsObject->_getObject('oxsystemcompone...', 0, Array)
#1 [internal function]: oxUtilsObject->oxNew('oxSystemCompone...')
#2 <SHOP_BASE_DIR>\core\oxfunctions.php(368): call_user_func_array(Array, Array)
#3 <SHOP_BASE_DIR>\core\oxutilsobject.php(178): oxNew('oxSystemCompone...')
#4 [internal function]: oxUtilsObject->oxNew('bestitAmazonPay...')
#5 <SHOP_BASE_DIR>\core\oxfunctions.php(368): call_user_func_array(Array, Array)
#6 <SHOP_BASE_DIR>\modules\bestit\amazonpay4oxid\ext\bestitamazonpay4oxid_oxviewconfig.php(42): oxNew('bestitAmazonPay...')
#7 <SHOP_BASE_DIR>\modules\bestit\amazonpay4oxid\ext\bestitamazonpay4oxid_oxviewconfig.php(132): bestitAmazonPay4Oxid_oxViewConfig->_getContainer()
#8 <SHOP_BASE_DIR>\tmp\smarty\2338d2425adbff76c2c2807c150f6147^%%16^161^161A2516%%module_main.tpl.php(102): bestitAmazonPay4Oxid_oxViewConfig->getSelfLink()
#9 <SHOP_BASE_DIR>\core\smarty\Smarty.class.php(1264): include('...')
#10 <SHOP_BASE_DIR>\core\oxshopcontrol.php(519): Smarty->fetch('module_main.tpl', 'tbclmodule_main')
#11 <SHOP_BASE_DIR>\core\oxshopcontrol.php(364): oxShopControl->_render(Object(Module_Main))
#12 <SHOP_BASE_DIR>\core\oxshopcontrol.php(126): oxShopControl->_process('module_main', 'deactivateModul...', NULL, NULL)
#13 <SHOP_BASE_DIR>\core\oxid.php(40): oxShopControl->start()
#14 <SHOP_BASE_DIR>\index.php(26): Oxid::run()
#15 <SHOP_BASE_DIR>\admin\index.php(27): require_once('...')
#16 {main}

 Faulty component --> bestitamazonpay4oxidcontainer
---------------------------------------------

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.