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

Expected value to be of type 'Optional<Nullable<string>>' but found 'boolean'.\n #14

Open
brennomeneses opened this issue May 12, 2023 · 1 comment

Comments

@brennomeneses
Copy link

Quando tentei usar split de pagamento ele até dá sucesso no corpo de requisição, porém ele logo em seguida dá um throw em um erro.

...rest
message: "Expected value to be of type 'Optional<Nullable<string>>' but found 'boolean'.\n" +
        '\n' +
        'Given value: true\n' +
        "Type: 'boolean'\n" +
        "Expected type: 'Optional<Nullable<string>>'\n" +
        'Path: charges › 0 › last_transaction › split › 0 › options › charge_remainder_fee'
    }

O codigo referente ao script:

...rest,
split: [{
                type: "percentage",
                amount: 100,
                recipientId: "re_clhkul8zt0gq7019t7ep4rdd1",
                options: {
                    liable: true,
                    chargeRemainderFee: true,
                    chargeProcessingFee: true
                }
            }]

Ao usar o cURL ele funciona certo sem erros:

curl --request POST \
     --url https://api.pagar.me/core/v5/orders \
     --header 'accept: application/json' \
     --header 'authorization: Basic c2tfdGVzdF9WT0tYUkxaQ2FRVHgwTG9EOg==' \
     --header 'content-type: application/json' \
     --data '
{
  "items": [
    {
      "amount": 100,
      "description": "Chaveiro do Tesseract",
      "quantity": 1,
      "code": "12345"
    }
  ],
  "customer": {
    "name": "Tony Stark",
    "email": "[email protected]"
  },
  "payments": [
    {
      "credit_card": {
        "card": {
          "billing_address": {
            "line_1": "10880, Malibu Point, Malibu Central",
            "zip_code": "90265",
            "city": "Malibu",
            "state": "CA",
            "country": "US"
          },
          "number": "342793631858229",
          "holder_name": "Tony Stark",
          "exp_month": 1,
          "exp_year": 30,
          "cvv": "3531"
        },
        "installments": 1,
        "statement_descriptor": "AVENGERS"
      },
      "split": [
        {
          "options": {
            "charge_processing_fee": true,
            "charge_remainder_fee": true,
            "liable": true
          },
          "amount": 100,
          "recipient_id": "TEST",
          "type": "percentage"
        }
      ],
      "payment_method": "credit_card"
    }
  ]
}
'

Acredito que seja algo relacionado a alguma conversão de valor, uma vez que ele dá sucesso pelo cURL

@salao-na-mao-developer
Copy link

Estou com o mesmo problema...

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

No branches or pull requests

2 participants