Skip to content

Listing saved cards without passing in sortOrder causes BAD_REQUEST error #240

Description

@alexbrazier

Library Version: 44.2.0

  const cards = await client.cards.list({
    customerId: squareCustomerId,
  });

Response

Body: {
  "errors": [
    {
      "category": "INVALID_REQUEST_ERROR",
      "code": "INVALID_ENUM_VALUE",
      "detail": "`` is not a valid enum value for `sort_order`.",
      "field": "sort_order"
    }
  ]
}
"rawResponse":{"headers":{},"redirected":false,"status":400,"statusText":"Bad Request","type":"basic","url":"https://connect.squareupsandbox.com/v2/cards?customer_id=<redacted>&sort_order="},

Expected behaviour

Not passing sortOrder should just return the default, presumably by just removing the &sort_order= query from the url when not provided.

Workaround

  const cards = await client.cards.list({
    customerId: squareCustomerId,
    sortOrder: 'DESC',
  });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions