dreamworker

Untitled

Nov 28th, 2019
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.30 KB | None | 0 0
  1. $ java -jar client-0.1.jar
  2. Using client config: Server{hostName='localhost', port=8084}
  3.  
  4.  
  5. Список товаров:
  6.  
  7. REQUEST
  8. {"id":1000,"method":"shop.entities.product.getAll","params":null}
  9.  
  10. HTTP 200 OK
  11. {"id":1000,"result":[{"id":1,"created":1575003235,"updated":1575003235,"name":"Westmalle Trappist Tripel","vcode":"1142311","testDate":0},{"id":2,"created":1575003235,"updated":1575003235,"name":"Trappistes Rochefort 8","vcode":"5858830","testDate":0},{"id":3,"created":1575003235,"updated":1575003235,"name":"Pliny The Elder","vcode":"1570175","testDate":0},{"id":4,"created":1575003235,"updated":1575003235,"name":"Maharaj","vcode":"4807385","testDate":0},{"id":5,"created":1575003235,"updated":1575003235,"name":"Sierra Nevada Bigfoot Barleywine Style Ale","vcode":"4855284","testDate":0}]}
  12.  
  13. [ProductDto{id=1, name='Westmalle Trappist Tripel', vcode='1142311', testDate=1970-01-01T00:00:00Z, created=2019-11-29T04:53:55Z, updated=2019-11-29T04:53:55Z}, ProductDto{id=2, name='Trappistes Rochefort 8', vcode='5858830', testDate=1970-01-01T00:00:00Z, created=2019-11-29T04:53:55Z, updated=2019-11-29T04:53:55Z}, ProductDto{id=3, name='Pliny The Elder', vcode='1570175', testDate=1970-01-01T00:00:00Z, created=2019-11-29T04:53:55Z, updated=2019-11-29T04:53:55Z}, ProductDto{id=4, name='Maharaj', vcode='4807385', testDate=1970-01-01T00:00:00Z, created=2019-11-29T04:53:55Z, updated=2019-11-29T04:53:55Z}, ProductDto{id=5, name='Sierra Nevada Bigfoot Barleywine Style Ale', vcode='4855284', testDate=1970-01-01T00:00:00Z, created=2019-11-29T04:53:55Z, updated=2019-11-29T04:53:55Z}]
  14.  
  15.  
  16. Запасы на складе:
  17.  
  18. REQUEST
  19. {"id":1000,"method":"shop.entities.storage.getAll","params":null}
  20.  
  21. HTTP 200 OK
  22. {"id":1000,"result":[{"id":1,"created":1575003235,"updated":1575003235,"productId":1,"count":8},{"id":2,"created":1575003235,"updated":1575003235,"productId":2,"count":502},{"id":3,"created":1575003235,"updated":1575003235,"productId":3,"count":18},{"id":4,"created":1575003235,"updated":1575003235,"productId":4,"count":48},{"id":5,"created":1575003235,"updated":1575003235,"productId":5,"count":35}]}
  23.  
  24. [ProductItemDto{id=1,productId=1, count=8, created=2019-11-29T04:53:55Z, updated=2019-11-29T04:53:55Z}, ProductItemDto{id=2,productId=2, count=502, created=2019-11-29T04:53:55Z, updated=2019-11-29T04:53:55Z}, ProductItemDto{id=3,productId=3, count=18, created=2019-11-29T04:53:55Z, updated=2019-11-29T04:53:55Z}, ProductItemDto{id=4,productId=4, count=48, created=2019-11-29T04:53:55Z, updated=2019-11-29T04:53:55Z}, ProductItemDto{id=5,productId=5, count=35, created=2019-11-29T04:53:55Z, updated=2019-11-29T04:53:55Z}]
  25.  
  26.  
  27. Завезем на склад 500 единиц товара с id=2:
  28.  
  29. REQUEST
  30. {"id":1000,"method":"shop.entities.storage.put","params":{"id":null,"created":null,"updated":null,"productId":2,"count":500}}
  31.  
  32. HTTP 200 OK
  33. {"id":1000,"result":2}
  34.  
  35.  
  36.  
  37. Запасы товара id=2 на складе:
  38.  
  39. REQUEST
  40. {"id":1000,"method":"shop.entities.storage.getById","params":2}
  41.  
  42. HTTP 200 OK
  43. {"id":1000,"result":{"id":2,"created":1575003235,"updated":1575003274,"productId":2,"count":1002}}
  44.  
  45. ProductItemDto{id=2,productId=2, count=1002, created=2019-11-29T04:53:55Z, updated=2019-11-29T04:54:34Z}
  46.  
  47.  
  48. Попытаемся забрать со склада 9999 единиц товара с id=2:
  49.  
  50. REQUEST
  51. {"id":1000,"method":"shop.entities.storage.remove","params":{"id":null,"created":null,"updated":null,"productId":2,"count":9999}}
  52.  
  53. HTTP 400 BAD_REQUEST
  54. {"id":1000,"error":{"message":"product doesn't exists/not enough amount in storage to remove","code":400}}
  55.  
  56. Сделаем заказ:
  57.  
  58. REQUEST
  59. {"id":1000,"method":"shop.entities.order.put","params":{"id":null,"created":null,"updated":null,"itemList":[{"id":null,"created":null,"updated":null,"productId":3,"count":10}],"client":null,"manager":null}}
  60.  
  61. HTTP 200 OK
  62. {"id":1000,"result":2}
  63.  
  64. orderId: 2
  65.  
  66.  
  67. Проверим заказ:
  68.  
  69. REQUEST
  70. {"id":1000,"method":"shop.entities.order.getById","params":2}
  71.  
  72. HTTP 200 OK
  73. {"id":1000,"result":{"id":2,"created":1575003274,"updated":1575003274,"itemList":[{"id":2,"created":1575003274,"updated":1575003274,"productId":3,"count":10}],"client":null,"manager":null}}
  74.  
  75. OrderDto{id=2, client=null, manager=null, created=2019-11-29T04:54:34Z, updated=2019-11-29T04:54:34Z, itemList=[OrderItemDto{id=2}]}
Advertisement
Add Comment
Please, Sign In to add comment