@passly-nl/data 1.3.2 → 1.3.4
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/dist/index.d.mts +18 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +41 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/adapter/OrderAdapter.ts +1 -0
- package/src/adapter/RefundAdapter.ts +8 -1
- package/src/dto/order/OrderDto.ts +12 -2
- package/src/dto/refund/RefundabilityDto.ts +29 -0
- package/src/dto/refund/index.ts +1 -0
- package/src/service/MerchantOrderService.ts +9 -1
- package/src/types/order.ts +5 -0
- package/src/types/refund.ts +6 -0
package/package.json
CHANGED
|
@@ -17,6 +17,7 @@ export class OrderAdapter {
|
|
|
17
17
|
optional(data.payment_provider, OrderAdapter.parseOrderPaymentProvider),
|
|
18
18
|
optional(data.platform_cost, PaymentAdapter.parseCost)!,
|
|
19
19
|
optional(data.refunded_total, PaymentAdapter.parseCost)!,
|
|
20
|
+
data.refund_status,
|
|
20
21
|
optional(data.sub_total, PaymentAdapter.parseCost)!,
|
|
21
22
|
optional(data.total, PaymentAdapter.parseCost)!,
|
|
22
23
|
data.url,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { adapter, ForeignData } from '@basmilius/http-client';
|
|
2
2
|
import { DateTimeAdapter, PaymentAdapter } from '#data/adapter';
|
|
3
|
-
import { RefundDto, RefundInitiatorDto, RefundTicketRefDto } from '#data/dto';
|
|
3
|
+
import { RefundabilityDto, RefundDto, RefundInitiatorDto, RefundTicketRefDto } from '#data/dto';
|
|
4
4
|
import { optional } from '#data/util';
|
|
5
5
|
|
|
6
6
|
@adapter
|
|
@@ -18,6 +18,13 @@ export class RefundAdapter {
|
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
static parseRefundability(data: ForeignData): RefundabilityDto {
|
|
22
|
+
return new RefundabilityDto(
|
|
23
|
+
data.supported,
|
|
24
|
+
data.reason
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
21
28
|
static parseRefundInitiator(data: ForeignData): RefundInitiatorDto {
|
|
22
29
|
return new RefundInitiatorDto(
|
|
23
30
|
data.id,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dto } from '@basmilius/http-client';
|
|
2
2
|
import type { DateTime } from 'luxon';
|
|
3
3
|
import type { BuyerDto, CostDto, EventDto, MarketingAttributionDto, OrderLineDto, OrderPaymentProviderDto, PublicShopDto, TransactionDto } from '#data/dto';
|
|
4
|
-
import type { OrderOrigin, OrderType } from '#data/types';
|
|
4
|
+
import type { OrderOrigin, OrderRefundStatus, OrderType } from '#data/types';
|
|
5
5
|
|
|
6
6
|
@dto
|
|
7
7
|
export class OrderDto {
|
|
@@ -85,6 +85,14 @@ export class OrderDto {
|
|
|
85
85
|
this.#refundedTotal = value;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
get refundStatus(): OrderRefundStatus {
|
|
89
|
+
return this.#refundStatus;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
set refundStatus(value: OrderRefundStatus) {
|
|
93
|
+
this.#refundStatus = value;
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
get subTotal(): CostDto {
|
|
89
97
|
return this.#subTotal;
|
|
90
98
|
}
|
|
@@ -167,6 +175,7 @@ export class OrderDto {
|
|
|
167
175
|
#paymentProvider: OrderPaymentProviderDto | null;
|
|
168
176
|
#platformCost: CostDto;
|
|
169
177
|
#refundedTotal: CostDto;
|
|
178
|
+
#refundStatus: OrderRefundStatus;
|
|
170
179
|
#subTotal: CostDto;
|
|
171
180
|
#total: CostDto;
|
|
172
181
|
#url: string;
|
|
@@ -177,7 +186,7 @@ export class OrderDto {
|
|
|
177
186
|
#transaction: TransactionDto | null;
|
|
178
187
|
#attribution: MarketingAttributionDto | null;
|
|
179
188
|
|
|
180
|
-
constructor(id: string, code: string, origin: OrderOrigin, type: OrderType, createdOn: DateTime, discountAmount: CostDto | null, discountCodeApplied: string | null, paymentProvider: OrderPaymentProviderDto | null, platformCost: CostDto, refundedTotal: CostDto, subTotal: CostDto, total: CostDto, url: string, buyer: BuyerDto | null, event: EventDto | null, lines: OrderLineDto[] | null, shop: PublicShopDto | null, transaction: TransactionDto | null, attribution: MarketingAttributionDto | null) {
|
|
189
|
+
constructor(id: string, code: string, origin: OrderOrigin, type: OrderType, createdOn: DateTime, discountAmount: CostDto | null, discountCodeApplied: string | null, paymentProvider: OrderPaymentProviderDto | null, platformCost: CostDto, refundedTotal: CostDto, refundStatus: OrderRefundStatus, subTotal: CostDto, total: CostDto, url: string, buyer: BuyerDto | null, event: EventDto | null, lines: OrderLineDto[] | null, shop: PublicShopDto | null, transaction: TransactionDto | null, attribution: MarketingAttributionDto | null) {
|
|
181
190
|
this.#id = id;
|
|
182
191
|
this.#code = code;
|
|
183
192
|
this.#origin = origin;
|
|
@@ -188,6 +197,7 @@ export class OrderDto {
|
|
|
188
197
|
this.#paymentProvider = paymentProvider;
|
|
189
198
|
this.#platformCost = platformCost;
|
|
190
199
|
this.#refundedTotal = refundedTotal;
|
|
200
|
+
this.#refundStatus = refundStatus;
|
|
191
201
|
this.#subTotal = subTotal;
|
|
192
202
|
this.#total = total;
|
|
193
203
|
this.#url = url;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { dto } from '@basmilius/http-client';
|
|
2
|
+
import type { RefundabilityReason } from '#data/types';
|
|
3
|
+
|
|
4
|
+
@dto
|
|
5
|
+
export class RefundabilityDto {
|
|
6
|
+
get supported(): boolean {
|
|
7
|
+
return this.#supported;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
set supported(value: boolean) {
|
|
11
|
+
this.#supported = value;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get reason(): RefundabilityReason | null {
|
|
15
|
+
return this.#reason;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
set reason(value: RefundabilityReason | null) {
|
|
19
|
+
this.#reason = value;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#supported: boolean;
|
|
23
|
+
#reason: RefundabilityReason | null;
|
|
24
|
+
|
|
25
|
+
constructor(supported: boolean, reason: RefundabilityReason | null) {
|
|
26
|
+
this.#supported = supported;
|
|
27
|
+
this.#reason = reason;
|
|
28
|
+
}
|
|
29
|
+
}
|
package/src/dto/refund/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseResponse, BaseService, BlobResponse, QueryString } from '@basmilius/http-client';
|
|
2
2
|
import { CashFlowAdapter, OrderAdapter, RefundAdapter, TicketAdapter } from '#data/adapter';
|
|
3
|
-
import type { CashFlowDto, OrderDto, RefundDto, TicketDto } from '#data/dto';
|
|
3
|
+
import type { CashFlowDto, OrderDto, RefundabilityDto, RefundDto, TicketDto } from '#data/dto';
|
|
4
4
|
import type { RefundReason } from '#data/types';
|
|
5
5
|
|
|
6
6
|
export class MerchantOrderService extends BaseService {
|
|
@@ -24,6 +24,14 @@ export class MerchantOrderService extends BaseService {
|
|
|
24
24
|
.runAdapter(CashFlowAdapter.parseCashFlow);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
async getRefundability(merchantId: string, orderId: string): Promise<BaseResponse<RefundabilityDto>> {
|
|
28
|
+
return await this
|
|
29
|
+
.request(`/merchants/${merchantId}/orders/${orderId}/refundability`)
|
|
30
|
+
.method('get')
|
|
31
|
+
.bearerToken()
|
|
32
|
+
.runAdapter(RefundAdapter.parseRefundability);
|
|
33
|
+
}
|
|
34
|
+
|
|
27
35
|
async getPasses(merchantId: string, orderId: string): Promise<BlobResponse> {
|
|
28
36
|
return await this
|
|
29
37
|
.request(`/merchants/${merchantId}/orders/${orderId}/passes`)
|
package/src/types/order.ts
CHANGED