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.0.0
|
20 | */
|
21 |
|
22 | const Customer = require('./Customer.js').Customer;
|
23 | const MoneyValue = require('./MoneyValue.js').MoneyValue;
|
24 |
|
25 | class Payment {
|
26 |
|
27 | /**
|
28 | * Constructs a Payment based on its enclosed builder.
|
29 | * @constructor
|
30 | * @param {Builder} builder the Payment builder
|
31 | */
|
32 | constructor(builder) {
|
33 | /**
|
34 | * The date-time when this object was created. The JSON representation must be in RFC339 / ISO8601 format
|
35 | * @type {string}
|
36 | */
|
37 | this.createdAt = undefined;
|
38 |
|
39 | /**
|
40 | * The date-time when this object was last modified. The JSON representation must be in RFC339 / ISO8601 format
|
41 | * @type {string}
|
42 | */
|
43 | this.lastModifiedAt = undefined;
|
44 |
|
45 | /**
|
46 | * The id of the payment.
|
47 | * @type {string}
|
48 | */
|
49 | this.id = builder.id;
|
50 |
|
51 | /**
|
52 | * The customer the payment belongs to. If this is not set the payment belongs to an anonymous customer.
|
53 | * @type {Customer}
|
54 | */
|
55 | this.customer = undefined;
|
56 |
|
57 | /**
|
58 | * The method for this payment like Card or Cash.
|
59 | * @type {string}
|
60 | */
|
61 | this.method = builder.method;
|
62 |
|
63 | /**
|
64 | * The value of the payment.
|
65 | * @type {MoneyValue}
|
66 | */
|
67 | this.value = undefined;
|
68 |
|
69 | /**
|
70 | * The token used to communicate with the payment service provider.
|
71 | * @type {string}
|
72 | */
|
73 | this.token = undefined;
|
74 |
|
75 | /**
|
76 | * The external status code for the payment.
|
77 | * @type {string}
|
78 | */
|
79 | this.statusCode = undefined;
|
80 |
|
81 | /**
|
82 | * The external status message/text for the payment.
|
83 | * @type {string}
|
84 | */
|
85 | this.status = undefined;
|
86 |
|
87 | }
|
88 |
|
89 | /**
|
90 | * Builds a Payment based on API required properties.
|
91 | */
|
92 | static get Builder() {
|
93 | class Builder {
|
94 | withId(id) {
|
95 | this.id = id;
|
96 | return this;
|
97 | }
|
98 |
|
99 | withMethod(method) {
|
100 | this.method = method;
|
101 | return this;
|
102 | }
|
103 |
|
104 | build() {
|
105 | return new Payment(this);
|
106 | }
|
107 | }
|
108 | return Builder;
|
109 | }
|
110 | }
|
111 | module.exports.Payment = Payment;
|