Skip to main content
Solved

Override the ARPayment CCCapture Method


Forum|alt.badge.img

Hello,

 

How do I override the Capture CC action on the payments and applications screen? I pretty much want to run the basemethod in the override and once basemethod is completed, update a custom field.

I tried below but it isn’t working as expected.


public class BMEP_ARPaymentEntry_PaymentTransactionExt : PXGraphExtension<ARPaymentEntryPaymentTransaction, ARPaymentEntry>
    {
        public static bool IsActive() => true;
        public override void Initialize() => base.Initialize();

        public delegate IEnumerable CaptureCCPaymentDelegate(PXAdapter adapter);

[PXOverride]

        public virtual IEnumerable CaptureCCPayment(PXAdapter adapter, CaptureCCPaymentDelegate baseMethod)
        {
             baseMethod.Invoke(adapter);
             //custom logic
            return adapter.Get();
        }
}

Thank you for your help!

Best answer by Evgeny Afanasiev

Hi Vineela,

In Acumatica most of credit card processing logic is defined in the abstract generic Graph Extensions, that could not be overridden. However you can create a second level graph extension to the specific implementation of the generic  graph extension that is used in specific scope. For the AR Payment Entry screen the target implementation to override would be ARPaymentEntryPaymentTransaction. Please also note that there is a difference in the feature switches introduced in 2023 R1, that could and should be used if the business logic you’d wish to apply is relevant to the custom ICCPlugin.
Following code should be sufficient:
 

public class CCOverride : PXGraphExtension<ARPaymentEntryPaymentTransaction, ARPaymentEntry>
{
    //public static bool IsActive() => PXAccess.FeatureInstalled<PX.Objects.CS.FeaturesSet.customCCIntegration>(); //for 2023R1 and further

    public static bool IsActive() => PXAccess.FeatureInstalled<PX.Objects.CS.FeaturesSet.integratedCardProcessing>(); //for 2022R2 and prior

    public delegate IEnumerable CaptureCCPaymentDelegate(PXAdapter adapter);

    [PXOverride]
    public virtual IEnumerable CaptureCCPayment(PXAdapter adapter, CaptureCCPaymentDelegate baseDelegate) {
        var ret = baseDelegate?.Invoke(adapter);
        Base.Document.Ask("Capture", MessageButtons.OK);
        return ret;
    }
}

 

View original
Did this topic help you find an answer to your question?

4 replies

Naveen Boga
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3381 replies
  • September 9, 2023

@vineela95  Please try with the below code and verify.

 

public class KPPaymentTransactionInvExt : PXGraphExtension<ARPaymentEntryImportTransaction, ARPaymentEntryPaymentTransaction, ARPaymentEntry>
        {
            public static bool IsActive() => true;

            public delegate IEnumerable CaptureCCPaymentDelegate(PXAdapter adapter);
            [PXOverride]
            public virtual IEnumerable CaptureCCPayment(PXAdapter adapter, CaptureCCPaymentDelegate baseMethod)
            {

                var invokeBaseMethod = baseMethod(adapter);

                //Custom logic here

                return invokeBaseMethod;
            }
        }

 


Evgeny Afanasiev
Acumatica Moderator
Forum|alt.badge.img
  • Acumatica Moderator
  • 28 replies
  • Answer
  • September 11, 2023

Hi Vineela,

In Acumatica most of credit card processing logic is defined in the abstract generic Graph Extensions, that could not be overridden. However you can create a second level graph extension to the specific implementation of the generic  graph extension that is used in specific scope. For the AR Payment Entry screen the target implementation to override would be ARPaymentEntryPaymentTransaction. Please also note that there is a difference in the feature switches introduced in 2023 R1, that could and should be used if the business logic you’d wish to apply is relevant to the custom ICCPlugin.
Following code should be sufficient:
 

public class CCOverride : PXGraphExtension<ARPaymentEntryPaymentTransaction, ARPaymentEntry>
{
    //public static bool IsActive() => PXAccess.FeatureInstalled<PX.Objects.CS.FeaturesSet.customCCIntegration>(); //for 2023R1 and further

    public static bool IsActive() => PXAccess.FeatureInstalled<PX.Objects.CS.FeaturesSet.integratedCardProcessing>(); //for 2022R2 and prior

    public delegate IEnumerable CaptureCCPaymentDelegate(PXAdapter adapter);

    [PXOverride]
    public virtual IEnumerable CaptureCCPayment(PXAdapter adapter, CaptureCCPaymentDelegate baseDelegate) {
        var ret = baseDelegate?.Invoke(adapter);
        Base.Document.Ask("Capture", MessageButtons.OK);
        return ret;
    }
}

 


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 14 replies
  • September 11, 2023

Thank you @Naveen Boga !


Forum|alt.badge.img
  • Author
  • Jr Varsity II
  • 14 replies
  • September 11, 2023

Thank you very much @Evgeny Afanasiev !


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings