@passly-nl/data 1.0.0-rc.0 → 1.0.0-rc.10

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.
@@ -3,7 +3,7 @@ import type { ApexOptions } from 'apexcharts';
3
3
 
4
4
  export class MerchantStatisticsService extends BaseService {
5
5
  async getRevenueTrend(merchantId: string): Promise<BaseResponse<ApexOptions>> {
6
- return this
6
+ return await this
7
7
  .request(`/merchants/${merchantId}/statistics/revenue-trend`)
8
8
  .method('get')
9
9
  .queryString(QueryString.builder()
@@ -11,4 +11,14 @@ export class MerchantStatisticsService extends BaseService {
11
11
  .bearerToken()
12
12
  .run();
13
13
  }
14
+
15
+ async getStatus(merchantId: string): Promise<BaseResponse<boolean>> {
16
+ return await this
17
+ .request(`/merchants/${merchantId}/statistics/status`)
18
+ .method('get')
19
+ .queryString(QueryString.builder()
20
+ .append('language', 'nl'))
21
+ .bearerToken()
22
+ .run();
23
+ }
14
24
  }
@@ -21,6 +21,15 @@ export class PublicOrderService extends BaseService {
21
21
  .runArrayAdapter(PublicPayAdapter.parsePublicPaymentMethod);
22
22
  }
23
23
 
24
+ async postCancel(orderId: string): Promise<BaseResponse<OrderDto>> {
25
+ return await this
26
+ .request(`/orders/${orderId}/cancel`)
27
+ .method('post')
28
+ .queryString(QueryString.builder()
29
+ .append('language', 'nl'))
30
+ .runAdapter(OrderAdapter.parseOrder);
31
+ }
32
+
24
33
  async postPay(orderId: string, paymentMethodId: string): Promise<BaseResponse<TransactionDto>> {
25
34
  return await this
26
35
  .request(`/orders/${orderId}/pay`)
@@ -3,6 +3,7 @@ import type { DateTime } from 'luxon';
3
3
  import { OrderAdapter, PublicShopAdapter } from '#data/adapter';
4
4
  import type { OrderDto, PublicShopCartProductDto, PublicShopDto, PublicShopReservationDto } from '#data/dto';
5
5
  import type { Gender } from '#data/types';
6
+ import { emptyNull } from '#data/util';
6
7
 
7
8
  export class PublicShopService extends BaseService {
8
9
  async get(shopId: string): Promise<BaseResponse<PublicShopDto>> {
@@ -14,7 +15,25 @@ export class PublicShopService extends BaseService {
14
15
  .runAdapter(PublicShopAdapter.parsePublicShop);
15
16
  }
16
17
 
17
- async buy(shopId: string, reservationId: string, firstName: string, lastName: string, email: string, phoneNumber: string, dateOfBirth: DateTime | null, gender: Gender | null): Promise<BaseResponse<OrderDto>> {
18
+ async buy(shopId: string, reservationId: string, firstName: string, lastName: string, email: string, phoneNumber: string, dateOfBirth: DateTime | null, gender: Gender | null, addressCity: string | null, addressCountry: string | null, addressNumber: string | null, addressPostalCode: string | null, addressStreet: string | null): Promise<BaseResponse<OrderDto>> {
19
+ let address: Record<string, string | null> = null;
20
+
21
+ addressCity = emptyNull(addressCity);
22
+ addressCountry = emptyNull(addressCountry);
23
+ addressNumber = emptyNull(addressNumber);
24
+ addressPostalCode = emptyNull(addressPostalCode);
25
+ addressStreet = emptyNull(addressStreet);
26
+
27
+ if (addressCity || addressCountry || addressNumber || addressPostalCode || addressStreet) {
28
+ address = {
29
+ city: addressCity,
30
+ country_code: addressCountry,
31
+ number: addressNumber,
32
+ postal_code: addressPostalCode,
33
+ street: addressStreet
34
+ }
35
+ }
36
+
18
37
  return await this
19
38
  .request(`/shops/${shopId}/buy/${reservationId}`)
20
39
  .method('post')
@@ -26,7 +45,8 @@ export class PublicShopService extends BaseService {
26
45
  email: email,
27
46
  phone_number: phoneNumber.trim() === '' ? null : phoneNumber.trim(),
28
47
  date_of_birth: dateOfBirth?.toISODate(),
29
- gender: gender
48
+ gender: gender,
49
+ address
30
50
  })
31
51
  .runAdapter(OrderAdapter.parseOrder);
32
52
  }
@@ -1,4 +1,5 @@
1
1
  import { type BaseResponse, BaseService, QueryString } from '@basmilius/http-client';
2
+ import { ServiceInfoDto } from '#data/dto';
2
3
 
3
4
  export class ServicesService extends BaseService {
4
5
  async checkEmail(email: string): Promise<BaseResponse<CheckEmailResponse>> {
@@ -10,6 +11,15 @@ export class ServicesService extends BaseService {
10
11
  .append('language', 'nl'))
11
12
  .run();
12
13
  }
14
+
15
+ async getInfo(): Promise<BaseResponse<ServiceInfoDto>> {
16
+ return await this
17
+ .request('/service/info')
18
+ .method('get')
19
+ .queryString(QueryString.builder()
20
+ .append('language', 'nl'))
21
+ .run();
22
+ }
13
23
  }
14
24
 
15
25
  type CheckEmailResponse = {
@@ -5,6 +5,8 @@ export * from './MerchantsService';
5
5
  export * from './MerchantBuyerService';
6
6
  export * from './MerchantBuyersService';
7
7
  export * from './MerchantDashboardService';
8
+ export * from './MerchantEventAppTeamService';
9
+ export * from './MerchantEventAppTeamsService';
8
10
  export * from './MerchantEventProductService';
9
11
  export * from './MerchantEventProductsService';
10
12
  export * from './MerchantEventService';
@@ -20,6 +22,8 @@ export * from './MerchantFinanceInvoicesService';
20
22
  export * from './MerchantFinanceService';
21
23
  export * from './MerchantOrderService';
22
24
  export * from './MerchantOrdersService';
25
+ export * from './MerchantShopService';
26
+ export * from './MerchantShopsService';
23
27
  export * from './MerchantStatisticsService';
24
28
  export * from './MerchantStatisticsBuyersService';
25
29
  export * from './MerchantStatisticsEventsService';
@@ -18,6 +18,11 @@ export type ShopElementType =
18
18
  | 'product'
19
19
  | 'text';
20
20
 
21
+ export type ShopAddressMode =
22
+ | 'full'
23
+ | 'city'
24
+ | 'postal_code_number';
25
+
21
26
  export type ShopFieldRequirement =
22
27
  | 'disabled'
23
28
  | 'enabled'