sveawebpay / php-integration

SDK for Sveas payment methods (standalone and Svea Checkout)
Other
15 stars 19 forks source link

Fatal error: Uncaught Error: Undefined class constant 'DBNORDEAFI' #89

Closed timint closed 3 years ago

timint commented 3 years ago

I am unable to perform a specific test with Nordea Finland. I am told to use DBNORDEAFI.

$response = $swp->usePaymentMethod(\Svea\WebPay\Constant\PaymentMethod::DBNORDEAFI)

Fatal error: Uncaught Error: Undefined class constant 'DBNORDEAFI'

For the full set of code:

      try {

        require_once FS_DIR_APP . 'ext/sveawebpay/autoloader.php';

        $config = Svea\WebPay\Config\ConfigurationService::getTestConfig();

        $swp = Svea\WebPay\WebPay::createOrder($config);

        $swp->addCustomerDetails(....);

        $swp->addOrderRow($orderRows);

          $response = $swp->usePaymentMethod(\Svea\WebPay\Constant\PaymentMethod::DBNORDEAFI)
                    ->setPayPageLanguage($order->data['language_code'])
                    ->setReturnUrl(document::ilink('order_process'))
                    ->setCancelUrl(document::ilink('checkout'))
                    ->getPaymentUrl();

      } catch ( \Exception $e ) {
        die($e->getMessage());
      }

Using the following test account:

    'commonCredentials' => array(
        'merchantId' => '6708',
        'secret' => 'a1.........................................................31'
    ),
alexanderwiden95 commented 3 years ago

Hi,

If you'd like to use "DBNORDEAFI" you either enter it directly or use the constant \Svea\WebPay\Constant\PaymentMethod::NORDEA_FI

$order->usePaymentMethod(\Svea\WebPay\Constant\PaymentMethod::NORDEA_FI);

or

$order->usePaymentMethod('DBNORDEAFI');

The constants can be seen here: https://github.com/sveawebpay/php-integration/blob/master/src/Constant/PaymentMethod.php#L20

timint commented 3 years ago

Thank you. Confirmed that the following works:

$order->usePaymentMethod(\Svea\WebPay\Constant\PaymentMethod::NORDEA_FI);

You should put ALL the definitions in the documentation.