0

I have been trying for a long time on how to include this library into my custom module. I have tried this answer but no use. May be I have put it wrong.

{
  "name": "Vendor/module-name",
  "description": "N/A",
  "require": {
    "php": "~5.5.0|~5.6.0|~7.0.0",
    "authorizenet/authorizenet": "1.8.9",
    "jms/serializer": "serializer-master-dev as 1.0"
  },
  "repositories": [{
    "type": "vcs",
    "url": "https://github.com/goetas/serializer.git"
  }],
  "type": "magento2-module",
  "version": "100.0.1",
  "license": [
    "OSL-3.0",
    "proprietary"
  ],
  "autoload": {
    "files": [
      "registration.php"
    ],
    "psr-4": {
      "Vendor\\Name\\": ""
    }
  }
}

in registration.php I added these code at the end of file

$vendorDir = require BP . '/app/etc/vendor_path.php';
$vendorAutoload = BP . "/{$vendorDir}/autoload.php";
/** @var \Composer\Autoload\ClassLoader $composerAutoloader */
$composerAutoloader = include $vendorAutoload;
$composerAutoloader->addPsr4('authorizenet\\', array(__DIR__ . '/authorizenet/authorizenet'));

Please help me fix this. Thank you.

0

I was able to get the Sample Code running. I used Integrator Install for Magento2 and added Authorize.net require the project composer.json.

"require": {
    "composer/composer": "@alpha",
    "magento/product-community-edition": "2.1.5",
    "authorizenet/authorizenet": "^1.9"
},

After running 'composer update' I was able to add createSubscription to a custom module model, call via a Magento CLI command, and return SUCCESS: Subscription ID. Next moving the sample code to DI but think I've clear this question's hurdle.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.