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

Impossible to generate mandate pdf in other language #66

Closed
ghost opened this issue Apr 22, 2020 · 6 comments · Fixed by #68
Closed

Impossible to generate mandate pdf in other language #66

ghost opened this issue Apr 22, 2020 · 6 comments · Fixed by #68

Comments

@ghost
Copy link

ghost commented Apr 22, 2020

It does not seem possible to generate mandate PDF in other language.

https://developer.gocardless.com/api-reference/#mandate-pdfs-create-a-mandate-pdf

In Python, it is possible to do the following:

client.mandate_pdfs.create(params={
  "iban": "FR14BARC20000055779911"
}, headers={
  "Accept-Language": "fr"
})

Is there any possibility to do this with this library?

@ghost ghost changed the title Allow to generate mandate pdf in other language Impossible to generate mandate pdf in other language Apr 22, 2020
@tallosan
Copy link
Contributor

Thanks for the report! We'll have a fix out for this in the next few days.

@tallosan tallosan linked a pull request May 1, 2020 that will close this issue
@tallosan tallosan closed this as completed May 1, 2020
@ghost
Copy link
Author

ghost commented May 4, 2020

Hi! Could you update the related docs also? https://developer.gocardless.com/api-reference/#helper-endpoints-mandate-pdfs

I had to search for the code to understand that customHeaders are the third parameter and I had to use it like this:

      const { url } = await client.mandatePdfs.create(
        {
          links: {
            mandate: mandateId,
          },
        },
        '',
        {
          'Accept-Language': language,
        },
      );

I think it could be good to have this in the docs for others. Thanks in advance!

@tallosan
Copy link
Contributor

tallosan commented May 4, 2020

Yeah, good shout! We've recently updated the docs, so the most recent version should be available shortly.

@ghost
Copy link
Author

ghost commented May 4, 2020

Are you sure that this is actually working? I tried this but I had to put an empty string as a second parameter for the idempotencyKey. Plus I think you put Accept-Header where It should be Accept-Language.

await client.mandatePdfs.create(
  {
    account_number: "44779911",
    branch_code: "200000",
    country_code: "GB"
  },
  { customHeaders: { "Accept-Header": "fr" } }
);

@tallosan
Copy link
Contributor

tallosan commented May 5, 2020

Ahh, yes you're correct. Pretty careless mistake on my part, so apologies for that. I'll get this fixed up ASAP.

@ghost
Copy link
Author

ghost commented May 5, 2020

You're welcome! Thanks for the reactivity.

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.

1 participant