Classes for MYOB Acumatica Entities
Classes for MYOB Acumatica entities are adapters for the entities of the contract-based REST API of MYOB Acumatica. To implement these classes, you have two options: Define the classes on your own, or use the classes defined for the default BigCommerce and Shopify integrations, which are available in the PX.Commerce.Core.API namespace. For example, if you need to work with customers in MYOB Acumatica, you can use the predefined PX.Commerce.Core.API.Customer class. If the entity is not implemented in the PX.Commerce.Core.API namespace, you implement a custom class for this entity.
Base Class and Interface
The classes for MYOB Acumatica entities derive from the PX.Commerce.Core.API.CBAPIEntity base class, which implements the PX.Commerce.Core.ILocalEntity interface. The CBAPIEntity class includes the set of standard properties of a contract-based API entity, such as Id, RowNumber, Delete, and ReturnBehavior. This class also defines a set of properties that are necessary for the synchronization of the entity with an entity from an external e-commerce system, such as SyncID or SyncTime.
Properties of Each Custom Class
In each custom class, you define only the properties of the contract-based API entity that you need to use, including the key fields of the entity. The name of the class and its properties should be exactly the names of the corresponding contract-based API entity and its properties in the eCommerce/20.200.001 endpoint.
You assign the PX.Commerce.Core.CommerceDescription attributes with the names of the entity and its properties to the class and its properties, respectively. These names are used as the names of the MYOB Acumatica objects and fields on the mapping and filtering tabs of the Entities (BC202000) form.
Example
An example of the implementation of a class derived from the CBAPIEntity is shown in the following code.
using PX.Commerce.Core.API;
using PX.Api.ContractBased.Models;
using PX.Commerce.Core;
[CommerceDescription("Case")]
public partial class Case : CBAPIEntity
{
public GuidValue NoteID { get; set; }
public DateTimeValue LastModifiedDateTime { get; set; }
[CommerceDescription("CaseCD")]
public StringValue CaseCD { get; set; }
[CommerceDescription("Subject")]
public StringValue Subject { get; set; }
[CommerceDescription("Description")]
public StringValue Description { get; set; }
}