sveawebpay / php-integration

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

[Critical] Direct Bank gives CardPay in 3.0.0 #74

Closed timint closed 7 years ago

timint commented 7 years ago

Major issue here using usePayPageDirectBankOnly() a link to a CardPay payment window is generated. Expected was a link to a direct bank payment window.

Using 3.0.0.

Please note: All clients are unable to upgrade because they are not using Svea Checkout which I am told is a mandatory dependancy if upgrading from "php-integration 3.0.0".

        $response = $swp->usePayPageDirectBankOnly()
                        ->setPayPageLanguage($order->data['language_code'])
                        ->setReturnUrl(document::ilink('order_process'))
                        ->setCancelUrl(document::ilink('checkout'))
                        ->getPaymentUrl();

Gives

image

Where do we go from here?

fre-sund commented 7 years ago

Hi!

It's not mandatory to use Svea Checkout if you are upgrading to a later version than 3.0.0, however the integration package that gives support to Svea Checkout is a package that is mandatory.

However you are free to use any of the other payment methods, the package only adds functionality to php-integration.

Now onto your problem, if you don't want to upgrade past 3.0.0, you can go and add the following line $methods[] = SystemPaymentMethod::SVEACARDPAY; to the file "/src/HostedService/Payment/DirectPayment.php" below the line $methods[] = SystemPaymentMethod::SKRILL; which is on line 50 in 3.2.1 (not sure about 3.0.0 but it should be the same)

Doing this should remove the card methods, also make sure that you are using a merchantId that has directbanks configured otherwise they won't appear like they are in the picture that you are provided.

If you want to test this out you can use the merchantId 1130, which should yield this result:

bild

I will commit an fix for this so that it will be added to a later release.

Thanks for reporting this and have a nice day!

Kind regards, Fredrik

timint commented 7 years ago

Thank you Fredrik for replying..

We have previously rewritten the modules 4 or 5 times. That's how many different API:s Svea had just through the recent years. The reason why we ended up using the integration package is because all those API documentations that were phased out could drive a man insane. Bascially we were told that this was the best move where we wouldn't need to worry about API's being phased out in the future.

Now regarding upgrading 3.0.0 to a higher version. In issue ticket #72 TXC said

this repository is using "Svea Checkout" as a dependency

I can't load up any payment method without getting the error:

require_once(Svea\Checkout\Transport\Connector.inc.php): failed to open stream: No such file or directory

Back to this thread's topic. I added the line accoarding to your instructions and the client is now receiving a new error:

No valid paymentmethods.

Here is the modified code:

    protected function configureExcludedPaymentMethods()
    {
        // first, exclude all invoice/paymentplan payment methods
        $methods = ExcludePayments::excludeInvoicesAndPaymentPlan();

        //card
        $methods[] = SystemPaymentMethod::KORTCERT;
        $methods[] = SystemPaymentMethod::SKRILL;
        $methods[] = SystemPaymentMethod::SVEACARDPAY; // <------ Added 

        //other
        $methods[] = SystemPaymentMethod::PAYPAL;

        return $methods;
    }
fre-sund commented 7 years ago

The "php-checkout" is a dependency because it's required in order to communicate with the checkout api, if we didn't include it our composer file as a dependency users would be required to download the php-checkout seperatly or we would have to maintain the same code in two different repositories.

Can you send me your merchantId to our support mail? Support-webpay@sveaekonomi.se

timint commented 7 years ago

Mail sent.

As for the checkout dependancy let's continue the discussion in a dedicated thread. I'll open one and provide some feedback.