-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFunctionsRef.ts
160 lines (155 loc) · 6 KB
/
FunctionsRef.ts
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
import {
CancelOrderPayload,
CompleteDeliveryPayload,
DeletePaymentMethodPayload,
DropOrderPayload,
Fare,
FetchAccountInformationPayload,
FetchAccountInformationResponse,
FetchAdvanceByAmountSimulationPayload,
FetchAdvanceSimulationPayload,
FetchReceivablesPayload,
GetCancellationInfoPayload,
GetCancellationInfoResult,
GetOrderQuotesPayload,
MatchOrderPayload,
NextDispatchingStatePayload,
PlaceOrderPayload,
QueryGoogleMapsPayload,
RejectOrderPayload,
RequestWithdrawPayload,
SavePaymentTokenPayload,
SavePaymentTokenResponse,
TipCourierPayload,
UpdateOrderPayload,
} from '@appjusto/types';
import {
IuguMarketplaceAccountAdvanceByAmountSimulation,
IuguMarketplaceAccountAdvanceSimulation,
IuguMarketplaceAccountReceivables,
IuguMarketplaceAccountWithdrawResponse,
} from '@appjusto/types/payment/iugu';
import { getFunctions, httpsCallable } from 'firebase/functions';
export class FunctionsRef {
constructor() {}
getVerifyProfileCallable = () =>
httpsCallable(getFunctions(), 'verifyProfile');
getFetchAccountInformationCallable = () =>
httpsCallable<
FetchAccountInformationPayload,
FetchAccountInformationResponse
>(getFunctions(), 'fetchAccountInformation');
getFetchReceivablesCallable = () =>
httpsCallable<FetchReceivablesPayload, IuguMarketplaceAccountReceivables>(
getFunctions(),
'fetchReceivables'
);
getFetchAdvanceSimulationCallable = () =>
httpsCallable<
FetchAdvanceSimulationPayload,
IuguMarketplaceAccountAdvanceSimulation
>(getFunctions(), 'fetchAdvanceSimulation');
getFetchAdvanceByAmountSimulationCallable = () =>
httpsCallable<
FetchAdvanceByAmountSimulationPayload,
IuguMarketplaceAccountAdvanceByAmountSimulation
>(getFunctions(), 'fetchAdvanceByAmountSimulation');
getRequestWithdrawCallable = () =>
httpsCallable<
RequestWithdrawPayload,
IuguMarketplaceAccountWithdrawResponse
>(getFunctions(), 'requestWithdraw');
getAdvanceReceivablesCallable = () =>
httpsCallable(getFunctions(), 'advanceReceivables');
getAdvanceReceivablesByAmountCallable = () =>
httpsCallable(getFunctions(), 'advanceReceivablesByAmount');
getDeleteAccountCallable = () =>
httpsCallable(getFunctions(), 'deleteAccount');
getServerTimeCallable = () => httpsCallable(getFunctions(), 'getServerTime');
// consumer
getSavePaymentTokenCallable = () =>
httpsCallable<SavePaymentTokenPayload, SavePaymentTokenResponse>(
getFunctions(),
'savePaymentToken'
);
getDeletePaymentMethodCallable = () =>
httpsCallable<DeletePaymentMethodPayload, void>(
getFunctions(),
'deletePaymentMethod'
);
getCreateOrderCallable = () => httpsCallable(getFunctions(), 'createOrder');
getGetOrderQuotesCallable = () =>
httpsCallable<GetOrderQuotesPayload, Fare[]>(
getFunctions(),
'getOrderQuotes'
);
getPlaceOrderCallable = () =>
httpsCallable<PlaceOrderPayload, void>(getFunctions(), 'placeOrder');
getCancelOrderCallable = () =>
httpsCallable<CancelOrderPayload, void>(getFunctions(), 'cancelOrder');
getTipCourierCallable = () =>
httpsCallable<TipCourierPayload, void>(getFunctions(), 'tipCourier');
getCancellationInfoCallable = () =>
httpsCallable<GetCancellationInfoPayload, GetCancellationInfoResult>(
getFunctions(),
'getCancellationInfo'
);
getUpdateOrderCallable = () =>
httpsCallable<UpdateOrderPayload, void>(getFunctions(), 'updateOrder');
getQueryGoogleMapsCallable = () =>
httpsCallable<QueryGoogleMapsPayload, any>(
getFunctions(),
'queryGoogleMaps'
);
// courier
getMatchOrderCallable = () =>
httpsCallable<MatchOrderPayload, void>(getFunctions(), 'matchOrder');
getRejectOrderCallable = () =>
httpsCallable<RejectOrderPayload, void>(getFunctions(), 'rejectOrder');
getDropOrderCallable = () =>
httpsCallable<DropOrderPayload, void>(getFunctions(), 'dropOrder');
getNextDispatchingStateCallable = () =>
httpsCallable<NextDispatchingStatePayload, void>(
getFunctions(),
'nextDispatchingState'
);
getCompleteDeliveryCallable = () =>
httpsCallable<CompleteDeliveryPayload, void>(
getFunctions(),
'completeDelivery'
);
// storage
// courier
getCourierSelfiePath = (courierId: string, size?: string) =>
`couriers/${courierId}/selfie${size ? `_${size}` : ''}.jpg`;
getCourierDocumentPath = (courierId: string, size?: string) =>
`couriers/${courierId}/document${size ? `_${size}` : ''}.jpg`;
// orders
getOrderPODPackagePath = (orderId: string, courierId: string) =>
`orders/${orderId}/${courierId}/package.jpg`;
getOrderPODFrontPath = (orderId: string, courierId: string) =>
`orders/${orderId}/${courierId}/front.jpg`;
// business
getBusinessStoragePath = (businessId: string) => `businesses/${businessId}`;
getBusinessLogoUploadStoragePath = (businessId: string) =>
`${this.getBusinessStoragePath(businessId)}/logo.jpg`;
getBusinessLogoStoragePath = (businessId: string) =>
`${this.getBusinessStoragePath(businessId)}/logo_240x240.jpg`;
getBusinessCoverUploadStoragePath = (businessId: string) =>
`${this.getBusinessStoragePath(businessId)}/cover.jpg`;
getBusinessCoverStoragePath = (businessId: string) =>
`${this.getBusinessStoragePath(businessId)}/cover_1008x360.jpg`;
getProductsStoragePath = (businessId: string) =>
`${this.getBusinessStoragePath(businessId)}/products`;
getProductImageStoragePath = (
businessId: string,
productId: string,
size: string
) => `${this.getProductsStoragePath(businessId)}/${productId}_${size}.jpg`;
getComplementsStoragePath = (businessId: string) =>
`${this.getBusinessStoragePath(businessId)}/complements`;
getComplementUploadStoragePath = (businessId: string, complementId: string) =>
`${this.getComplementsStoragePath(businessId)}/${complementId}_288x288.jpg`;
getComplementImageStoragePath = (businessId: string, complementId: string) =>
`${this.getComplementsStoragePath(businessId)}/${complementId}_288x288.jpg`;
}