Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Item validation fails if unitPrice is 0 #78

Closed
mpesari opened this issue Apr 24, 2023 · 1 comment · Fixed by #79
Closed

Item validation fails if unitPrice is 0 #78

mpesari opened this issue Apr 24, 2023 · 1 comment · Fixed by #79
Assignees

Comments

@mpesari
Copy link
Contributor

mpesari commented Apr 24, 2023

The OpenAPI specification states for item.unitPrice:

    Item:
      type: object
      required:
        - unitPrice
        - units
        - vatPercentage
        - productCode
      properties:
        unitPrice:
          type: integer
          format: int64
          example: 1590
          minimum: 0
          maximum: 99999999
          description: Unit price of an item in currency minor unit, eg. EUR cents. VAT should be included in amount unless `usePricesWithoutVat` is set to true.

The API accepts items with unitPrice = 0, but Paytrail\SDK\Model\Item validation fails:

if (empty($props['unitPrice'])) {
throw new ValidationException('Item unitPrice is empty');
}

This was changed in SDK version 2.5.1 (#74)

Which behaviour is correct, SDK or API?

@VuorelaJ-P VuorelaJ-P self-assigned this Apr 24, 2023
@VuorelaJ-P
Copy link
Contributor

API is correct, validation should be done against only null value. Will fix. For refunds, amount should be positive not zero, since zero amount refund is not refund at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants