{
	"name": "form/nc/erp-sync/woocommerce/convert-local/order-sales.json",
	"default_value": {
		"order": {
			"static": {
				"company_id": "7000",
				"order_state": "AV",
				"person_id": "HV",
				"terms_of_payment_id": "K"
			},
			"copy_value": {
				"company_reference_number": "json_data.project_id",
				"confirmation_date": "order_date"
			},
			"code": [
				{
					"result": "company_id",
					"function": "countryCodeToCustomer",
					"parameter": [
						{
							"tag": "json_data.additional_data.shipping.country"
						}
					]
				},
				{
					"function": "if",
					"parameter": ["json_data.additional_data.pickup_location", "<>", "nil"],
					"then": [
						{
							"result": "delivery_address",
							"function": "concatWith",
							"parameter": [
								"\n",
								{
									"tag": "json_data.additional_data.pickup_location.title"
								},
								{
									"tag": "json_data.additional_data.pickup_location.street_address"
								},
								{
									"tag": "json_data.additional_data.pickup_location.street_address2"
								},
								{
									"function": "concatWith",
									"parameter": [
										" ",
										{
											"tag": "json_data.additional_data.pickup_location.postcode"
										},
										{
											"tag": "json_data.additional_data.pickup_location.city"
										}
									]
								},
								{
									"function": "countryCodeToName",
									"parameter": [
										{
											"tag": "json_data.additional_data.pickup_location.country"
										}
									]
								}
							]
						}
					],
					"else": [
						{
							"result": "delivery_address",
							"function": "concatWith",
							"parameter": [
								"\n",
								{
									"tag": "json_data.additional_data.meta_data[?key=='_woo_carrier_agent_meta'].value[?carrier==*].title"
								},
								{
									"tag": "json_data.additional_data.meta_data[?key=='_woo_carrier_agent_meta'].value[?carrier==*].street_address"
								},
								{
									"tag": "json_data.additional_data.meta_data[?key=='_woo_carrier_agent_meta'].value[?carrier==*].street_address2"
								},
								{
									"function": "concatWith",
									"parameter": [
										" ",
										{
											"tag": "json_data.additional_data.meta_data[?key=='_woo_carrier_agent_meta'].value[?carrier==*].postcode"
										},
										{
											"tag": "json_data.additional_data.meta_data[?key=='_woo_carrier_agent_meta'].value[?carrier==*].city"
										}
									]
								},
								{
									"function": "countryCodeToName",
									"parameter": [
										{
											"tag": "json_data.additional_data.meta_data[?key=='_woo_carrier_agent_meta'].value[?carrier==*].country"
										}
									]
								}
							]
						}
					]
				},
				{
					"result": "order_address",
					"function": "concatWith",
					"parameter": [
						"\n",
						{
							"function": "concatWith",
							"parameter": [
								" ",
								{
									"tag": "json_data.additional_data.shipping.last_name"
								},
								{
									"tag": "json_data.additional_data.shipping.first_name"
								}
							]
						},
						{
							"tag": "json_data.additional_data.shipping.company"
						},
						{
							"tag": "json_data.additional_data.shipping.address_1"
						},
						{
							"tag": "json_data.additional_data.shipping.address_2"
						},
						{
							"function": "concatWith",
							"parameter": [
								" ",
								{
									"tag": "json_data.additional_data.shipping.postcode"
								},
								{
									"tag": "json_data.additional_data.shipping.city"
								}
							]
						},
						{
							"function": "countryCodeToName",
							"parameter": [
								{
									"tag": "json_data.additional_data.shipping.country"
								}
							]
						},
						{
							"tag": "json_data.additional_data.shipping.email"
						}
					]
				},
				{
					"result": "invoicing_address",
					"function": "concatWith",
					"parameter": [
						"\n",
						{
							"function": "concatWith",
							"parameter": [
								" ",
								{
									"tag": "json_data.additional_data.billing.last_name"
								},
								{
									"tag": "json_data.additional_data.billing.first_name"
								}
							]
						},
						{
							"tag": "json_data.additional_data.billing.company"
						},
						{
							"tag": "json_data.additional_data.billing.address_1"
						},
						{
							"tag": "json_data.additional_data.billing.address_2"
						},
						{
							"function": "concatWith",
							"parameter": [
								" ",
								{
									"tag": "json_data.additional_data.billing.postcode"
								},
								{
									"tag": "json_data.additional_data.billing.city"
								}
							]
						},
						{
							"function": "countryCodeToName",
							"parameter": [
								{
									"tag": "json_data.additional_data.billing.country"
								}
							]
						},
						{
							"function": "concatWith",
							"parameter": [
								", ",
								{
									"tag": "json_data.additional_data.billing.phone"
								},
								{
									"tag": "json_data.additional_data.billing.email"
								}
							]
						}
					]
				},
				{
					"function": "daysAdd",
					"parameter": [
						{
							"tag": "order_date"
						},
						1
					],
					"result": "json_data.first_delivery_date"
				}
			]
		},
		"order_row": {
			"copy_value": {
				"delivery_date": "ord.json_data.first_delivery_date"
			},
			"code": [
				{
					"function": "upperCase",
					"parameter": [
						{
							"tag": "product_id"
						}
					],
					"result": "product_id"
				}
			]
		}
	}
}
