Solved

Override the ARPayment CCCapture Method

  • 8 September 2023
  • 4 replies
  • 64 views

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!

icon

Best answer by Evgeny Afanasiev 11 September 2023, 16:38

View original

4 replies

Userlevel 7
Badge +17

@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;
}
}

 

Userlevel 3
Badge

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;
}
}

 

Thank you @Naveen Boga !

Thank you very much @Evgeny Afanasiev !

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved