magento / graphql-ce

[ARCHIVED] Please use magento/magento2 project
https://github.com/magento/magento2
Open Software License 3.0
131 stars 156 forks source link

Cannot set payment method Purchase Order on cart #533

Closed galaoleksandr closed 5 years ago

galaoleksandr commented 5 years ago

Preconditions (*)

  1. Customer exists with e-mail EMAIL and password PASS
  2. At least one product exists
  3. Purchase order payment method is enabled

Steps to reproduce (*)

  1. Generate customer token using GraphQl:
    mutation {
    generateCustomerToken(
    email:  {{ EMAIL }}
    password:  {{ PASS }}
    ) {
    token
    }
    }

Response:

{
  "data": {
    "generateCustomerToken": {
      "token":  {{ TOKEN }}
    }
  }
}
  1. Create empty cart:
    mutation {
    createEmptyCart
    }

Headers:

{
"Content-Type": "application/json",
"Authorization": "Bearer {{  TOKEN  }}"
}

Response:

{
  "data": {
    "createEmptyCart": {{  CART_ID  }}
  }
}
  1. Login to storefront using EMAIL and PASS.
  2. Add product to cart on storefront.
  3. Go to checkout.
  4. Set shipping method.
  5. Try to set payment method Purchase Order using GraphQl:
mutation { setPaymentMethodOnCart (
  input: {
    cart_id: {{  CART_ID  }}
    payment_method: {
      code: "purchaseorder"
      purchase_order_number: "12345"
    }
  })
 {
   cart {

      available_payment_methods {
        code
        title
      }
      }
    }
} 

Headers:

{
"Content-Type": "application/json",
"Authorization": "Bearer {{ TOKEN  }}"
}

Expected result (*)

Purchase order is set

Actual result (*)

Response:

{
  "errors": [
    {
      "message": "Purchase order number is a required field.",
      "category": "graphql-input",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "setPaymentMethodOnCart"
      ]
    }
  ],
  "data": {
    "setPaymentMethodOnCart": null
  }
}
naydav commented 5 years ago

https://github.com/magento/graphql-ce/pull/578