merchi_sdk_js 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +4 -1
- package/src/job.js +2 -0
- package/src/job_note.js +24 -1
- package/src/job_operation_log.js +65 -0
- package/src/merchi.js +9 -0
- package/src/notification.js +1 -0
- package/src/pricing/__fixtures__/conditional_field_hidden.json +112 -0
- package/src/pricing/__fixtures__/conditional_field_visible.json +113 -0
- package/src/pricing/__fixtures__/group_product.json +130 -0
- package/src/pricing/__fixtures__/non_selectable_number_field.json +108 -0
- package/src/pricing/__fixtures__/quantity_break_discount.json +104 -0
- package/src/pricing/__fixtures__/simple_selectable_field.json +110 -0
- package/src/pricing/discount.js +14 -0
- package/src/pricing/estimate.js +172 -0
- package/src/pricing/golden.test.js +54 -0
- package/src/pricing/index.js +5 -0
- package/src/pricing/inventory.js +73 -0
- package/src/pricing/pricing.test.js +77 -0
- package/src/pricing/round.js +19 -0
- package/src/pricing/visibility.js +90 -0
- package/src/user.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "merchi_sdk_js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/merchi.js",
|
|
6
6
|
"module": "src/merchi.js",
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
"src/"
|
|
10
10
|
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "node --test"
|
|
13
|
+
},
|
|
11
14
|
"dependencies": {
|
|
12
15
|
"axios": "^0.27.2",
|
|
13
16
|
"browser-or-node": "^2.1.1",
|
package/src/job.js
CHANGED
|
@@ -30,6 +30,7 @@ import { VariationsGroup } from './variations_group.js';
|
|
|
30
30
|
import { Item } from './item.js';
|
|
31
31
|
import { JobComment } from './job_comment.js';
|
|
32
32
|
import { JobNote } from './job_note.js';
|
|
33
|
+
import { JobOperationLog } from './job_operation_log.js';
|
|
33
34
|
import { Reminder } from './reminder.js';
|
|
34
35
|
import { InternalTag } from './internal_tag.js';
|
|
35
36
|
|
|
@@ -43,6 +44,7 @@ export function Job() {
|
|
|
43
44
|
addPropertyTo(this, 'currency');
|
|
44
45
|
addPropertyTo(this, 'quantity');
|
|
45
46
|
addPropertyTo(this, 'jobNotes', JobNote);
|
|
47
|
+
addPropertyTo(this, 'operationLogs', JobOperationLog);
|
|
46
48
|
addPropertyTo(this, 'jobType');
|
|
47
49
|
addPropertyTo(this, 'product', Product);
|
|
48
50
|
addPropertyTo(this, 'supplyChainRequestProduct', Product);
|
package/src/job_note.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { generateUUID } from './uuid.js';
|
|
2
|
-
import { addPropertyTo, enumerateFiles, fromJson, create, serialise
|
|
2
|
+
import { addPropertyTo, enumerateFiles, fromJson, create, serialise,
|
|
3
|
+
patchOne, deleteOne } from './model.js';
|
|
3
4
|
import { Job } from './job.js';
|
|
4
5
|
import { User } from './user.js';
|
|
5
6
|
import { MerchiFile } from './merchi_file.js';
|
|
@@ -33,4 +34,26 @@ export function JobNote() {
|
|
|
33
34
|
error: options.error,
|
|
34
35
|
embed: options.embed});
|
|
35
36
|
};
|
|
37
|
+
|
|
38
|
+
this.save = function (options) {
|
|
39
|
+
var data = serialise(this),
|
|
40
|
+
self = this;
|
|
41
|
+
function handleResponse(result) {
|
|
42
|
+
options.success(fromJson(self, result[self.json]));
|
|
43
|
+
}
|
|
44
|
+
patchOne({resource: this.resource,
|
|
45
|
+
id: this.id(),
|
|
46
|
+
parameters: data[0],
|
|
47
|
+
files: enumerateFiles(data[1]),
|
|
48
|
+
success: handleResponse,
|
|
49
|
+
error: options.error,
|
|
50
|
+
embed: options.embed});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
this.delete = function (options) {
|
|
54
|
+
options = options || {};
|
|
55
|
+
var success = options.success || function () {},
|
|
56
|
+
error = options.error || function () {};
|
|
57
|
+
deleteOne(this.resource + '/' + this.id(), success, error);
|
|
58
|
+
};
|
|
36
59
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { generateUUID } from './uuid.js';
|
|
2
|
+
import {
|
|
3
|
+
addPropertyTo,
|
|
4
|
+
fromJson,
|
|
5
|
+
getOne,
|
|
6
|
+
getList,
|
|
7
|
+
fromJsonList,
|
|
8
|
+
deleteOne,
|
|
9
|
+
} from './model.js';
|
|
10
|
+
import { Job } from './job.js';
|
|
11
|
+
import { User } from './user.js';
|
|
12
|
+
|
|
13
|
+
export function JobOperationLog() {
|
|
14
|
+
this.resource = '/job_operation_logs';
|
|
15
|
+
this.json = 'jobOperationLog';
|
|
16
|
+
this.temporaryId = generateUUID();
|
|
17
|
+
|
|
18
|
+
addPropertyTo(this, 'id');
|
|
19
|
+
addPropertyTo(this, 'job', Job);
|
|
20
|
+
addPropertyTo(this, 'user', User);
|
|
21
|
+
addPropertyTo(this, 'sourceType');
|
|
22
|
+
addPropertyTo(this, 'aiInvolved');
|
|
23
|
+
addPropertyTo(this, 'action');
|
|
24
|
+
addPropertyTo(this, 'payloadJson');
|
|
25
|
+
addPropertyTo(this, 'changesJson');
|
|
26
|
+
addPropertyTo(this, 'operationJson');
|
|
27
|
+
addPropertyTo(this, 'createdAt');
|
|
28
|
+
|
|
29
|
+
this.get = function (success, error, embed) {
|
|
30
|
+
var self = this;
|
|
31
|
+
function handleResponse(result) {
|
|
32
|
+
success(
|
|
33
|
+
fromJson(self, result[self.json], { makesDirty: false })
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
getOne({
|
|
37
|
+
resource: this.resource,
|
|
38
|
+
id: this.id(),
|
|
39
|
+
success: handleResponse,
|
|
40
|
+
error: error,
|
|
41
|
+
embed: embed,
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
this.delete = function (options) {
|
|
46
|
+
options = options || {};
|
|
47
|
+
var success = options.success || function () {},
|
|
48
|
+
error = options.error || function () {};
|
|
49
|
+
deleteOne(this.resource + '/' + this.id(), success, error);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function JobOperationLogs() {
|
|
54
|
+
this.resource = '/job_operation_logs';
|
|
55
|
+
this.json = 'jobOperationLogs';
|
|
56
|
+
this.single = JobOperationLog;
|
|
57
|
+
|
|
58
|
+
this.get = function (success, error, parameters) {
|
|
59
|
+
var self = this;
|
|
60
|
+
function handleResponse(result) {
|
|
61
|
+
success(fromJsonList(self, result, { makesDirty: false }));
|
|
62
|
+
}
|
|
63
|
+
getList(this.resource, handleResponse, error, parameters || {});
|
|
64
|
+
};
|
|
65
|
+
}
|
package/src/merchi.js
CHANGED
|
@@ -54,6 +54,7 @@ import { Invoice, Invoices } from './invoice.js';
|
|
|
54
54
|
import { Job, Jobs } from './job.js';
|
|
55
55
|
import { JobComment } from './job_comment.js';
|
|
56
56
|
import { JobNote } from './job_note.js';
|
|
57
|
+
import { JobOperationLog, JobOperationLogs } from './job_operation_log.js';
|
|
57
58
|
import { MerchiFile, MerchiFiles } from './merchi_file.js';
|
|
58
59
|
import { Menu } from './menu.js';
|
|
59
60
|
import { MenuItem } from './menu_item.js';
|
|
@@ -96,6 +97,12 @@ import {
|
|
|
96
97
|
normalizeProductReviewApiJson,
|
|
97
98
|
wireProductReviewCreateBody,
|
|
98
99
|
} from './product_review.js';
|
|
100
|
+
import * as pricing from './pricing/index.js';
|
|
101
|
+
|
|
102
|
+
// Pure client-side pricing calculator (mirrors merchi_sdk_ts `pricing`):
|
|
103
|
+
// estimateQuote, resolveVisibleFields, resolveVisibleOptionIds,
|
|
104
|
+
// resolveUnavailableOptionIds, applyDiscount, roundHalfEven.
|
|
105
|
+
export { pricing };
|
|
99
106
|
|
|
100
107
|
export function merchi(backendUri, websocketUri) {
|
|
101
108
|
getGlobal().merchiJsonpHandlers = {};
|
|
@@ -1067,6 +1074,8 @@ export function merchi(backendUri, websocketUri) {
|
|
|
1067
1074
|
'jobs': new Jobs(),
|
|
1068
1075
|
'JobComment': JobComment,
|
|
1069
1076
|
'JobNote': JobNote,
|
|
1077
|
+
'JobOperationLog': JobOperationLog,
|
|
1078
|
+
'jobOperationLogs': new JobOperationLogs(),
|
|
1070
1079
|
'Cart': Cart,
|
|
1071
1080
|
'CartItem': CartItem,
|
|
1072
1081
|
'Bank': Bank,
|
package/src/notification.js
CHANGED
|
@@ -26,6 +26,7 @@ export function Notification() {
|
|
|
26
26
|
addPropertyTo(this, 'relatedJob', Job);
|
|
27
27
|
addPropertyTo(this, 'attachment', MerchiFile);
|
|
28
28
|
addPropertyTo(this, 'seen');
|
|
29
|
+
addPropertyTo(this, 'emailOpenedAt');
|
|
29
30
|
addPropertyTo(this, 'htmlMessage');
|
|
30
31
|
addPropertyTo(this, 'description');
|
|
31
32
|
addPropertyTo(this, 'urgency');
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bundle": {
|
|
3
|
+
"currency": "AUD",
|
|
4
|
+
"fields": [
|
|
5
|
+
{
|
|
6
|
+
"fieldType": 2,
|
|
7
|
+
"id": 13,
|
|
8
|
+
"independent": true,
|
|
9
|
+
"isSelectable": true,
|
|
10
|
+
"options": [
|
|
11
|
+
{
|
|
12
|
+
"default": true,
|
|
13
|
+
"id": 9,
|
|
14
|
+
"originalId": null,
|
|
15
|
+
"position": 1,
|
|
16
|
+
"selectedBy": [],
|
|
17
|
+
"variationCost": 0.0,
|
|
18
|
+
"variationCostDiscountGroup": null,
|
|
19
|
+
"variationUnitCost": 0.0,
|
|
20
|
+
"variationUnitCostDiscountGroup": null
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"default": false,
|
|
24
|
+
"id": 10,
|
|
25
|
+
"originalId": null,
|
|
26
|
+
"position": 2,
|
|
27
|
+
"selectedBy": [],
|
|
28
|
+
"variationCost": 0.0,
|
|
29
|
+
"variationCostDiscountGroup": null,
|
|
30
|
+
"variationUnitCost": 13.0,
|
|
31
|
+
"variationUnitCostDiscountGroup": null
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"originalId": null,
|
|
35
|
+
"position": 1,
|
|
36
|
+
"selectedBy": [],
|
|
37
|
+
"variationCost": 0.0,
|
|
38
|
+
"variationCostDiscountGroup": null,
|
|
39
|
+
"variationUnitCost": 0.0,
|
|
40
|
+
"variationUnitCostDiscountGroup": null
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"fieldType": 1,
|
|
44
|
+
"id": 15,
|
|
45
|
+
"independent": true,
|
|
46
|
+
"isSelectable": false,
|
|
47
|
+
"options": [],
|
|
48
|
+
"originalId": null,
|
|
49
|
+
"position": 1,
|
|
50
|
+
"selectedBy": [
|
|
51
|
+
10
|
|
52
|
+
],
|
|
53
|
+
"variationCost": 0.0,
|
|
54
|
+
"variationCostDiscountGroup": null,
|
|
55
|
+
"variationUnitCost": 0.0,
|
|
56
|
+
"variationUnitCostDiscountGroup": null
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"groupFields": [
|
|
60
|
+
{
|
|
61
|
+
"fieldType": 3,
|
|
62
|
+
"id": 14,
|
|
63
|
+
"independent": false,
|
|
64
|
+
"isSelectable": false,
|
|
65
|
+
"options": [],
|
|
66
|
+
"originalId": null,
|
|
67
|
+
"position": 2,
|
|
68
|
+
"selectedBy": [],
|
|
69
|
+
"variationCost": 0.0,
|
|
70
|
+
"variationCostDiscountGroup": null,
|
|
71
|
+
"variationUnitCost": 0.0,
|
|
72
|
+
"variationUnitCostDiscountGroup": null
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"hasGroups": true,
|
|
76
|
+
"product": {
|
|
77
|
+
"discountGroup": {
|
|
78
|
+
"discounts": [
|
|
79
|
+
{
|
|
80
|
+
"amount": 10.0,
|
|
81
|
+
"lowerLimit": 400.0
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"groupRestricted": false
|
|
85
|
+
},
|
|
86
|
+
"minimumPrice": 0.0,
|
|
87
|
+
"unitPrice": 30.0
|
|
88
|
+
},
|
|
89
|
+
"taxPercent": 10.0
|
|
90
|
+
},
|
|
91
|
+
"expected": {
|
|
92
|
+
"cost": 150.0,
|
|
93
|
+
"costPerUnit": 30.0,
|
|
94
|
+
"groupCosts": [],
|
|
95
|
+
"taxAmount": 15.0,
|
|
96
|
+
"totalCost": 165.0,
|
|
97
|
+
"visibleFieldIds": [
|
|
98
|
+
13
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
"name": "conditional_field_hidden",
|
|
102
|
+
"selections": {
|
|
103
|
+
"fieldValues": {
|
|
104
|
+
"13": {
|
|
105
|
+
"selectedOptionIds": [
|
|
106
|
+
9
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"quantity": 5
|
|
111
|
+
}
|
|
112
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bundle": {
|
|
3
|
+
"currency": "AUD",
|
|
4
|
+
"fields": [
|
|
5
|
+
{
|
|
6
|
+
"fieldType": 2,
|
|
7
|
+
"id": 13,
|
|
8
|
+
"independent": true,
|
|
9
|
+
"isSelectable": true,
|
|
10
|
+
"options": [
|
|
11
|
+
{
|
|
12
|
+
"default": true,
|
|
13
|
+
"id": 9,
|
|
14
|
+
"originalId": null,
|
|
15
|
+
"position": 1,
|
|
16
|
+
"selectedBy": [],
|
|
17
|
+
"variationCost": 0.0,
|
|
18
|
+
"variationCostDiscountGroup": null,
|
|
19
|
+
"variationUnitCost": 0.0,
|
|
20
|
+
"variationUnitCostDiscountGroup": null
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"default": false,
|
|
24
|
+
"id": 10,
|
|
25
|
+
"originalId": null,
|
|
26
|
+
"position": 2,
|
|
27
|
+
"selectedBy": [],
|
|
28
|
+
"variationCost": 0.0,
|
|
29
|
+
"variationCostDiscountGroup": null,
|
|
30
|
+
"variationUnitCost": 13.0,
|
|
31
|
+
"variationUnitCostDiscountGroup": null
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"originalId": null,
|
|
35
|
+
"position": 1,
|
|
36
|
+
"selectedBy": [],
|
|
37
|
+
"variationCost": 0.0,
|
|
38
|
+
"variationCostDiscountGroup": null,
|
|
39
|
+
"variationUnitCost": 0.0,
|
|
40
|
+
"variationUnitCostDiscountGroup": null
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"fieldType": 1,
|
|
44
|
+
"id": 15,
|
|
45
|
+
"independent": true,
|
|
46
|
+
"isSelectable": false,
|
|
47
|
+
"options": [],
|
|
48
|
+
"originalId": null,
|
|
49
|
+
"position": 1,
|
|
50
|
+
"selectedBy": [
|
|
51
|
+
10
|
|
52
|
+
],
|
|
53
|
+
"variationCost": 0.0,
|
|
54
|
+
"variationCostDiscountGroup": null,
|
|
55
|
+
"variationUnitCost": 0.0,
|
|
56
|
+
"variationUnitCostDiscountGroup": null
|
|
57
|
+
}
|
|
58
|
+
],
|
|
59
|
+
"groupFields": [
|
|
60
|
+
{
|
|
61
|
+
"fieldType": 3,
|
|
62
|
+
"id": 14,
|
|
63
|
+
"independent": false,
|
|
64
|
+
"isSelectable": false,
|
|
65
|
+
"options": [],
|
|
66
|
+
"originalId": null,
|
|
67
|
+
"position": 2,
|
|
68
|
+
"selectedBy": [],
|
|
69
|
+
"variationCost": 0.0,
|
|
70
|
+
"variationCostDiscountGroup": null,
|
|
71
|
+
"variationUnitCost": 0.0,
|
|
72
|
+
"variationUnitCostDiscountGroup": null
|
|
73
|
+
}
|
|
74
|
+
],
|
|
75
|
+
"hasGroups": true,
|
|
76
|
+
"product": {
|
|
77
|
+
"discountGroup": {
|
|
78
|
+
"discounts": [
|
|
79
|
+
{
|
|
80
|
+
"amount": 10.0,
|
|
81
|
+
"lowerLimit": 400.0
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
"groupRestricted": false
|
|
85
|
+
},
|
|
86
|
+
"minimumPrice": 0.0,
|
|
87
|
+
"unitPrice": 30.0
|
|
88
|
+
},
|
|
89
|
+
"taxPercent": 10.0
|
|
90
|
+
},
|
|
91
|
+
"expected": {
|
|
92
|
+
"cost": 215.0,
|
|
93
|
+
"costPerUnit": 30.0,
|
|
94
|
+
"groupCosts": [],
|
|
95
|
+
"taxAmount": 21.5,
|
|
96
|
+
"totalCost": 236.5,
|
|
97
|
+
"visibleFieldIds": [
|
|
98
|
+
13,
|
|
99
|
+
15
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"name": "conditional_field_visible",
|
|
103
|
+
"selections": {
|
|
104
|
+
"fieldValues": {
|
|
105
|
+
"13": {
|
|
106
|
+
"selectedOptionIds": [
|
|
107
|
+
10
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
"quantity": 5
|
|
112
|
+
}
|
|
113
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bundle": {
|
|
3
|
+
"currency": "AUD",
|
|
4
|
+
"fields": [
|
|
5
|
+
{
|
|
6
|
+
"fieldType": 1,
|
|
7
|
+
"id": 12,
|
|
8
|
+
"independent": true,
|
|
9
|
+
"isSelectable": false,
|
|
10
|
+
"options": [],
|
|
11
|
+
"originalId": null,
|
|
12
|
+
"position": 1,
|
|
13
|
+
"selectedBy": [],
|
|
14
|
+
"variationCost": 11.0,
|
|
15
|
+
"variationCostDiscountGroup": null,
|
|
16
|
+
"variationUnitCost": 0.0,
|
|
17
|
+
"variationUnitCostDiscountGroup": null
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"groupFields": [
|
|
21
|
+
{
|
|
22
|
+
"fieldType": 2,
|
|
23
|
+
"id": 10,
|
|
24
|
+
"independent": false,
|
|
25
|
+
"isSelectable": true,
|
|
26
|
+
"options": [
|
|
27
|
+
{
|
|
28
|
+
"default": true,
|
|
29
|
+
"id": 7,
|
|
30
|
+
"originalId": null,
|
|
31
|
+
"position": 1,
|
|
32
|
+
"selectedBy": [],
|
|
33
|
+
"variationCost": 0.0,
|
|
34
|
+
"variationCostDiscountGroup": null,
|
|
35
|
+
"variationUnitCost": 0.0,
|
|
36
|
+
"variationUnitCostDiscountGroup": null
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"default": false,
|
|
40
|
+
"id": 8,
|
|
41
|
+
"originalId": null,
|
|
42
|
+
"position": 2,
|
|
43
|
+
"selectedBy": [],
|
|
44
|
+
"variationCost": 0.0,
|
|
45
|
+
"variationCostDiscountGroup": null,
|
|
46
|
+
"variationUnitCost": 13.0,
|
|
47
|
+
"variationUnitCostDiscountGroup": null
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"originalId": null,
|
|
51
|
+
"position": 1,
|
|
52
|
+
"selectedBy": [],
|
|
53
|
+
"variationCost": 0.0,
|
|
54
|
+
"variationCostDiscountGroup": null,
|
|
55
|
+
"variationUnitCost": 0.0,
|
|
56
|
+
"variationUnitCostDiscountGroup": null
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"fieldType": 3,
|
|
60
|
+
"id": 11,
|
|
61
|
+
"independent": false,
|
|
62
|
+
"isSelectable": false,
|
|
63
|
+
"options": [],
|
|
64
|
+
"originalId": null,
|
|
65
|
+
"position": 2,
|
|
66
|
+
"selectedBy": [],
|
|
67
|
+
"variationCost": 0.0,
|
|
68
|
+
"variationCostDiscountGroup": null,
|
|
69
|
+
"variationUnitCost": 0.0,
|
|
70
|
+
"variationUnitCostDiscountGroup": null
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"hasGroups": true,
|
|
74
|
+
"product": {
|
|
75
|
+
"discountGroup": {
|
|
76
|
+
"discounts": [
|
|
77
|
+
{
|
|
78
|
+
"amount": 10.0,
|
|
79
|
+
"lowerLimit": 400.0
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"groupRestricted": false
|
|
83
|
+
},
|
|
84
|
+
"minimumPrice": 0.0,
|
|
85
|
+
"unitPrice": 30.0
|
|
86
|
+
},
|
|
87
|
+
"taxPercent": 10.0
|
|
88
|
+
},
|
|
89
|
+
"expected": {
|
|
90
|
+
"cost": 645.0,
|
|
91
|
+
"costPerUnit": 30.0,
|
|
92
|
+
"groupCosts": [
|
|
93
|
+
215.0,
|
|
94
|
+
430.0
|
|
95
|
+
],
|
|
96
|
+
"taxAmount": 64.5,
|
|
97
|
+
"totalCost": 709.5,
|
|
98
|
+
"visibleFieldIds": [
|
|
99
|
+
10,
|
|
100
|
+
11,
|
|
101
|
+
12
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
"name": "group_product",
|
|
105
|
+
"selections": {
|
|
106
|
+
"fieldValues": {},
|
|
107
|
+
"groups": [
|
|
108
|
+
{
|
|
109
|
+
"fieldValues": {
|
|
110
|
+
"10": {
|
|
111
|
+
"selectedOptionIds": [
|
|
112
|
+
8
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
"quantity": 5
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"fieldValues": {
|
|
120
|
+
"10": {
|
|
121
|
+
"selectedOptionIds": [
|
|
122
|
+
8
|
|
123
|
+
]
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
"quantity": 10
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
{
|
|
2
|
+
"bundle": {
|
|
3
|
+
"currency": "AUD",
|
|
4
|
+
"fields": [
|
|
5
|
+
{
|
|
6
|
+
"fieldType": 5,
|
|
7
|
+
"id": 9,
|
|
8
|
+
"independent": true,
|
|
9
|
+
"isSelectable": false,
|
|
10
|
+
"options": [],
|
|
11
|
+
"originalId": null,
|
|
12
|
+
"position": 1,
|
|
13
|
+
"selectedBy": [],
|
|
14
|
+
"variationCost": 25.0,
|
|
15
|
+
"variationCostDiscountGroup": null,
|
|
16
|
+
"variationUnitCost": 5.0,
|
|
17
|
+
"variationUnitCostDiscountGroup": null
|
|
18
|
+
}
|
|
19
|
+
],
|
|
20
|
+
"groupFields": [
|
|
21
|
+
{
|
|
22
|
+
"fieldType": 2,
|
|
23
|
+
"id": 7,
|
|
24
|
+
"independent": false,
|
|
25
|
+
"isSelectable": true,
|
|
26
|
+
"options": [
|
|
27
|
+
{
|
|
28
|
+
"default": true,
|
|
29
|
+
"id": 5,
|
|
30
|
+
"originalId": null,
|
|
31
|
+
"position": 1,
|
|
32
|
+
"selectedBy": [],
|
|
33
|
+
"variationCost": 0.0,
|
|
34
|
+
"variationCostDiscountGroup": null,
|
|
35
|
+
"variationUnitCost": 0.0,
|
|
36
|
+
"variationUnitCostDiscountGroup": null
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"default": false,
|
|
40
|
+
"id": 6,
|
|
41
|
+
"originalId": null,
|
|
42
|
+
"position": 2,
|
|
43
|
+
"selectedBy": [],
|
|
44
|
+
"variationCost": 0.0,
|
|
45
|
+
"variationCostDiscountGroup": null,
|
|
46
|
+
"variationUnitCost": 13.0,
|
|
47
|
+
"variationUnitCostDiscountGroup": null
|
|
48
|
+
}
|
|
49
|
+
],
|
|
50
|
+
"originalId": null,
|
|
51
|
+
"position": 1,
|
|
52
|
+
"selectedBy": [],
|
|
53
|
+
"variationCost": 0.0,
|
|
54
|
+
"variationCostDiscountGroup": null,
|
|
55
|
+
"variationUnitCost": 0.0,
|
|
56
|
+
"variationUnitCostDiscountGroup": null
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"fieldType": 3,
|
|
60
|
+
"id": 8,
|
|
61
|
+
"independent": false,
|
|
62
|
+
"isSelectable": false,
|
|
63
|
+
"options": [],
|
|
64
|
+
"originalId": null,
|
|
65
|
+
"position": 2,
|
|
66
|
+
"selectedBy": [],
|
|
67
|
+
"variationCost": 0.0,
|
|
68
|
+
"variationCostDiscountGroup": null,
|
|
69
|
+
"variationUnitCost": 0.0,
|
|
70
|
+
"variationUnitCostDiscountGroup": null
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"hasGroups": true,
|
|
74
|
+
"product": {
|
|
75
|
+
"discountGroup": {
|
|
76
|
+
"discounts": [
|
|
77
|
+
{
|
|
78
|
+
"amount": 10.0,
|
|
79
|
+
"lowerLimit": 400.0
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
"groupRestricted": false
|
|
83
|
+
},
|
|
84
|
+
"minimumPrice": 0.0,
|
|
85
|
+
"unitPrice": 30.0
|
|
86
|
+
},
|
|
87
|
+
"taxPercent": 10.0
|
|
88
|
+
},
|
|
89
|
+
"expected": {
|
|
90
|
+
"cost": 375.0,
|
|
91
|
+
"costPerUnit": 30.0,
|
|
92
|
+
"groupCosts": [],
|
|
93
|
+
"taxAmount": 37.5,
|
|
94
|
+
"totalCost": 412.5,
|
|
95
|
+
"visibleFieldIds": [
|
|
96
|
+
9
|
|
97
|
+
]
|
|
98
|
+
},
|
|
99
|
+
"name": "non_selectable_number_field",
|
|
100
|
+
"selections": {
|
|
101
|
+
"fieldValues": {
|
|
102
|
+
"9": {
|
|
103
|
+
"value": "7"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"quantity": 10
|
|
107
|
+
}
|
|
108
|
+
}
|