autosync_backend2 1.1.17 → 1.1.18

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.ts CHANGED
@@ -364,6 +364,30 @@ declare const app: Elysia<"", {
364
364
  paymentChannel: import("@sinclair/typebox").TString;
365
365
  amount: import("@sinclair/typebox").TNumber;
366
366
  }>;
367
+ readonly "CrmCpOrderPaymentModel.storepay": import("@sinclair/typebox").TObject<{
368
+ state: import("@sinclair/typebox").TEnum<{
369
+ NOT_PAID: "NOT_PAID";
370
+ PENDING: "PENDING";
371
+ FAILED: "FAILED";
372
+ EXPIRED: "EXPIRED";
373
+ PAID: "PAID";
374
+ DECLINED: "DECLINED";
375
+ CANCELED: "CANCELED";
376
+ REFUNDING: "REFUNDING";
377
+ REFUNDED: "REFUNDED";
378
+ }>;
379
+ cpOrderId: import("@sinclair/typebox").TString;
380
+ paymentPackageId: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>>;
381
+ paymentMethod: import("@sinclair/typebox").TEnum<{
382
+ CASH: "CASH";
383
+ BANK_TRANSFER: "BANK_TRANSFER";
384
+ POS_TERMINAL: "POS_TERMINAL";
385
+ PAYMENT_PACKAGE: "PAYMENT_PACKAGE";
386
+ }>;
387
+ paymentChannel: import("@sinclair/typebox").TString;
388
+ amount: import("@sinclair/typebox").TNumber;
389
+ phone: import("@sinclair/typebox").TNumber;
390
+ }>;
367
391
  readonly "CrmCpOrderModel.create": import("@sinclair/typebox").TObject<{
368
392
  phone: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
369
393
  vin: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
@@ -3510,6 +3534,7 @@ declare const app: Elysia<"", {
3510
3534
  post: {
3511
3535
  body: {
3512
3536
  paymentPackageId?: string | null | undefined;
3537
+ phone: number;
3513
3538
  state: "NOT_PAID" | "PENDING" | "FAILED" | "EXPIRED" | "PAID" | "DECLINED" | "CANCELED" | "REFUNDING" | "REFUNDED";
3514
3539
  cpOrderId: string;
3515
3540
  paymentMethod: "CASH" | "BANK_TRANSFER" | "POS_TERMINAL" | "PAYMENT_PACKAGE";
package/dist/index.js CHANGED
@@ -143974,6 +143974,15 @@ var CrmCpOrderPaymentModel;
143974
143974
  ((CrmCpOrderPaymentModel) => {
143975
143975
  const createSchema = createInsertSchema(crmCpOrderPaymentTable);
143976
143976
  CrmCpOrderPaymentModel.create = t.Omit(OmitBaseSchema(createSchema), ["invoiceNumber"]);
143977
+ CrmCpOrderPaymentModel.storepay = t.Composite([
143978
+ CrmCpOrderPaymentModel.create,
143979
+ t.Object({
143980
+ phone: t.Number({
143981
+ minimum: 1e7,
143982
+ maximum: 99999999
143983
+ })
143984
+ })
143985
+ ]);
143977
143986
  })(CrmCpOrderPaymentModel ||= {});
143978
143987
  var model_default8 = CrmCpOrderPaymentModel;
143979
143988
 
@@ -144132,6 +144141,7 @@ var StorePay = class {
144132
144141
  // src/routes/crm/cpOrder/payment/gateways/storepay.ts
144133
144142
  class StorePayGateway extends PaymentGateway {
144134
144143
  storepay;
144144
+ storeId = 0;
144135
144145
  constructor(input) {
144136
144146
  super();
144137
144147
  this.storepay = new StorePay(...input);
@@ -144142,10 +144152,10 @@ class StorePayGateway extends PaymentGateway {
144142
144152
  state: "PENDING"
144143
144153
  });
144144
144154
  const invoice = await this.storepay.createInvoice({
144145
- storeId: 0,
144146
- mobileNumber: 0,
144155
+ storeId: this.storeId,
144156
+ mobileNumber: input.phone,
144147
144157
  description: "",
144148
- amount: 0,
144158
+ amount: input.amount,
144149
144159
  callbackUrl: `https://dev.api.autosync.mn/crm/cp-order/payment/storepay/${payment.id}`
144150
144160
  }, this.token);
144151
144161
  if (JSON.stringify(invoice.token) !== JSON.stringify(this.token)) {
@@ -144185,6 +144195,7 @@ var CrmCpOrderPaymentLogic;
144185
144195
  auth3.appPassword
144186
144196
  ]);
144187
144197
  gateway.setToken(paymentInfo);
144198
+ gateway.storeId = auth3.storeId;
144188
144199
  const result = await gateway.createInvoice(body);
144189
144200
  return result;
144190
144201
  };
@@ -144234,7 +144245,7 @@ var logic_default11 = CrmCpOrderPaymentLogic;
144234
144245
  var paymentRoutes = new Elysia({
144235
144246
  prefix: "/payment",
144236
144247
  tags: ["CrmCpOrderPayment"]
144237
- }).use(better_auth_default).model(prefix_model_default("CrmCpOrderPaymentModel", model_default8)).get("/storepay/:id", async ({ params: { id } }) => logic_default11.checkStorePay(id)).guard({ auth: true }).post("/storepay", async ({ body, user: user2 }) => logic_default11.createStorepay(body, user2), { body: "CrmCpOrderPaymentModel.create" });
144248
+ }).use(better_auth_default).model(prefix_model_default("CrmCpOrderPaymentModel", model_default8)).get("/storepay/:id", async ({ params: { id } }) => logic_default11.checkStorePay(id)).guard({ auth: true }).post("/storepay", async ({ body, user: user2 }) => logic_default11.createStorepay(body, user2), { body: "CrmCpOrderPaymentModel.storepay" });
144238
144249
  var payment_default = paymentRoutes;
144239
144250
 
144240
144251
  // src/routes/crm/cpOrder/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autosync_backend2",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "module": "src/index.ts",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",