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

Add a custom plugin encoder for all DateTime parameters #1164

Closed
remi-stripe opened this issue Apr 23, 2018 · 5 comments · Fixed by #1293
Closed

Add a custom plugin encoder for all DateTime parameters #1164

remi-stripe opened this issue Apr 23, 2018 · 5 comments · Fixed by #1293
Labels

Comments

@remi-stripe
Copy link
Contributor

Timestamps in the API are represented as DateTime in stripe-dotnet. Those have to be converted to a timestamp internally such as here which is easy to forget.

It would be better to add a custom plugin encoder for those parameters as we do for other types here.

@KClough
Copy link

KClough commented Apr 26, 2018

Agreed, I'm seeing this issue with the TosAcceptanceDate field. Is there currently any workaround?

@remi-stripe
Copy link
Contributor Author

@KClough I just tried to pass TosAcceptanceDate on the latest version of stripe-dotnet and it works fine for me:

            var accountOptions = new StripeAccountCreateOptions() {
                Email = "bob@example.com",
                Type = StripeAccountType.Custom,
                Country = "FR",
                TosAcceptanceDate = DateTime.UtcNow.Date,
                TosAcceptanceIp = "8.8.8.8",
                TosAcceptanceUserAgent = "user-agent-7",
            };

            var accountService = new StripeAccountService();
            StripeAccount account = accountService.Create(accountOptions);            var accountOptions = new StripeAccountCreateOptions() {
                Email = "bob@example.com",
                Type = StripeAccountType.Custom,
                Country = "FR",
                TosAcceptanceDate = DateTime.UtcNow.Date,
                TosAcceptanceIp = "8.8.8.8",
                TosAcceptanceUserAgent = "user-agent-7",
            };

            var accountService = new StripeAccountService();
            StripeAccount account = accountService.Create(accountOptions);

In the dashboard log for that request creation I then see:

{
  country: "FR",
  type: "custom",
  email: "bob@example.com",
  tos_acceptance: {
    date: "1524700800",
    ip: "8.8.8.8",
    user_agent: "user-agent-7"
  }
}

Do you have more details about the issue you are encountering?

@KClough
Copy link

KClough commented Apr 26, 2018

@remi-stripe Thanks, error was on my end, I'm good now.

@ob-stripe ob-stripe mentioned this issue Sep 27, 2018
32 tasks
@ob-stripe
Copy link
Contributor

This was implemented in #1283 and will be released with #1293.

@ob-stripe
Copy link
Contributor

Implemented in 20.0.0.

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

Successfully merging a pull request may close this issue.

3 participants