Order.py 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. class Order(object):
  2. def __init__(self, id, ticket, status, title, note, id_metaservice, is_global, is_visible, service, service_type, time_created, time_placed, time_start=None, time_start_predicted=None, time_finish_predicted=None, time_start_real=None, time_finish_real=None, order_place_type=None, order_place_start=None, order_place_start_gps=None, order_place_start_real=None, order_place_start_real_gps=None, order_place_finish_predicted=None, order_place_finish_predicted_gps=None, order_place_finish_real=None, order_place_finish_real_gps=None, predicted_price=None, real_price=None, payment_transaction_id=None, rating_id=None, provider=None, provider_screen_name=None, receiver=None, receiver_screen_name=None, client_id=None, resource_id=None, attempts=None, asap=None, money_limit=None, tasks=None, proceed_before_arrival=False, confirmation=False):
  3. self.id = id
  4. self.ticket = ticket
  5. self.status = status
  6. self.title = title
  7. self.note = note
  8. self.id_metaservice = id_metaservice
  9. self.is_global = is_global
  10. self.is_visible = is_visible
  11. self.service = service
  12. self.service_type = service_type
  13. self.time_created = time_created
  14. self.time_placed = time_placed
  15. self.time_start = time_start
  16. self.time_start_predicted = time_start_predicted
  17. self.time_finish_predicted = time_finish_predicted
  18. self.time_start_real = time_start_real
  19. self.time_finish_real = time_finish_real
  20. self.order_place_type = order_place_type
  21. self.order_place_start = order_place_start
  22. self.order_place_start_gps = order_place_start_gps
  23. self.order_place_start_real = order_place_start_real
  24. self.order_place_start_real_gps = order_place_start_real_gps
  25. self.order_place_finish_predicted = order_place_finish_predicted
  26. self.order_place_finish_predicted_gps = order_place_finish_predicted_gps
  27. self.order_place_finish_real = order_place_finish_real
  28. self.order_place_finish_real_gps = order_place_finish_real_gps
  29. self.predicted_price = predicted_price
  30. self.real_price = real_price
  31. self.payment_transaction_id = payment_transaction_id
  32. self.rating_id = rating_id
  33. self.provider = provider
  34. self.provider_screen_name = provider_screen_name
  35. self.receiver = receiver
  36. self.receiver_screen_name = receiver_screen_name
  37. self.client_id = client_id
  38. self.resource_id = resource_id
  39. self.attempts = attempts
  40. self.asap = asap
  41. self.money_limit = money_limit
  42. self.tasks = tasks
  43. self.proceed_before_arrival = proceed_before_arrival
  44. self.confirmation = confirmation
  45. def __str__(self):
  46. return "{0}, {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}".format(self.id, self.ticket, self.status, self.title, self.note, self.id_metaservice, self.is_global, self.is_visible, self.service, self.service_type, self.time_created, self.time_placed, self.time_start, self.time_start_predicted, self.time_finish_predicted, self.time_start_real, self.time_finish_real, self.order_place_type, self.order_place_start, self.order_place_start_gps, self.order_place_start_real, self.order_place_start_real_gps, self.order_place_finish_predicted, self.order_place_finish_predicted_gps, self.order_place_finish_real, self.order_place_finish_real_gps, self.predicted_price, self.real_price, self.payment_transaction_id, self.rating_id, self.provider, self.provider_screen_name, self.receiver, self.receiver_screen_name, self.client_id, self.resource_id, self.attempts, self.asap, self.money_limit, self.tasks, self.proceed_before_arrival, self.confirmation)
  47. #Тестовый класс User и Address (ВАЖНО!!!) поля классов должны называться также как и поля json объекта
  48. '''
  49. #Full json order example
  50. https://wiki.sharix-app.org/doku.php/open/tech/dev/sharix_open_-_primery_json
  51. {
  52. "ticket": 123,
  53. "status": 111,
  54. "priority": 1,
  55. "title": "123",
  56. "note": "123",
  57. "due_date": 2023-05-15T17:16:22.955601Z,
  58. "id_metaservice": 1,
  59. "is_global": false,
  60. "is_visible": false,
  61. "service": 1,
  62. "service_type": 1,
  63. "status_changed_date": "2023-05-15T17:16:22.955601Z",
  64. "time_placed": "2023-05-15T16:40:32.179777Z",
  65. "time_start": "2023-05-15T16:40:32.179777Z",
  66. "time_start_predicted": "2023-05-15T16:40:32.179777Z",
  67. "time_finish_predicted": "2023-05-15T16:40:32.179777Z",
  68. "time_start_real": "2023-05-15T16:40:32.179777Z",
  69. "time_finish_real": "2023-05-15T16:40:32.179777Z",
  70. "order_place_type": "address",
  71. "order_place_start": "р-н Беговой",
  72. "order_place_start_gps": "55.751941, 37.607513",
  73. "order_place_start_sector": 4,
  74. "order_place_start_real": "р-н Беговой",
  75. "order_place_start_real_gps": "55.751941, 37.607513",
  76. "order_place_finish_predicted": "р-н Мещанский",
  77. "order_place_finish_predicted_gps": "55.751941, 37.607513",
  78. "order_place_finish_sector": 4,
  79. "order_place_finish_real": "р-н Мещанский",
  80. "order_place_finish_real_gps": "55.751941, 37.607513",
  81. "predicted_price": 1000,
  82. "real_price": 1001,
  83. "payment_transaction_id": 1,
  84. "rating_id": 1,
  85. "provider": 1,
  86. "provider_screen_name": "Vasya Ispolnitelev",
  87. "receiver": 1,
  88. "receiver_screen_name": "Marfa Clientovna",
  89. "client_id": 1,
  90. "client_screen_name": "Fedor Client",
  91. "resource_id": 1,
  92. "attempts": null
  93. }
  94. '''
  95. #надо адаптировать класс к новому формату JSON
  96. # class Order(object):
  97. # def __init__(self, id,order_synced, ticket, status, title, note, due_date, id_metaservice, is_global, is_visible, service, service_type, status_changed_date,time_created, time_placed, time_start=None, time_start_predicted=None, time_finish_predicted=None, time_start_real=None, time_finish_real=None, order_place_type=None, order_place_start=None, order_place_start_gps=None, order_place_start_real=None, order_place_start_real_gps=None, order_place_finish_predicted=None, order_place_finish_predicted_gps=None, order_place_finish_real=None, order_place_finish_real_gps=None, predicted_price=None, real_price=None, payment_transaction_id=None, rating_id=None, provider=None, provider_screen_name=None, receiver=None, receiver_screen_name=None, client_id=None, resource_id=None, attempts=None, asap=None):
  98. # self.order_synced = order_synced
  99. # self.id = id
  100. # self.ticket = ticket
  101. # self.status = status
  102. # self.title = title
  103. # self.note = note
  104. # self.due_date = due_date
  105. # self.id_metaservice = id_metaservice
  106. # self.is_global = is_global
  107. # self.is_visible = is_visible
  108. # self.service = service
  109. # self.service_type = service_type
  110. # self.status_changed_date = status_changed_date
  111. # self.time_created = time_created
  112. # self.time_placed = time_placed
  113. # self.time_start = time_start
  114. # self.time_start_predicted = time_start_predicted
  115. # self.time_finish_predicted = time_finish_predicted
  116. # self.time_start_real = time_start_real
  117. # self.time_finish_real = time_finish_real
  118. # self.order_place_type =order_place_type
  119. # self.order_place_start = order_place_start
  120. # self.order_place_start_gps = order_place_start_gps
  121. # self.order_place_start_real = order_place_start_real
  122. # self.order_place_start_real_gps = order_place_start_real_gps
  123. # self.order_place_finish_predicted = order_place_finish_predicted
  124. # self.order_place_finish_predicted_gps = order_place_finish_predicted_gps
  125. # self.order_place_finish_real = order_place_finish_real
  126. # self.order_place_finish_real_gps = order_place_finish_real_gps
  127. # self.predicted_price = predicted_price
  128. # self.real_price = real_price
  129. # self.payment_transaction_id = payment_transaction_id
  130. # self.rating_id = rating_id
  131. # self.provider = provider
  132. # self.provider_screen_name = provider_screen_name
  133. # self.receiver = receiver
  134. # self.receiver_screen_name = receiver_screen_name
  135. # self.client_id = client_id
  136. # self.resource_id = resource_id
  137. # self.attempts = attempts
  138. # self.asap = asap
  139. # #доделать до конца по аналогии с закоммиченным json
  140. # def __str__(self):
  141. # return "{0}, {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}".format(self.order_synced, self.id, self.ticket, self.status, self.title, self.note, self.due_date, self.id_metaservice, self.is_global, self.is_visible, self.service, self.service_type, self.status_changed_date, self.time_created,self.time_placed, self.time_start, self.time_start_predicted, self.time_finish_predicted, self.time_start_real, self.time_finish_real, self.order_place_type, self.order_place_start, self.order_place_start_gps, self.order_place_start_real, self.order_place_start_real_gps, self.order_place_finish_predicted, self.order_place_finish_predicted_gps, self.order_place_finish_real, self.order_place_finish_real_gps, self.predicted_price, self.real_price, self.payment_transaction_id, self.rating_id, self.provider, self.provider_screen_name, self.receiver, self.receiver_screen_name, self.client_id, self.resource_id, self.attempts, self.asap)
  142. #\n добавляете в местах с пустой строкой в шаблоне