You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.7KB

  1. import { APICommonResponse, ApiId, HttpMethod, makeParam, request } from "api";
  2. import { getUrl } from "api/url";
  3. export type HTCustomer = {
  4. customer_code: string;
  5. name: string;
  6. };
  7. export type HTParking = {
  8. customer_code: string;
  9. parking_management_code: string;
  10. name: string;
  11. };
  12. export type HTAdjustData = {
  13. customer_code: string;
  14. parking_management_code: string;
  15. adjust_seq_no: number;
  16. adjust_datetime: string;
  17. tax_charge: number;
  18. putin_datetime: string;
  19. adjust_type: string;
  20. amount: number;
  21. };
  22. export type HTCustomersResponse = {
  23. data: {
  24. records: HTCustomer[];
  25. };
  26. } & APICommonResponse;
  27. export const getHTCustomers = async (data = {}) => {
  28. const res = await request<HTCustomersResponse>({
  29. url: getUrl(ApiId.HT_CUSTOM_CUSTOMERS),
  30. method: HttpMethod.GET,
  31. });
  32. return res;
  33. };
  34. export type HTParkingsRequest = {
  35. customer_code: string;
  36. };
  37. export type HTParkingsResponse = {
  38. data: {
  39. records: HTParking[];
  40. };
  41. } & APICommonResponse;
  42. export const getHTParkings = async (data: HTParkingsRequest) => {
  43. console.log({ data });
  44. const res = await request<HTParkingsResponse>({
  45. url: getUrl(ApiId.HT_CUSTOM_PARKINGS),
  46. method: HttpMethod.GET,
  47. data: new URLSearchParams(data),
  48. });
  49. return res;
  50. };
  51. export type HTAdjustDataRequest = {
  52. customer_code: string;
  53. parking_management_code: string;
  54. adjust_seq_no: string;
  55. };
  56. export type HTAdjustDataResponse = {
  57. data: HTAdjustData;
  58. } & APICommonResponse;
  59. export const getHTAdjustData = async (data: HTAdjustDataRequest) => {
  60. const res = await request<HTAdjustDataResponse>({
  61. url: getUrl(ApiId.HT_CUSTOM_ADJUST_DATA),
  62. method: HttpMethod.GET,
  63. data: new URLSearchParams(data),
  64. });
  65. return res;
  66. };