-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathcreate-payment.model.js
More file actions
144 lines (144 loc) · 5.93 KB
/
Copy pathcreate-payment.model.js
File metadata and controls
144 lines (144 loc) · 5.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.CreatePaymentRequest = void 0;
const class_validator_1 = require("class-validator");
const item_model_1 = require("./request-model/item.model");
const customer_model_1 = require("./request-model/customer.model");
const address_model_1 = require("./request-model/address.model");
const callback_url_model_1 = require("./request-model/callback-url.model");
const payment_method_group_model_1 = require("./request-model/payment-method-group.model");
const class_transformer_1 = require("class-transformer");
require("reflect-metadata");
const create_payment_validator_1 = require("../../validators/create-payment.validator");
/**
* Class CreatePaymentRequest
*
* This class is used to create a payment request object
*
* @see https://paytrail.github.io/api-documentation/#/?id=create-request-body
*/
class CreatePaymentRequest {
}
exports.CreatePaymentRequest = CreatePaymentRequest;
__decorate([
(0, class_validator_1.IsNotEmpty)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], CreatePaymentRequest.prototype, "stamp", void 0);
__decorate([
(0, class_validator_1.IsNotEmpty)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], CreatePaymentRequest.prototype, "reference", void 0);
__decorate([
(0, class_validator_1.IsNumber)(),
(0, class_validator_1.IsInt)(),
(0, class_validator_1.IsNotEmpty)(),
(0, class_validator_1.Min)(1),
(0, class_validator_1.Max)(99999999),
__metadata("design:type", Number)
], CreatePaymentRequest.prototype, "amount", void 0);
__decorate([
(0, class_validator_1.IsNotEmpty)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], CreatePaymentRequest.prototype, "currency", void 0);
__decorate([
(0, class_validator_1.IsNotEmpty)(),
(0, class_validator_1.IsString)(),
__metadata("design:type", String)
], CreatePaymentRequest.prototype, "language", void 0);
__decorate([
(0, class_validator_1.IsString)(),
(0, class_validator_1.IsOptional)(),
__metadata("design:type", String)
], CreatePaymentRequest.prototype, "orderId", void 0);
__decorate([
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.ValidateNested)({ each: true }),
(0, class_transformer_1.Type)(() => item_model_1.Item),
(0, create_payment_validator_1.ValidateItemPrices)(),
__metadata("design:type", Array)
], CreatePaymentRequest.prototype, "items", void 0);
__decorate([
(0, class_validator_1.IsNotEmpty)(),
(0, class_validator_1.ValidateNested)({ each: true }),
(0, class_transformer_1.Type)(() => customer_model_1.Customer),
__metadata("design:type", customer_model_1.Customer
/**
* Delivery address.
*/
)
], CreatePaymentRequest.prototype, "customer", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.ValidateNested)(),
(0, class_transformer_1.Type)(() => address_model_1.Address),
__metadata("design:type", address_model_1.Address
/**
* Invoicing address.
*/
)
], CreatePaymentRequest.prototype, "deliveryAddress", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.ValidateNested)(),
(0, class_transformer_1.Type)(() => address_model_1.Address),
__metadata("design:type", address_model_1.Address
/**
* If paid with invoice payment method, the invoice will not be activated automatically immediately.
* Currently only supported with Walley/Collector.
*/
)
], CreatePaymentRequest.prototype, "invoicingAddress", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], CreatePaymentRequest.prototype, "manualInvoiceActivation", void 0);
__decorate([
(0, class_validator_1.ValidateNested)(),
(0, class_validator_1.IsNotEmpty)(),
(0, class_transformer_1.Type)(() => callback_url_model_1.CallbackUrl),
__metadata("design:type", callback_url_model_1.CallbackUrl
/**
* Which url to ping after this payment is paid or cancelled.
*/
)
], CreatePaymentRequest.prototype, "redirectUrls", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.ValidateNested)(),
(0, class_transformer_1.Type)(() => callback_url_model_1.CallbackUrl),
__metadata("design:type", callback_url_model_1.CallbackUrl
/**
* Callback URL polling delay in seconds.
*/
)
], CreatePaymentRequest.prototype, "callbackUrls", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsNumber)(),
__metadata("design:type", Number)
], CreatePaymentRequest.prototype, "callbackDelay", void 0);
__decorate([
(0, class_validator_1.IsArray)(),
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsEnum)(payment_method_group_model_1.PaymentMethodGroup, { each: true }),
__metadata("design:type", Array)
], CreatePaymentRequest.prototype, "groups", void 0);
__decorate([
(0, class_validator_1.IsOptional)(),
(0, class_validator_1.IsBoolean)(),
__metadata("design:type", Boolean)
], CreatePaymentRequest.prototype, "usePricesWithoutVat", void 0);