0

I used composer to load Ominpay-nmi with all of its required. I get no composer errors but when I run

use Omnipay\Omnipay;
$gatewayObj = Omnipay::create("NMI");

I get the message Fatal error: Uncaught exception 'Omnipay\Common\Exception\RuntimeException' with message 'Class '\Omnipay\NMI\Gateway' not found' in /home/ken/NetBeansProjects/tournament/vendor/omnipay/common/src/Omnipay/Common/GatewayFactory.php on line 105

I tried creating an empty class as suggested in

code as follows:

<?php

namespace Omnipay\myNMIGateway;

class Gateway {
//put your code here
}

Composer code

{
    "name":"x/x",
    "description":"autoload for tournament software",
    "license":"",

    "require": {
        "php": ">=5.3.0",
        "ext-curl": "*",
        "ext-json": "*",
        "paypal/rest-api-sdk-php" : "dev-master",
        "mfauveau/omnipay-nmi": "~2.0",
        "twilio/sdk": "dev-master",
        "mailgun/mailgun-php": "dev-master",
        "components/jqueryui":">=1.11.4",
        "bacon/bacon-qr-code": "dev-master"
    },         

    "autoload":{
        "files":["tournamentConfig.php"],
        "psr-4":{"mts\\classes\\":"classes", 
                 "mts\\classes\\tables\\":"classes/tables/src",
                 "mts\\":"classes\\factories",
                 "mts\\":"classes\\data",
                 "mts\\":"classes\\view",
                 "mts\\":"classes\\keys",
                 "mts\\view\\":"view",
                 "mts\\model\\":"model"
        }
    }
}

Any examples specific for NMI AND Paypal, (that will be my next gateway implementation) would be greatly appreciated.

Thank you

Ken

HPierce
  • 7,249
  • 7
  • 33
  • 49
Ken
  • 423
  • 6
  • 13

1 Answers1

3

The class file in mfauveau/omnipay-nmi looks like this:

namespace Omnipay\NMI;
use Omnipay\Common\AbstractGateway;
class DirectPostGateway extends AbstractGateway

So to load it you should do this:

$gatewayObj = Omnipay::create("NMI_DirectPost");

The documentation for the PayPal REST gateway is fairly complete, to load that one you should use:

$gatewayObj = Omnipay::create("PayPal_Rest");
delatbabel
  • 3,601
  • 24
  • 29
  • Thank you NMI answerwas perfect. The Paypal_Rest side I am looking for more examples if you have any. – Ken Oct 30 '15 at 16:54
  • There are quite a few examples of PayPal_Rest, they are in the code documentation. I plan to add some more examples including the redirect flow within the code documentation shortly. If you have a specific question about Omnipay / PayPal_Rest then ask that as a separate question here on stack overflow and I will try to answer it. I am on SO most days and try to pick up the Omnipay questions where I can. – delatbabel Nov 02 '15 at 10:17