UNPKG

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