Skip to main content
Solved

How to Override CreatePaymentExt -> GetRequiredPrepaymentEnabled

  • 14 June 2024
  • 4 replies
  • 46 views

I’m trying to override the GetRequiredPrepaymentEnabled method on the CreatePaymentExt graph extension.

I’ve multiple methods, but have not been able to get it to work so far. 

Heres a screenshot showing ,my latest attempt. 

 

4 replies

Userlevel 7
Badge +9

@scottstanaland12  try this in you graph extension

[PXProtectedAccess()]
protected abstract bool GetRequiredPrepaymentEnabled(SOOrder order);

public delegate bool GetRequiredPrepaymentEnabledDelegate(SOOrder order);

[PXOverride]
public virtual bool GetRequiredPrepaymentEnabled(SOOrder order, GetRequiredPrepaymentEnabledDelegate baseMethod)
{
// Do some stuff
bool bm = baseMethod?.Invoke(order); // Do not call the base method if you do not need it
// Do more stuff and return the result
}

 

Userlevel 3
Badge +1

aaghaei, that worked.

Thanks for your help.

 

@scottstanaland12  try this in you graph extension

[PXProtectedAccess()]
protected abstract bool GetRequiredPrepaymentEnabled(SOOrder order);

public delegate bool GetRequiredPrepaymentEnabledDelegate(SOOrder order);

[PXOverride]
public virtual bool GetRequiredPrepaymentEnabled(SOOrder order, GetRequiredPrepaymentEnabledDelegate baseMethod)
{
// Do some stuff
bool bm = baseMethod?.Invoke(order); // Do not call the base method if you do not need it
// Do more stuff and return the result
}

 

 

Userlevel 3
Badge +1

@aaghaei The next thing I’m running into is I need to override the SatisfyPrepaymentRequirements and ViolatePrepaymentRequirements methods, which are Exteinsion methods on the SOOrder DAC class. 

I’ve tried adding the extension methods to my SOOrder DAC extension, but I have not been able to get it to call my customized methods.  Any ideas?

 

Userlevel 7
Badge +9

@scottstanaland12 Sorry, I am out of town without my computer. I suggest create a new topic so others can assist and also I suggest instead of screenshots attach your code so people don’t have to redo the work you have already done.

Reply