@connect-plus-online/ogabai-integrations 0.0.82 → 0.0.83

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 CHANGED
@@ -350,7 +350,7 @@ type SaleStatus = "paid" | "credit";
350
350
  type PaymentType = "cash" | "card" | "transfer" | "wallet";
351
351
  type Platform = "pos" | "commerce" | "wallet";
352
352
  type TxStatus = "pending" | "processing" | "completed" | "failed";
353
- type TransactionType = "sale" | "refund" | "deposit" | "withdrawal";
353
+ type TransactionType = "sale" | "refund" | "deposit" | "withdrawal" | "customerRefund" | "customerDeposit";
354
354
  type Transaction = {
355
355
  _id: string;
356
356
  from: string;
@@ -369,6 +369,7 @@ type Transaction = {
369
369
  createdAt: string;
370
370
  sales: Sale[];
371
371
  storeId: string;
372
+ customerId: string;
372
373
  transactionType: TransactionType;
373
374
  };
374
375
  type OrderStatus = "pending" | "processing" | "routing" | "delivered";
@@ -1074,12 +1075,6 @@ declare const createCustomerService: (client: GraphQLClient) => {
1074
1075
  root?: "customerId"[] | undefined;
1075
1076
  nestedFields?: {} | undefined;
1076
1077
  } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"customer"> | undefined>;
1077
- getCustomers: (input: ListEntityRequest<Customer, "customer">, fetchFields?: {
1078
- root?: ("total" | "customers")[] | undefined;
1079
- nestedFields?: (Record<"customers", CustomerFields> & {
1080
- customerStoreBalance: CustomerStoreBalanceFields;
1081
- }) | undefined;
1082
- } | undefined, option?: RequestOption) => Promise<ListEntityResponse<Customer, "customer"> | undefined>;
1083
1078
  getCustomersByStoreId: (input: {
1084
1079
  customer?: Partial<Customer> | undefined;
1085
1080
  } & {
@@ -1913,6 +1908,14 @@ declare const createTransactionService: (client: GraphQLClient) => {
1913
1908
  root?: (keyof AddTransactionResponse)[];
1914
1909
  nestedFields?: AddTransactionResponseNestedFields;
1915
1910
  }, option?: RequestOption): Promise<AddTransactionResponse | null>;
1911
+ addCustomerDeposit(input: Pick<Transaction, "customerId" | "amountPaid">, fetchFields?: {
1912
+ root?: (keyof AddTransactionResponse)[];
1913
+ nestedFields?: AddTransactionResponseNestedFields;
1914
+ }, option?: RequestOption): Promise<AddTransactionResponse | null>;
1915
+ addCustomerRefund(input: Pick<Transaction, "customerId" | "amountPaid">, fetchFields?: {
1916
+ root?: (keyof AddTransactionResponse)[];
1917
+ nestedFields?: AddTransactionResponseNestedFields;
1918
+ }, option?: RequestOption): Promise<AddTransactionResponse | null>;
1916
1919
  getTransaction(input: GetTransactionRequest, fetchFields?: {
1917
1920
  root?: (keyof GetTransactionResponse)[];
1918
1921
  nestedFields?: GetTransactionResponseNestedFields;
package/dist/index.d.ts CHANGED
@@ -350,7 +350,7 @@ type SaleStatus = "paid" | "credit";
350
350
  type PaymentType = "cash" | "card" | "transfer" | "wallet";
351
351
  type Platform = "pos" | "commerce" | "wallet";
352
352
  type TxStatus = "pending" | "processing" | "completed" | "failed";
353
- type TransactionType = "sale" | "refund" | "deposit" | "withdrawal";
353
+ type TransactionType = "sale" | "refund" | "deposit" | "withdrawal" | "customerRefund" | "customerDeposit";
354
354
  type Transaction = {
355
355
  _id: string;
356
356
  from: string;
@@ -369,6 +369,7 @@ type Transaction = {
369
369
  createdAt: string;
370
370
  sales: Sale[];
371
371
  storeId: string;
372
+ customerId: string;
372
373
  transactionType: TransactionType;
373
374
  };
374
375
  type OrderStatus = "pending" | "processing" | "routing" | "delivered";
@@ -1074,12 +1075,6 @@ declare const createCustomerService: (client: GraphQLClient) => {
1074
1075
  root?: "customerId"[] | undefined;
1075
1076
  nestedFields?: {} | undefined;
1076
1077
  } | undefined, option?: RequestOption) => Promise<DeleteEntityResponse<"customer"> | undefined>;
1077
- getCustomers: (input: ListEntityRequest<Customer, "customer">, fetchFields?: {
1078
- root?: ("total" | "customers")[] | undefined;
1079
- nestedFields?: (Record<"customers", CustomerFields> & {
1080
- customerStoreBalance: CustomerStoreBalanceFields;
1081
- }) | undefined;
1082
- } | undefined, option?: RequestOption) => Promise<ListEntityResponse<Customer, "customer"> | undefined>;
1083
1078
  getCustomersByStoreId: (input: {
1084
1079
  customer?: Partial<Customer> | undefined;
1085
1080
  } & {
@@ -1913,6 +1908,14 @@ declare const createTransactionService: (client: GraphQLClient) => {
1913
1908
  root?: (keyof AddTransactionResponse)[];
1914
1909
  nestedFields?: AddTransactionResponseNestedFields;
1915
1910
  }, option?: RequestOption): Promise<AddTransactionResponse | null>;
1911
+ addCustomerDeposit(input: Pick<Transaction, "customerId" | "amountPaid">, fetchFields?: {
1912
+ root?: (keyof AddTransactionResponse)[];
1913
+ nestedFields?: AddTransactionResponseNestedFields;
1914
+ }, option?: RequestOption): Promise<AddTransactionResponse | null>;
1915
+ addCustomerRefund(input: Pick<Transaction, "customerId" | "amountPaid">, fetchFields?: {
1916
+ root?: (keyof AddTransactionResponse)[];
1917
+ nestedFields?: AddTransactionResponseNestedFields;
1918
+ }, option?: RequestOption): Promise<AddTransactionResponse | null>;
1916
1919
  getTransaction(input: GetTransactionRequest, fetchFields?: {
1917
1920
  root?: (keyof GetTransactionResponse)[];
1918
1921
  nestedFields?: GetTransactionResponseNestedFields;
package/dist/index.esm.js CHANGED
@@ -1904,12 +1904,6 @@ var customerSchema = {
1904
1904
  variables: "($customer: CustomerInput!)",
1905
1905
  field: "(customer: $customer)"
1906
1906
  },
1907
- list: {
1908
- operation: "query",
1909
- name: "getCustomers",
1910
- variables: "($limit: Int!, $skip: Int!, $search: String, $customer: CustomerInput, $customerIds: [String])",
1911
- field: "(limit: $limit, skip: $skip, search: $search, customer: $customer, customerIds: $customerIds)"
1912
- },
1913
1907
  create: {
1914
1908
  operation: "mutation",
1915
1909
  name: "createCustomer",
@@ -1983,15 +1977,20 @@ var createCustomerService = (client) => ({
1983
1977
  }
1984
1978
  ),
1985
1979
  // only admin
1986
- getCustomers: createOperationExecutor(
1987
- client,
1988
- "getCustomers",
1989
- {
1990
- schema: buildSchema(customerSchema.list),
1991
- defaultRootFields: [...customerListIntegration.responseFields],
1992
- defaultNestedFields: customerListIntegration.nestedFields
1993
- }
1994
- ),
1980
+ // getCustomers: createOperationExecutor<
1981
+ // "getCustomers",
1982
+ // CustomerCRUD["ListRequest"],
1983
+ // CustomerCRUD["ListResponse"],
1984
+ // typeof customerListIntegration.nestedFields
1985
+ // >(
1986
+ // client,
1987
+ // "getCustomers",
1988
+ // {
1989
+ // schema: buildSchema(customerSchema.list),
1990
+ // defaultRootFields: [...customerListIntegration.responseFields],
1991
+ // defaultNestedFields: customerListIntegration.nestedFields,
1992
+ // }
1993
+ // ),
1995
1994
  getCustomersByStoreId: createOperationExecutor(
1996
1995
  client,
1997
1996
  "getCustomersByStoreId",
@@ -3220,6 +3219,7 @@ var transactionQuery = [
3220
3219
  "to",
3221
3220
  "toWallet",
3222
3221
  "txStatus",
3222
+ "customerId",
3223
3223
  "transactionType"
3224
3224
  ];
3225
3225
  var orderQuery = [
@@ -3443,6 +3443,32 @@ var createTransactionService = (client) => ({
3443
3443
  );
3444
3444
  return (_d = (_c = res.data) == null ? void 0 : _c.addTransaction) != null ? _d : null;
3445
3445
  },
3446
+ async addCustomerDeposit(input, fetchFields, option) {
3447
+ return this.addTransaction(
3448
+ {
3449
+ transaction: {
3450
+ ...input,
3451
+ transactionType: "customerDeposit",
3452
+ platform: "pos"
3453
+ }
3454
+ },
3455
+ fetchFields,
3456
+ option
3457
+ );
3458
+ },
3459
+ async addCustomerRefund(input, fetchFields, option) {
3460
+ return this.addTransaction(
3461
+ {
3462
+ transaction: {
3463
+ ...input,
3464
+ transactionType: "customerRefund",
3465
+ platform: "pos"
3466
+ }
3467
+ },
3468
+ fetchFields,
3469
+ option
3470
+ );
3471
+ },
3446
3472
  async getTransaction(input, fetchFields, option) {
3447
3473
  var _a, _b, _c, _d;
3448
3474
  const res = await client.request(