File tree Expand file tree Collapse file tree
ground_control_client/lib/src/test_tools/builders Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import 'package:ground_control_client/ground_control_client.dart' ;
2+ import 'package:ground_control_client/ground_control_client_test_tools.dart' ;
3+
4+ class PaymentMethodBuilder {
5+ String _id;
6+ String _type;
7+ PaymentMethodCard ? _card;
8+
9+ PaymentMethodBuilder ()
10+ : _id = 'pm_test_1234567890' ,
11+ _type = 'card' ,
12+ _card = PaymentMethodCardBuilder ().build ();
13+
14+ PaymentMethodBuilder withId (String id) {
15+ _id = id;
16+ return this ;
17+ }
18+
19+ PaymentMethodBuilder withType (String type) {
20+ _type = type;
21+ return this ;
22+ }
23+
24+ PaymentMethodBuilder withCard (PaymentMethodCard ? card) {
25+ _card = card;
26+ return this ;
27+ }
28+
29+ PaymentMethodBuilder withCardBuilder (PaymentMethodCardBuilder cardBuilder) {
30+ _card = cardBuilder.build ();
31+ return this ;
32+ }
33+
34+ PaymentMethod build () {
35+ return PaymentMethod (
36+ id: _id,
37+ type: _type,
38+ card: _card,
39+ );
40+ }
41+ }
Original file line number Diff line number Diff line change 1+ import 'package:ground_control_client/ground_control_client.dart' ;
2+
3+ class PaymentMethodCardBuilder {
4+ String _brand;
5+ String _last4;
6+ int _expMonth;
7+ int _expYear;
8+ String ? _funding;
9+ String ? _country;
10+
11+ PaymentMethodCardBuilder ()
12+ : _brand = 'visa' ,
13+ _last4 = '4242' ,
14+ _expMonth = 12 ,
15+ _expYear = 2025 ,
16+ _funding = 'credit' ,
17+ _country = 'US' ;
18+
19+ PaymentMethodCardBuilder withBrand (String brand) {
20+ _brand = brand;
21+ return this ;
22+ }
23+
24+ PaymentMethodCardBuilder withLast4 (String last4) {
25+ _last4 = last4;
26+ return this ;
27+ }
28+
29+ PaymentMethodCardBuilder withExpMonth (int expMonth) {
30+ _expMonth = expMonth;
31+ return this ;
32+ }
33+
34+ PaymentMethodCardBuilder withExpYear (int expYear) {
35+ _expYear = expYear;
36+ return this ;
37+ }
38+
39+ PaymentMethodCardBuilder withFunding (String ? funding) {
40+ _funding = funding;
41+ return this ;
42+ }
43+
44+ PaymentMethodCardBuilder withCountry (String ? country) {
45+ _country = country;
46+ return this ;
47+ }
48+
49+ PaymentMethodCard build () {
50+ return PaymentMethodCard (
51+ brand: _brand,
52+ last4: _last4,
53+ expMonth: _expMonth,
54+ expYear: _expYear,
55+ funding: _funding,
56+ country: _country,
57+ );
58+ }
59+ }
Original file line number Diff line number Diff line change 11export 'billing/owner_builder.dart' ;
22export 'billing/billing_info_builder.dart' ;
3+ export 'billing/payment_method_builder.dart' ;
4+ export 'billing/payment_method_card_builder.dart' ;
35export 'role_builder.dart' ;
46export 'project_builder.dart' ;
57export 'user_builder.dart' ;
You can’t perform that action at this time.
0 commit comments