AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
9.0.4 Unexpected error in PaymentRepository.cs
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: 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;
}
}
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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.
|
|
|
|
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!
|
1 user thanked shaharyar for this useful post.
|
|
|
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.
|
|
|
|
AbleCommerce Forums
»
AbleCommerce
»
General Questions
»
9.0.4 Unexpected error in PaymentRepository.cs
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.
Important Information:
The AbleCommerce Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close