«

PATCH /api/admin/shop-discount/{id} -- Cập nhật thông tin shop discount

body: { "shopAvatar": "string", "category"(): 0, "status"(): "string", "dealer"(): "string", "discountType"(): "string", "discountRate"(): 0, "customerDiscountRate"(): 0, "dealerCommissionRate"(): 0, "marketingPartnerCommissionRate"(): 0, "note": "string" }

    • Given Tồn tại shop ưu đãi có thông tin
      id
      ID01
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 401 khi token không hợp lệ

    • Given Token đã hết hạn
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
          "discountType": "ALL_PRODUCT",
          "discountRate": 15,
          "customerDiscountRate": 10,
          "dealerCommissionRate": 10,
          "marketingPartnerCommissionRate": 10,
          "note": "thích thì note"
      }
    • Then Trả về status code 401
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 401 khi không truyền token

    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
          "discountType": "ALL_PRODUCT",
          "discountRate": 15,
          "customerDiscountRate": 10,
          "dealerCommissionRate": 10,
          "marketingPartnerCommissionRate": 10,
          "note": "thích thì note"
      }
    • Then Trả về status code 401
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 403 khi không có quyền supplier:update_supplier

    • Given Tôi có token của tài khoản có thông tin
      accountpermissionGrouppermissionGroupNamepermission
      suppliersupplier_groupsupplier_grouptrừ quyền supplier:update_supplier
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
          "discountType": "ALL_PRODUCT",
          "discountRate": 15,
          "customerDiscountRate": 10,
          "dealerCommissionRate": 10,
          "marketingPartnerCommissionRate": 10,
          "note": "thích thì note"
      }
    • Then Trả về status code 403
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 404 khi không gửi lên x-tenant

    • Given Có token full quyền
    • When Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
          "discountType": "ALL_PRODUCT",
          "discountRate": 15,
          "customerDiscountRate": 10,
          "dealerCommissionRate": 10,
          "marketingPartnerCommissionRate": 10,
          "note": "thích thì note"
      }
    • Then Trả về status code 404
    • And Response có body thỏa mãn giá trị như sau
      {
        "title": "shop_not_found",
         "detail": "Shop is not found with tenant `{}`"
      }
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 400 khi gửi request cập nhật shop discount với x-tenant không hợp lệ

    • Given Có token full quyền
    • When Request có header là
      X-Tenant<tenant>
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
          "discountType": "ALL_PRODUCT",
          "discountRate": 15,
          "customerDiscountRate": 10,
          "dealerCommissionRate": 10,
          "marketingPartnerCommissionRate": 10,
          "note": "thích thì note"
      }
    • Then Trả về status code 404
    • And Response có body thỏa mãn giá trị như sau
      {
        "title": "shop_not_found"
      }

    Examples:

    tenant
    m2
    null
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 404 khi gửi lên id shop không tồn tại

    • Given Có token full quyền
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/00000000-000d-000d-b000-dc0a00a00b0a" với body
      {
          "discountType": "ALL_PRODUCT",
          "discountRate": 15,
          "customerDiscountRate": 10,
          "dealerCommissionRate": 10,
          "marketingPartnerCommissionRate": 10,
          "note": "thích thì note"
      }
    • Then Trả về status code 404
    • And Response có body thỏa mãn giá trị như sau
      {
         "title": "shop_not_found"
      }
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 200 khi gửi request cập nhật thông tin shop hợp lệ. Có ghi log cập nhật thông tin shop

    • Given Hệ thống Admin Sabomall tồn tại thông tin category
      categoryIdname
      01Giày
      02Vật liệu xây dựng
    • And Tồn tại shop discount có thông tin
      idcategorystatusdealerdiscountRatecustomerDiscountRatedealerCommissionRatemarketingPartnerCommissionRatenote
      ID01Vật liệu xây dựng<status>admin15601515<note>
    • And Có token full quyền
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
      <bodyJson>
      }
    • Then Trả về status code 200
    • And Response có body thỏa mãn giá trị như sau
      {
      <responseJson>
      }
    • When Gửi request "GET" đến "/admin/shop-discount/${ID01}/logs"
    • Then Response có body thỏa mãn giá trị như sau
      [
      {
      "change" : {"valueChange": {<logResponseJson>}}
      }
      ]

    Examples:

    status note bodyJson responseJson logResponseJson
    thích thì note "note": "không thích cũng note" "note": "không thích cũng note" "changedValues": [{"key": "note","left": "thích thì note","right": "không thích cũng note"}]
    "note": "không thích cũng note" "note": "không thích cũng note" "changedValues": [{"key": "note","left": "","right": "không thích cũng note"}]
    thích thì note "note": "" "note": "" "changedValues": [{ "key": "note", "left": "thích thì note", "right": "" }]
    "category": ${01} "category": ${01} "changedValues": [{ "key": "category"}]
    "dealer": "lanhuong" "dealer": "lanhuong" "changedValues": [{"key": "dealer","left": "admin","right": "lanhuong"}]
    "discountRate": 20 "discountRate": 20.0 "changedValues": [ {"key": "discountRate","left": 15,"right": 20.0}]
    "discountRate": 0 "discountRate": 0.0 "changedValues": [ {"key": "discountRate","left": 15,"right": 0.0}]
    "discountRate": 20.5 "discountRate": 20.5 "changedValues": [ {"key": "discountRate","left": 15,"right": 20.5}]
    "customerDiscountRate": 65 "customerDiscountRate": 65.0, "otherCommissionRate": 5.0 "changedValues": [{"key": "customerDiscountRate","left": 60,"right": 65.0}, {"key": "otherCommissionRate", "left": 10, "right": 5.0}]
    "customerDiscountRate": 65.5 "customerDiscountRate": 65.5, "otherCommissionRate": 4.5 "changedValues": [{"key": "customerDiscountRate","left": 60,"right": 65.5}, {"key": "otherCommissionRate", "left": 10, "right": 4.5}]
    "customerDiscountRate": 0 "customerDiscountRate": 0.0, "otherCommissionRate": 70.0 "changedValues": [{"key": "customerDiscountRate","left": 60,"right": 0.0}, {"key": "otherCommissionRate", "left": 10, "right": 70.0}]
    "dealerCommissionRate": 20 "dealerCommissionRate": 20.0, "otherCommissionRate": 5.0 "changedValues": [{ "key": "dealerCommissionRate", "left": 15, "right": 20.0 }, {"key": "otherCommissionRate","left": 10,"right": 5.0 }]
    "dealerCommissionRate": 20.5 "dealerCommissionRate": 20.5, "otherCommissionRate": 4.5 "changedValues": [{ "key": "dealerCommissionRate", "left": 15, "right": 20.5 }, {"key": "otherCommissionRate","left": 10,"right": 4.5 }]
    "dealerCommissionRate": 0 "dealerCommissionRate": 0.0, "otherCommissionRate": 25.0 "changedValues": [{ "key": "dealerCommissionRate", "left": 15, "right": 0.0 }, {"key": "otherCommissionRate","left": 10,"right": 25.0 }]
    "marketingPartnerCommissionRate": 20 "marketingPartnerCommissionRate": 20.0, "otherCommissionRate": 5.0 "changedValues": [{"key": "marketingPartnerCommissionRate", "left": 15,"right": 20.0},{"key": "otherCommissionRate", "left": 10, "right": 5.0 }]
    "marketingPartnerCommissionRate": 20.5 "marketingPartnerCommissionRate": 20.5, "otherCommissionRate": 4.5 "changedValues": [{"key": "marketingPartnerCommissionRate", "left": 15,"right": 20.5},{"key": "otherCommissionRate", "left": 10, "right": 4.5 }]
    "marketingPartnerCommissionRate": 0 "marketingPartnerCommissionRate": 0.0, "otherCommissionRate": 25.0 "changedValues": [{"key": "marketingPartnerCommissionRate", "left": 15,"right": 0.0},{"key": "otherCommissionRate", "left": 10, "right": 25.0 }]
    INACTIVE "status": "ACTIVE" "shopStatus": "ACTIVE" "changedValues": [{"key": "shopStatus","left": "INACTIVE","right": "ACTIVE"}]
    ACTIVE "status": "INACTIVE" "shopStatus": "INACTIVE" "changedValues": [{"key": "shopStatus","left": "ACTIVE","right": "INACTIVE"}]
  • Tags: @AUTOMATED, @TNK-5939

    Khi cập nhật thông tin thể loại ưu đãi của shop thì các sản phẩm đã có trong shop thành Ngừng hoạt động.

    • Given Tồn tại shop discount có thông tin
      idstatusdiscountType
      ID01ACTIVE<typeBefore>
    • And Có token full quyền
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
      "discountType": "<typeAfter>"
      }
    • Then Trả về status code 200
    • And Response có body thỏa mãn giá trị như sau
      {
      "discountType": "<typeAfter>"
      }
    • And Các sản phẩm trong shop "ID01" được đánh dấu "Ngưng hoạt động"
    • And Gửi request "GET" đến "admin/shop-discount/${ID01}/logs"
    • And Response có body thỏa mãn giá trị như sau
      [
      {
      "change" : {"valueChange": { "changedValues": [{"key": "discountType", "left": "<typeBefore>","right": "<typeAfter>" }]}}
      }
      ]

    Examples:

    typeBefore typeAfter
    ALL_PRODUCT SOME_PRODUCT
    SOME_PRODUCT ALL_PRODUCT
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 400 khi gửi request cập nhật ngành hàng không tồn tại

    • Given Không tồn tại categoryId "001"
    • And Có token full quyền
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
      "category": ${001}
      }
    • Then Trả về status code 400
    • And Response có body thỏa mãn giá trị như sau
      {
      "title": "category_invalid"
      }
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 400 khi gửi request cập nhật người thương lượng không tồn tại

    • Given Có token full quyền
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
      "dealer": "dealerNotexist"
      }
    • Then Trả về status code 400
    • And Response có body thỏa mãn giá trị như sau
      {
      "title": "dealer_invalid"
      }
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 400 khi gửi lên thông tin loại ưu đãi không hợp lệ

    • Given Có token full quyền
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
      "discountType": "abc"
      }
    • Then Trả về status code 400
    • And Response có body thỏa mãn giá trị như sau
      {
      "title": "discount_type_invalid"
      }
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 400 khi gửi lên phẩn trăm giảm giá sản phẩm không hợp lệ

    • Given Có token full quyền
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
      "discountRate": <discountRate>
      }
    • Then Trả về status code 400
    • And Response có body thỏa mãn giá trị như sau
      {
      "title": <title>
      }

    Examples:

    discountRate title
    a "Bad Request"
    -1 "discount_rate_invalid"
    101 "discount_rate_invalid"
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 400 khi gửi lên phần trăm người dùng được hưởng không hợp lệ

    • Given Có token full quyền
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
      "customerDiscountRate": <customerDiscountRate>
      }
    • Then Trả về status code 400
    • And Response có body thỏa mãn giá trị như sau
      {
      "title": <title>
      }

    Examples:

    customerDiscountRate title
    101 "discount_value_invalid"
    a "Bad Request"
    -1 "discount_value_invalid"
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 400 khi gửi lên phần trăm người thương lượng được hưởng không hợp lệ

    • Given Có token full quyền
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
      "dealerCommissionRate": <dealerCommissionRate>
      }
    • Then Trả về status code 400
    • And Response có body thỏa mãn giá trị như sau
      {
      "title": <title>
      }

    Examples:

    dealerCommissionRate title
    a "Bad Request"
    -1 "discount_value_invalid"
    101 "discount_value_invalid"
  • Tags: @AUTOMATED, @TNK-5939

    Trả về 400 khi gửi lên phần trăm marketing được hưởng không hợp lệ

    • Given Có token full quyền
    • When Request có header là
      X-Tenantm26
    • And Gửi request "PATCH" đến "/admin/shop-discount/${ID01}" với body
      {
      "marketingPartnerCommissionRate": <marketingPartnerCommissionRate>
      }
    • Then Trả về status code 400
    • And Response có body thỏa mãn giá trị như sau
      {
      "title": <title>
      }

    Examples:

    marketingPartnerCommissionRate title
    a "Bad Request"
    -1 "discount_value_invalid"
    101 "discount_value_invalid"