Nickolas Hook
Nickolas Hook

Reputation: 804

Create Sales Order Payment in 2020R2

I'm upgrading a customization that was able to create payments on Sales Orders via code. Prior to 2020R2 I could use something along the lines of...

PXGraph graph;
orderEntry.CreatePaymentProc(orderEntry.Document.Current, out graph);
ARPaymentEntry paymentEntry = (ARPaymentEntry)graph;
ARPayment payment = paymentEntry.Document.Select();

payment.PaymentMethodID = ...;
payment.CuryOrigDocAmt = ...;
payment.ExtRefNbr = ...;
payment.CashAccountID = ...;

paymentEntry.Document.Update(payment);
paymentEntry.Actions.PressSave();

As of Acumatica 2020R2 CreatePaymentProc is no longer a method of SOOrderEntry.

How can the same result be achieved?

Upvotes: 0

Views: 275

Answers (2)

Nickolas Hook
Nickolas Hook

Reputation: 804

The full solution here involved a couple additional method calls...

SOOrder order = orderEntry.Document.Current;
CreatePaymentExt createPaymentExt = orderEntry.GetExtension<CreatePaymentExt>();
SOQuickPayment payment = createPaymentExt.QuickPayment.Current;
createPaymentExt.SetDefaultValues(payment, order);

payment.PaymentMethodID = ...;
payment.CuryOrigDocAmt = ...;
payment.ExtRefNbr = ...;
payment.CashAccountID = ...;

ARPaymentEntry paymentEntry = createPaymentExt.CreatePayment(payment, order, ARPaymentType.Payment);
paymentEntry.Save.Press();

Upvotes: 3

Vardan Vardanyan
Vardan Vardanyan

Reputation: 669

All of the methods and actions for the payment creating for the Sales Orders records in the Acumatica 2020R2 release you can find in the extension CreatePaymentExtclass.

As of Acumatica 2020R2 CreatePaymentProc has been changed the CreatePayment method on the CreatePaymentExt class.

Upvotes: 2

Related Questions