UNPKG

2.63 kBJavaScriptView Raw
1/*******************************************************************************
2 *
3 * Copyright 2018 Adobe. All rights reserved.
4 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. You may obtain a copy
6 * of the License at http://www.apache.org/licenses/LICENSE-2.0
7 *
8 * Unless required by applicable law or agreed to in writing, software distributed under
9 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
10 * OF ANY KIND, either express or implied. See the License for the specific language
11 * governing permissions and limitations under the License.
12 *
13 ******************************************************************************/
14
15/**
16 * Auto generated code based on Swagger definition.
17 * Dot not edit manually. Manual changes will be overridden.
18 *
19 * @version 1.1.2
20 */
21const MoneyValue = require('./MoneyValue.js').MoneyValue;
22const TaxInfo = require('./TaxInfo.js').TaxInfo;
23
24class ShippingInfo {
25
26 /**
27 * Constructs a ShippingInfo based on its enclosed builder.
28 * @constructor
29 * @param {Builder} builder the ShippingInfo builder
30 */
31 constructor(builder) {
32
33 /**
34 * The cost of the shipping.
35 * @type {MoneyValue}
36 */
37 this.cost = builder.cost;
38
39 /**
40 * The discounted shipping cost.
41 * @type {MoneyValue}
42 */
43 this.discountedCost = undefined;
44
45 /**
46 * The shipping method id.
47 * @type {string}
48 */
49 this.id = builder.id;
50
51 /**
52 * The shipping method name.
53 * @type {string}
54 */
55 this.name = builder.name;
56
57 /**
58 * The tax for the shipping.
59 * @type {TaxInfo}
60 */
61 this.taxInfo = builder.taxInfo;
62 }
63
64 /**
65 * Builds a ShippingInfo based on API required properties.
66 */
67 static get Builder() {
68 class Builder {
69
70 withCost(cost) {
71 this.cost = cost;
72 return this;
73 }
74
75 withId(id) {
76 this.id = id;
77 return this;
78 }
79
80 withName(name) {
81 this.name = name;
82 return this;
83 }
84
85 withTaxInfo(taxInfo) {
86 this.taxInfo = taxInfo;
87 return this;
88 }
89
90 build() {
91 return new ShippingInfo(this);
92 }
93 }
94 return Builder;
95 }
96}
97module.exports.ShippingInfo = ShippingInfo;