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, January 30, 2023 3:08:34 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)
It appears to me that the shopper's pay-my-order page does not correctly process ARB subscriptions when a stored card profile is used for payment.

If you pay for a subscription order with a stored card profile during regular checkout, the subscription.GatewayPaymentProfileId value gets assigned like it should.

However if you pay for an existing subscription order from the pay-my-order page using the same stored card profile, that portion of the credit-card-payment-form code does not include assigning the stored card profile to the subscription.

The result is the recurring order system treats the subscription as a regular recurring order and no AuthNet ARB is registered. Even though it was paid using the AuthNet stored card profile.

Walk the public ActionResult _CreditCardPaymentForm(CreditCardPaymentModel model) method in CheckoutController.cs assuming:
model.IsCompleteButtonSubmit = false
order != null

All it does is (eventually) call PayOrder() and bail out. No further effort to accommodate a stored card profile is actually made.
thanks 1 user thanked Joe Payne2 for this useful post.
nadeem on 2/1/2023(UTC)

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

nadeem  
#2 Posted : Wednesday, February 1, 2023 9:00:46 AM(UTC)
nadeem

Rank: Advanced Member

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

Thanks: 17 times
Was thanked: 18 time(s) in 18 post(s)
Hi Joy,

I am able to confirm the issue and reported to fix for the next version. Thank you!
thanks 1 user thanked nadeem for this useful post.
Joe Payne2 on 2/1/2023(UTC)
nadeem  
#3 Posted : Tuesday, February 7, 2023 11:18:09 AM(UTC)
nadeem

Rank: Advanced Member

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

Thanks: 17 times
Was thanked: 18 time(s) in 18 post(s)
Here are the code fix in case you are interested to integrate:

Open /Website/Controllers/CheckoutController.cs file and find the PayOrder action

Locate the following code

Code:
if (payment.PaymentMethod != null)
{
    hasGateway = (payment.PaymentMethod.PaymentGateway != null);
}
else if (payment.PaymentProfile != null)
{
    int gatewayId = gatewayRepo.GetPaymentGatewayIdByClassId(payment.PaymentProfile.GatewayIdentifier);
    PaymentGateway gateway = gatewayRepo.Load(gatewayId);
    hasGateway = (gateway != null);
}

if (hasGateway)
{
    // PRESERVE ACCOUNT DATA FOR PROCESSING
    string accountData = payment.AccountData;
    payment.AccountData = string.Empty;
                
    



and replace with

Code:
GatewayPaymentProfile profile = null;
if (payment.PaymentMethod != null)
{
    hasGateway = (payment.PaymentMethod.PaymentGateway != null);
}
else if (payment.PaymentProfile != null)
{
    int gatewayId = gatewayRepo.GetPaymentGatewayIdByClassId(payment.PaymentProfile.GatewayIdentifier);
    PaymentGateway gateway = gatewayRepo.Load(gatewayId);
    hasGateway = (gateway != null);   
}

if (hasGateway)
{
    // PRESERVE ACCOUNT DATA FOR PROCESSING
    string accountData = payment.AccountData;
    payment.AccountData = string.Empty;
                
    if (payment.PaymentProfile != null)
    {
        IList<Subscription> subscriptions = AbleContext.Resolve<ISubscriptionRepository>().LoadForOrder(order.Id);
        foreach (Subscription subscription in subscriptions)
        {
             if (subscription.PaymentFrequency.HasValue && subscription.PaymentFrequencyUnit.HasValue)
             {
                 subscription.PaymentProfile = payment.PaymentProfile;
                 subscription.PaymentProcessingType = PaymentProcessingType.ArbProfileManaged;
                 AbleContext.Resolve<ISubscriptionRepository>().Save(subscription);
             }
         }
     } 


Hope this helps!

Edited by user Tuesday, February 21, 2023 11:13:12 AM(UTC)  | Reason: Not specified

thanks 1 user thanked nadeem for this useful post.
Joe Payne2 on 2/8/2023(UTC)
Joe Payne2  
#4 Posted : Wednesday, February 8, 2023 5:08: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)
Thank you Nadeem, I will review and apply to my install.

You might also want to look at card profile storage. Here's a walkthrough that I don't see handled:

* Create an order in admin with no payments for an account that has an existing stored card profile
* Pull up order in pay-my-order page

Credit card UI correctly renders stored card profile as a choice. However there is also the option for shopper to add a new card.

If you choose add a new card, then enter card details and check the save-card checkbox....I don't see the code that actually stores the new card profile.

Should be seeing something like this I believe:
Code:

                                        if (profile == null && model.CardType > 0)
                                        {
                                            AccountDataDictionary cardDetails = new AccountDataDictionary();
                                            cardDetails["AccountName"] = model.CardName.Trim();
                                            cardDetails["AccountNumber"] = cardNumber.Trim();
                                            cardDetails["ExpirationMonth"] = model.ExpirationMonth.ToString();
                                            cardDetails["ExpirationYear"] = model.ExpirationYear.ToString();
                                            cardDetails["SecurityCode"] = securityCode.Trim();
                                            profile = CreateProfile(model, cardDetails);
                                        }
thanks 1 user thanked Joe Payne2 for this useful post.
nadeem on 2/8/2023(UTC)
nadeem  
#5 Posted : Wednesday, February 8, 2023 5:18:10 AM(UTC)
nadeem

Rank: Advanced Member

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

Thanks: 17 times
Was thanked: 18 time(s) in 18 post(s)
We will look into this when while fixing the bug. Thanks for the more details.
Users browsing this topic
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.