Skip to main content
Answer

How to Override CreatePaymentExt -> GetRequiredPrepaymentEnabled

  • June 14, 2024
  • 4 replies
  • 87 views

Forum|alt.badge.img+1

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. 

 

Best answer by aaghaei

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

 

4 replies

aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • Answer
  • June 15, 2024

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

 


Forum|alt.badge.img+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
}

 

 


Forum|alt.badge.img+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?

 


aaghaei
Captain II
Forum|alt.badge.img+10
  • Captain II
  • June 17, 2024

@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.