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

How to set the report type id in the reportRuns create method? #2

Open
bwfrieds opened this issue Oct 12, 2020 · 1 comment
Open

How to set the report type id in the reportRuns create method? #2

bwfrieds opened this issue Oct 12, 2020 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@bwfrieds
Copy link

I'm trying to follow the nodejs api examples but I'm lost. Here is all of my test dart file.

`//
import 'package:stripedart/stripedart.dart' as sd;

const liveApiKey = 'sk_live_your_key_here';

void main() {
final start = DateTime(2020, 7, 1, 0, 0, 0, 0, 0); // q3 start
final end = DateTime(2020, 9, 25, 0, 0, 0, 0, 0); // q3 end
final payouts4 = 'payout_reconciliation.itemized.4';
final columns = [
'created',
'charge_created',
'created_utc',
'charge_created_utc',
'payment_intent_id',
'automatic_payout_id',
'gross',
'fee',
'net'
];

var paramsMap1 = <String, dynamic>{}
..putIfAbsent('report_type', () => 'payouts.itemized.1') // probably incorrect
..putIfAbsent('interval_start', () => truncateLast3(start.millisecondsSinceEpoch.toString()))
..putIfAbsent('interval_end', () => truncateLast3(end.millisecondsSinceEpoch.toString()));

var paramsMap2 = <String, dynamic>{}
..putIfAbsent('report_type', () => payouts4) // probably incorrect
..putIfAbsent('timezone', () => 'America/Chicago') // valid with cUrl
..putIfAbsent('interval_start', () => truncateLast3(start.millisecondsSinceEpoch.toString()))
..putIfAbsent('interval_end', () => truncateLast3(end.millisecondsSinceEpoch.toString()))
..putIfAbsent('columns', () => columns);

var stripe = sd.Stripe(liveApiKey);

// how do I set the report type id properly?
stripe.reportRuns.create(params: paramsMap1).then((jsonResponse) => print(jsonResponse));
stripe.reportRuns.create(params: paramsMap2).then((jsonResponse) => print(jsonResponse));
}

String truncateLast3(final String s) {
//
return s.substring(0, s.length - 3);
}
`
I just keep getting errors for unknown parameters.

@bwfrieds
Copy link
Author

I can send you the curl equivalent, if that would be helpful. They run fine with curl.

@LucaIaconelli LucaIaconelli added the question Further information is requested label Oct 23, 2020
@LucaIaconelli LucaIaconelli self-assigned this Oct 23, 2020
afpatmin referenced this issue in afpatmin/stripe-dart Feb 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants