ERP integration example with NetSuite for appeasement refunds
This example uses NetSuite as the ERP system for the retailer to integrate with, to sync appeasement refunds in the NewStore platform. If you integrate with ERP systems other than NetSuite, see the integration playbook or contact the support team.
To successfully create NetSuite transactions from NewStore appeasement
refunds, map fields (such as channel identifiers
) from NewStore values
to NetSuite values. The necessary static maps are described in the
following sections.
You can also use the AWS Systems Manager Parameter Store to supply integration lambdas with these maps as an implementation option.
Channel map
Maps from NewStore channel types (web
or store
) to the corresponding
numerical NetSuite identifiers.
Map name in sample implementation:
netsuite/newstore_to_netsuite_channel
Location map
Provides the following NetSuite attributes for each NewStore store location:
- NetSuite store ID
- NetSuite subsidiary ID for the store
- A placeholder customer name and email used for in-store purchases for situations where no actual customer information is present.
Map name in sample implementation:
netsuite/newstore_to_netsuite_locations
Payment method map
In NetSuite, each payment needs to be represented as an order line item. The payment method map provides a virtual NetSuite product ID for each NewStore payment method. This information enables the integration to create suitable NetSuite payment line items, corresponding to the received NewStore payment information.
Map name in sample implementation:
netsuite/newstore_to_netsuite_payment_items
List of gift card product IDs
You need this list to map a gift card payment to the corresponding product ID, when creating a NetSuite payment order line for a gift card payment.
Map name in sample implementation:
netsuite/newstore_giftcard_product_ids
Shipping method map
Maps the shipping service levels configured as part of the NewStore fulfillment configuration to corresponding NetSuite shipping method identifiers.
Map name in sample implementation:
netsuite/newstore_to_netsuite_shipping_methods
Currency map
While NewStore uses three-letter ISO codes for currencies, NetSuite uses numeric identifiers. The currency map maps between these two representations.
In the sample implementation, the currency_map
is part of a collection
of multiple configured constants, maintained in the map
netsuite/iso_to_netsuite_currencies
.
CashRefund Record Type
For each NewStore appeasement refund, create a CashRefund
transaction
in the ERP system.
To create the RecordRef
type, you need the ID of the related record
type. See the following example to create a RecordRef
for the
partner
attribute with ID 2
:
'partner': RecordRef(internalId=2)
The mapping table from NewStore appeasement data, as provided by GraphQL, that syncs with NetSuite CashRefund attributes:
CashRefund Record Type attribute | Type | Comment | NewStore attribute |
---|---|---|---|
customForm | String | This is the NetSuite form identifier for the CashSale record type, as configured in NetSuite. The only way to create NetSuite transactions from an integration is via a custom form, as entities like CashSale cannot be created directly. | NA |
partner | RecordRef | This is the partner identifier of NewStore, as configured in NetSuite. | NA |
subsidiary | RecordRef | This is the subsidiary of the retailer where the order is placed. The subsidiary is determined by looking it up for the store, using the Location map . | |
externalId | String | refund_request.id | |
createdFrom | String | This field represents the identifier of the order that this appeasement belongs to. | refund_request.order_id |
currency | RecordRef | NetSuite currency identifier, as retrieved from the Currency map . | order.currency |
tranDate | DateTime String | refund_request.requested_at | |
entity | RecordRef | This attribute represents a customer record-type. | See Entity Record Type . |
CashRefundItemList | RecordRef | This attribute represents the items in a cash refund. | See Cash Refund Item List Record Type . |
customFieldList | CustomFieldList | This is a list of custom fields that are defined in NetSuite by the retailer. The list of these custom fields and their meaning is available from the responsible Solution Architect. |
Entity Record Type
Use the following mapping table to create a new customer in NetSuite:
Entity Record Type attribute | Type | Comment | NewStore attribute |
---|---|---|---|
customForm | String | This is the NetSuite form identifier for the customer create form. | NA |
firstName | order.shipping_address.first_name | ||
lastName | order.shipping_address.last_name | ||
email | customer_email | ||
phone | order.shipping_address.phone | ||
salutation | order.shipping_address.salutation | ||
isPerson | Boolean | Always set it to true . | NA |
currencyList | RecordType | NetSuite currency identifier, as retrieved from the Currency map . |
Cash Refund Item List Record Type
Cash refund item list includes the list of order items and the list of payment items.
CashRefundItem Record Type attribute | Type | Comment | NewStore attribute |
---|---|---|---|
item | RecordRef | This is the NetSuite form identifier for the customer create form. | order.items[i].productId |
location | RecordRef | order.demandLocationId | |
| RecordRef | This is the identifier of the price type which is specified in the AWS Systems Manager Parameter Store. Note This is not the price of the item. | NA |
rate | This is the price of the item. | order.item[i].pricebookPrice | |
amount | This is the amount of the refund of the item. | refund_request.amount |