@monkeyplus/payscope 1.0.0
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/THIRD-PARTY-LICENSES.md +41 -0
- package/dist/_chunks/auth.d.mts +707 -0
- package/dist/_chunks/database.mjs +831 -0
- package/dist/_chunks/db.d.mts +7100 -0
- package/dist/_chunks/index.d.mts +178 -0
- package/dist/_chunks/lib.mjs +3073 -0
- package/dist/_chunks/libs/better-call.d.mts +478 -0
- package/dist/_chunks/libs/postgres.d.mts +1 -0
- package/dist/_chunks/rolldown-runtime.mjs +11 -0
- package/dist/server/db.d.mts +2 -0
- package/dist/server/db.mjs +108 -0
- package/dist/server/env.d.mts +21 -0
- package/dist/server/env.mjs +22 -0
- package/dist/server/lib.d.mts +362 -0
- package/dist/server/lib.mjs +2 -0
- package/dist/server/router.d.mts +1218 -0
- package/dist/server/router.mjs +1157 -0
- package/dist/server/schemas/auth.d.mts +2 -0
- package/dist/server/schemas/auth.mjs +62 -0
- package/package.json +58 -0
- package/storefront/Readme.md +0 -0
- package/storefront/auth.ts +29 -0
- package/storefront/cart/ResumeCart.vue +217 -0
- package/storefront/cart/ResumeCartSelect.vue +32 -0
- package/storefront/cart/ShoppinCart.vue +100 -0
- package/storefront/cart/ShoppinCartItem.vue +99 -0
- package/storefront/checkout/App.vue +36 -0
- package/storefront/checkout/AppCart.vue +72 -0
- package/storefront/checkout/AppCartDiscount.vue +74 -0
- package/storefront/checkout/AppCartTotals.vue +72 -0
- package/storefront/checkout/AppLoading.vue +55 -0
- package/storefront/checkout/composables.ts +28 -0
- package/storefront/checkout/constants.ts +0 -0
- package/storefront/checkout/main.ts +11 -0
- package/storefront/checkout/pages/Address/Address.vue +95 -0
- package/storefront/checkout/pages/Info/Info.vue +94 -0
- package/storefront/checkout/pages/Info/InfoUser.vue +38 -0
- package/storefront/checkout/pages/Pay/Pay.vue +115 -0
- package/storefront/checkout/pages/Pay/Providers/BancoEconomico/BancoEconomico.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Cybersource/Cybersource.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Datafast/Datafast.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Multipago/Multipago.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Pagomedios/Pagomedios.vue +93 -0
- package/storefront/checkout/pages/Pay/Providers/Pagomedios/composable.ts +23 -0
- package/storefront/checkout/pages/Pay/Providers/Paypal/Paypal.vue +168 -0
- package/storefront/checkout/pages/Pay/Providers/Paypal/composable.ts +33 -0
- package/storefront/checkout/pages/Pay/Providers/Placetopay/Placetopay.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/Wabi/Wabi.vue +9 -0
- package/storefront/checkout/pages/Pay/Providers/composable.ts +30 -0
- package/storefront/checkout/pages/Payment/Payment.vue +19 -0
- package/storefront/checkout/pages/Payment/PaymentStatus.vue +187 -0
- package/storefront/checkout/pages/Payment/PaymentStatusDetail.vue +77 -0
- package/storefront/checkout/pages/Payment/composable.ts +81 -0
- package/storefront/checkout/pages/Shipping/Shipping.vue +67 -0
- package/storefront/checkout/pages/StepInfo.vue +37 -0
- package/storefront/checkout/router.ts +59 -0
- package/storefront/index.ts +3 -0
- package/storefront/login/App.vue +9 -0
- package/storefront/login/main.ts +10 -0
- package/storefront/login/pages/SignIn/Login.vue +82 -0
- package/storefront/login/pages/SignUp/SignUp.vue +99 -0
- package/storefront/login/router.ts +15 -0
- package/storefront/product/AddProduct.vue +303 -0
- package/storefront/product/AddProductNumber.vue +62 -0
- package/storefront/product/AddProductVariant.vue +66 -0
- package/storefront/profile/App.vue +88 -0
- package/storefront/profile/main.ts +10 -0
- package/storefront/profile/pages/Addresses/Addresses.vue +79 -0
- package/storefront/profile/pages/Addresses/AddressesForm.vue +95 -0
- package/storefront/profile/pages/Addresses/AddressesModal.vue +24 -0
- package/storefront/profile/pages/Buys/Buys.vue +8 -0
- package/storefront/profile/pages/Me/Me.vue +15 -0
- package/storefront/profile/pages/Me/MeBilling.vue +79 -0
- package/storefront/profile/pages/Me/MeBillingForm.vue +66 -0
- package/storefront/profile/pages/Me/MeBillingModal.vue +24 -0
- package/storefront/profile/pages/Me/MeInfo.vue +75 -0
- package/storefront/profile/pages/Me/MePassword.vue +53 -0
- package/storefront/profile/pages/Me/MeSubscriptions.vue +15 -0
- package/storefront/profile/pages/Returns/Returns.vue +8 -0
- package/storefront/profile/pages/Whislist/Whislist.vue +8 -0
- package/storefront/profile/router.ts +32 -0
- package/storefront/stores.ts +320 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { Checkout, ItemTable, Product, ProductStock, Provider, ResponsePay, Store, Transaction } from "./db.mjs";
|
|
2
|
+
import { Model } from "@monkeyplus/unorm";
|
|
3
|
+
interface CustomerObjectBase<T> {
|
|
4
|
+
id: string;
|
|
5
|
+
customerId: string;
|
|
6
|
+
storeId: number;
|
|
7
|
+
data: T;
|
|
8
|
+
}
|
|
9
|
+
interface Address {
|
|
10
|
+
zip: string;
|
|
11
|
+
city: string;
|
|
12
|
+
phone: string;
|
|
13
|
+
country: string;
|
|
14
|
+
address1: string;
|
|
15
|
+
address2: string;
|
|
16
|
+
lastName: string;
|
|
17
|
+
firstName: string;
|
|
18
|
+
province?: string;
|
|
19
|
+
}
|
|
20
|
+
type CustomerAddress = CustomerObjectBase<Address>;
|
|
21
|
+
interface Discount {
|
|
22
|
+
coupon: string;
|
|
23
|
+
customerId: string;
|
|
24
|
+
storeId: number;
|
|
25
|
+
}
|
|
26
|
+
interface Graphql {
|
|
27
|
+
session: Model;
|
|
28
|
+
checkout: Model<Checkout>;
|
|
29
|
+
transaction: Model<Transaction>;
|
|
30
|
+
refunds: Model;
|
|
31
|
+
products: Model<Product>;
|
|
32
|
+
orders: Model;
|
|
33
|
+
taxes: Model;
|
|
34
|
+
stores: Model<Store>;
|
|
35
|
+
extensions: Model;
|
|
36
|
+
users: Model;
|
|
37
|
+
customers: Model;
|
|
38
|
+
customerBillings: Model;
|
|
39
|
+
customerAddresses: Model<CustomerAddress>;
|
|
40
|
+
customerWhislists: Model;
|
|
41
|
+
customerReturns: Model;
|
|
42
|
+
links: Model;
|
|
43
|
+
productStocks: Model<ProductStock>;
|
|
44
|
+
discounts: Model<Discount>;
|
|
45
|
+
keys: Model;
|
|
46
|
+
namespaceKeys: Model;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Checkout
|
|
50
|
+
*/
|
|
51
|
+
interface OptionsCheckout {
|
|
52
|
+
billingInfo: any;
|
|
53
|
+
shippingInfo: any;
|
|
54
|
+
sessionId?: string;
|
|
55
|
+
}
|
|
56
|
+
type CreateCheckout = (items: ItemTable[], options: OptionsCheckout) => Promise<Checkout>;
|
|
57
|
+
type ReadCheckout = (id: string) => Promise<Checkout>;
|
|
58
|
+
type AssociateCheckout = (id: string, sessionId: string, data?: {
|
|
59
|
+
billingInfo?: any;
|
|
60
|
+
shippingInfo?: any;
|
|
61
|
+
}) => Promise<Checkout>;
|
|
62
|
+
type PreparePayment = (provider: string, body: {
|
|
63
|
+
checkoutId: string;
|
|
64
|
+
sessionId: string;
|
|
65
|
+
description?: string;
|
|
66
|
+
extras?: any;
|
|
67
|
+
}, options?: {
|
|
68
|
+
card?: any;
|
|
69
|
+
[key: string]: any;
|
|
70
|
+
}) => Promise<any>;
|
|
71
|
+
type PostPreparePayment = (provider: string, body: {
|
|
72
|
+
transactionId: string;
|
|
73
|
+
extras?: any;
|
|
74
|
+
}, options?: {
|
|
75
|
+
card?: any;
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
}) => Promise<any>;
|
|
78
|
+
type VerifyPayment = (provider: string, uid: string, override?: boolean) => Promise<any>;
|
|
79
|
+
type RefundPayment = (provider: string, uid: string, options?: any) => Promise<any>;
|
|
80
|
+
interface PayPayment {
|
|
81
|
+
(provider: string, params: {
|
|
82
|
+
uid: string;
|
|
83
|
+
[key: string]: unknown;
|
|
84
|
+
}, checkoutId?: string): Promise<ResponsePay>;
|
|
85
|
+
}
|
|
86
|
+
type WebhookPayment = (provider: string, uid: string, body: any) => Promise<ResponsePay | false>;
|
|
87
|
+
interface SessionOptions {
|
|
88
|
+
email: string;
|
|
89
|
+
identification: string;
|
|
90
|
+
customer: {
|
|
91
|
+
givenName: string;
|
|
92
|
+
middleName?: string;
|
|
93
|
+
surname: string;
|
|
94
|
+
phone?: string;
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
interface Session {
|
|
98
|
+
id: string;
|
|
99
|
+
email: string;
|
|
100
|
+
storeId: number;
|
|
101
|
+
hash: string;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Session
|
|
105
|
+
*/
|
|
106
|
+
type CreateSession = (options: SessionOptions) => Promise<Session>;
|
|
107
|
+
type VerifySession = (options: SessionOptions, hash: string) => Promise<boolean>;
|
|
108
|
+
type CreateTransaction = (payload: {
|
|
109
|
+
checkoutId: string;
|
|
110
|
+
sessionId: string;
|
|
111
|
+
provider: string;
|
|
112
|
+
}) => Promise<Transaction>;
|
|
113
|
+
type ReadTransaction = (id: string) => Promise<Transaction>;
|
|
114
|
+
type UpdateStateTransaction = (poyload: {
|
|
115
|
+
id: string;
|
|
116
|
+
status: 'success' | 'failure' | 'pending' | 'created' | 'refund';
|
|
117
|
+
details: any;
|
|
118
|
+
extras?: any;
|
|
119
|
+
ref?: string;
|
|
120
|
+
}) => Promise<Transaction>;
|
|
121
|
+
type RefundTransaction = (poyload: {
|
|
122
|
+
id: string;
|
|
123
|
+
details: any;
|
|
124
|
+
}) => Promise<Transaction>;
|
|
125
|
+
/**
|
|
126
|
+
* Payment object
|
|
127
|
+
*/
|
|
128
|
+
interface Payment {
|
|
129
|
+
_providers: Record<string, Provider<any>>;
|
|
130
|
+
$graphql: Graphql;
|
|
131
|
+
$tasks: UseTasks;
|
|
132
|
+
providers: string[];
|
|
133
|
+
getStore: () => Promise<Store>;
|
|
134
|
+
session: {
|
|
135
|
+
create: CreateSession;
|
|
136
|
+
verify: VerifySession;
|
|
137
|
+
};
|
|
138
|
+
transaction: {
|
|
139
|
+
create: CreateTransaction;
|
|
140
|
+
read: ReadTransaction;
|
|
141
|
+
updateState: UpdateStateTransaction;
|
|
142
|
+
refund: RefundTransaction;
|
|
143
|
+
};
|
|
144
|
+
checkout: {
|
|
145
|
+
create: CreateCheckout;
|
|
146
|
+
read: ReadCheckout;
|
|
147
|
+
associate: AssociateCheckout;
|
|
148
|
+
};
|
|
149
|
+
payment: {
|
|
150
|
+
prepare: PreparePayment;
|
|
151
|
+
postPrepare: PostPreparePayment;
|
|
152
|
+
pay: PayPayment;
|
|
153
|
+
verify: VerifyPayment;
|
|
154
|
+
refund: RefundPayment;
|
|
155
|
+
webhook?: WebhookPayment;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
interface PaymentOptions {
|
|
159
|
+
storeId: number;
|
|
160
|
+
secret: string;
|
|
161
|
+
providers: Record<string, Provider>;
|
|
162
|
+
graphql: Graphql;
|
|
163
|
+
tasks: {
|
|
164
|
+
url: string;
|
|
165
|
+
headers?: any;
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
interface CreatePayment {
|
|
169
|
+
(options: PaymentOptions): Payment;
|
|
170
|
+
}
|
|
171
|
+
interface UseTasks {
|
|
172
|
+
addJob: (identifier: string, payload: any, spec?: {
|
|
173
|
+
queueName?: string;
|
|
174
|
+
priority?: number;
|
|
175
|
+
runAt?: Date;
|
|
176
|
+
}) => Promise<void>;
|
|
177
|
+
}
|
|
178
|
+
export { CreatePayment, Graphql, Payment, UseTasks };
|