logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
Joe Payne2  
#1 Posted : Monday, May 10, 2021 2:59:47 PM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
I'm working on an upgrade from Gold R12 to Able 9.0.4. I needed to refresh my local dev db with the latest backup from the live Gold R12 site.

So I spun up a test v9.0.4 install and used it to upgrade the database. I couldn't figure out how to make my dev 9.0.4 re-trigger the install page so I could do the db upgrade again.

After spinning up my dev 9.0.4 site that I've been working on all spring, I got an error that I had never seen before working on this project.

In CommerceBuilder\Payments\PaymentRepository.cs inside the BeforeSave() method, the variable 'provider' is null. See code below.

Here's what is so weird: PaymentMethod is not null. And PaymentMethod.PaymentGateway is not null.

So even though the child object PaymentGateway is valid, the code wasn't able to get an instance to it using .GetInstance()

I was able to code around it by changing:
Code:

&& item.PaymentMethod.PaymentGateway != null


to:
Code:

&& provider != null


Which, in my opinion, is the way it should be anyways since item.PaymentMethod.PaymentGateway isn't even referenced inside the if{} statement.

But...I'm worried why I'm suddenly now seeing this error. Did I corrupt the db or the payment gateway references somehow using the test site to upgrade the db and then pointing a different 9.0.4 install to that upgraded db??

Code:

                IPaymentProvider provider = null;
                if (item.PaymentMethod != null && item.PaymentMethod.PaymentGateway != null) 
                    provider = item.PaymentMethod.PaymentGateway.GetInstance();

                // do not remove the account data if its gift certificate payment or if provider require account data for refund
                if (!(item.PaymentMethod != null 
                    && item.PaymentMethod.PaymentGateway != null
                    && (provider is GiftCertificatePaymentProvider || provider.RefundRequiresAccountData)))
                {
                    // get the payment lifepsan
                    Store store = AbleContext.Current.Store;
                    if (item.CompletedDate.HasValue && LocaleHelper.LocalNow >= item.CompletedDate.Value.Add(new TimeSpan(storeSettings.PaymentLifespan, 0, 0, 0)))
                    {
                        // the payment lifespan is elapsed, remove any account data
                        item.AccountData = string.Empty;
                    }
                }

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

mazhar  
#2 Posted : Tuesday, May 11, 2021 12:57:24 AM(UTC)
mazhar

Rank: Administration

Groups: Admin, Administrators, HelpDesk, System, Authorized User, Developers, Registered
Joined: 10/5/2018(UTC)
Posts: 175

Thanks: 8 times
Was thanked: 17 time(s) in 15 post(s)
Please confirm if the payment provider is installed or not. Perhaps, provider is not installed and gateway object is not able to instantiate the related provider.
judy at Web2Market  
#3 Posted : Tuesday, May 11, 2021 5:59:09 AM(UTC)
judy at Web2Market

Rank: Advanced Member

Groups: Developers
Joined: 11/7/2018(UTC)
Posts: 303

Thanks: 21 times
Was thanked: 5 time(s) in 5 post(s)
Did you make sure the plugin is installed? We had entries in the database, but had to install the plugin again.
Joe Payne2  
#4 Posted : Tuesday, May 11, 2021 7:03:37 AM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
That just might be the issue. There are no payment gateways installed in the site.

I've only done a few of these upgrades. Is that normal for the gateway data to convert but the gateways are not installed?

Due to the error, I wasn't even able to spin up the site to fix the issue via the admin UI. Surely this isn't how it's supposed to work.
shaharyartiwana25816656  
#5 Posted : Wednesday, May 12, 2021 3:14:27 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Quote:
Is that normal for the gateway data to convert but the gateways are not installed?


We handled this case in 9.0.4 that, if during an upgrade, there is a gateway data present then we mark the plugin as installed from code.

Can you confirm that you had InstalledPlugins.xml file present in the AppData folder?

If you could try once more or share some more information so that we can try to reproduce this on our end.

Thanks!
thanks 1 user thanked shaharyar for this useful post.
Joe Payne2 on 5/12/2021(UTC)
Joe Payne2  
#6 Posted : Wednesday, May 12, 2021 7:40:21 AM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
I used a fresh 9.0.4 install to upgrade the database. So if any gateways were detected during upgrade, it added them to the fresh install.

So this does create a new problem (in my opinion). Moving a database from one app install to another app install could have serious problems because of how plugins are implemented and how gateways are detected/instantiated.

The application and the data are no longer disconnected. That's a bummer.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.