parcs

package
v0.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CashRefund      = "CashRfnd"
	CashSale        = "CashSale"
	CustomerDeposit = "CustDep"
	CustomerRefund  = "CustRfnd"
)
View Source
const MaxConcurrent = 5

MaxConcurrent sets the number of concurrent transaction updates. Setting higher than 5 may cause a concurrency limit error: "Concurrent request limit exceeded. Request blocked. Verify your concurrency limits at Setup > Integration > Integration Management > Integration Governance."

Variables

This section is empty.

Functions

func CreateXMLDocuments added in v0.1.0

func CreateXMLDocuments(st []SubsidiaryTransactions) error

CreateXMLDocuments creates an XML Document for each block of transactions in a list of SubsidiaryTransactions.

func MarkTransactionSent added in v0.4.1

func MarkTransactionSent(t *Transaction, cfg Config) error

func MarkTransactionsSent added in v0.3.0

func MarkTransactionsSent(ctx context.Context, transactions []Transaction, cfg Config) error

func SendToWorkday added in v0.3.0

func SendToWorkday(cfg Config, data []ssh.Document) error

Types

type Config added in v0.3.0

type Config struct {
	NetSuiteConsumerKey    string `envconfig:"netsuite_consumer_key"`
	NetSuiteConsumerSecret string `envconfig:"netsuite_consumer_secret"`
	NetSuiteToken          string `envconfig:"netsuite_token_id"`
	NetSuiteTokenSecret    string `envconfig:"netsuite_token_secret"`
	NetSuiteRealm          string `envconfig:"netsuite_account"`
	NetSuiteSavedSearchURL string `envconfig:"netsuite_saved_search_url"`
	NetSuiteSearchID       string `envconfig:"netsuite_search_id"`
	SFTPUsername           string `envconfig:"sftp_username"`
	SFTPHost               string `envconfig:"sftp_host"`
	SFTPPrivateKey         string `envconfig:"sftp_private_key"`
	SFTPDirectory          string `envconfig:"sftp_directory"`
	// contains filtered or unexported fields
}

Config keeps configuration values read from environment or AWS SSM. When read from environment variables, the corresponding variable name is the all-caps transformation of the 'envconfig' key prefixed with the environment name prefix passed to GetConfig(). For example, if "DEV_" is the prefix, NetSuiteRealm will contain the value of the DEV_NETSUITE_ACCOUNT environment variable.

func GetConfig added in v0.3.0

func GetConfig(ctx context.Context, prefix string) (Config, error)

GetConfig reads from environment variables, and optionally AWS Systems Manager Parameter Store, and returns a Config structure for use by other functions in this package. The prefix parameter is used to differentiate operating environments. Environment variable names must be prefixed with this string. If the environment variable PARAMETER_STORE_PREFIX is defined, SSM parameters having that prefix will be read before loading environment variables. Thus, environment can override SSM parameters but not the other way around.

type PMISBatch

type PMISBatch struct {
	XMLName xml.Name   `xml:"PMISBatch"`
	Header  PMISHeader `xml:"Header"`
	Trans   []PMISTran `xml:"PMISTran"`
}

PMISBatch is the definition of the top-level object in the XML file output.

type PMISHeader

type PMISHeader struct {
	BatchCount    int     `xml:"BatchCount"`
	BatchTotal    float32 `xml:"BatchTotal"`
	OriginatingPP string  `xml:"Originating_PP"`
}

PMISHeader is the definition of the header object in the XML file.

type PMISTran

type PMISTran struct {
	TranType             string  `xml:"TranType"`
	RPP                  string  `xml:"RPP"`
	OPPTransactionAmount float64 `xml:"OPP_Transaction_Amount"`
	TransactionDesc      string  `xml:"Transaction_Description"`
	HouseholdCode        string  `xml:"Household_Code"`
	RPPDestination       string  `xml:"RPP_Destination_String"`
	RPPTranCode          string  `xml:"RPP_Trans_Type_Code"`
	OPPTransactionRef    string  `xml:"OPP_Transaction_Ref"`
	OriginatingPerson    string  `xml:"Originating_Person"`
	OPPTransactionDate   string  `xml:"OPP_Transaction_Date"`
}

PMISTran is the definition of the transaction object in the XML file.

type SearchRecord added in v0.3.0

type SearchRecord struct {
	RecordType string `json:"recordType"`
	ID         string `json:"id"` // not used
	Values     Values `json:"values"`
}

type SearchResponse added in v0.3.0

type SearchResponse struct {
	Results []SearchRecord `json:"results"`
}

func DoSavedSearch added in v0.3.0

func DoSavedSearch(ctx context.Context, cfg Config) (SearchResponse, error)

DoSavedSearch calls the configured NetSuite saved search and decodes the response to a SearchResponse.

type SelectValue added in v0.3.0

type SelectValue struct {
	Value string `json:"value"`
	Text  string `json:"text"`
}

type SubsidiaryTransactions

type SubsidiaryTransactions struct {
	Subsidiary   string
	TotalAmount  int
	Transactions []Transaction
	Document     ssh.Document
}

func GroupTransactions added in v0.3.0

func GroupTransactions(transactions []Transaction, maxSize int) ([]SubsidiaryTransactions, error)

GroupTransactions segments the transaction list into blocks by subsidiary. No more than maxSize transactions will be included in a single block.

type Transaction

type Transaction struct {
	NetSuiteID           string
	CustomerExternalID   string
	Memo                 string
	SubsidiaryExternalID string
	TranDate             time.Time
	TranID               string
	Amount               int
	ParCSReference       string
	CustomerCategory     string
	ParCSTranCode        string
	TranType             string
}

Transaction defines a transaction after being read from NetSuite, but before writing to XML.

func TransformSearchResponse added in v0.3.0

func TransformSearchResponse(response SearchResponse) []Transaction

type Values added in v0.3.0

type Values struct {
	InternalID                        []SelectValue `json:"internalid"`
	Type                              []SelectValue `json:"type"`
	TransactionDate                   string        `json:"trandate"`
	TranID                            string        `json:"tranid"`
	Memo                              string        `json:"memo"`
	Custcol1                          string        `json:"custcol1"`
	CustcolParcsTranTypeCode          []SelectValue `json:"custcol_parcs_tran_type_code"`
	CustbodyParcsRefBody              string        `json:"custbody_parcs_ref_body"`
	TaxAmount                         string        `json:"taxamount"`
	CreditAmount                      string        `json:"creditamount"`
	DebitAmount                       string        `json:"debitamount"`
	CustomerCustentitySILCustCategory []SelectValue `json:"customer.custentity_sil_cust_category"`
	CustomerExternalID                []SelectValue `json:"customer.externalid"`
	SubsidiaryCustRecord155           string        `json:"subsidiary.custrecord155"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址