Skip to content

Commit 114518a

Browse files
author
serverpod_cloud
committed
feat: 274bdb44abb17b5828993fa73823330f4fe20176
1 parent 5dc90b8 commit 114518a

3 files changed

Lines changed: 46 additions & 6 deletions

File tree

ground_control_client/lib/src/protocol/domains/billing/models/billing_info.dart

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,10 @@ abstract class BillingInfo implements _i1.SerializableModel {
7676
country: jsonSerialization['country'] as String,
7777
vatNumber: jsonSerialization['vatNumber'] as String?,
7878
vatType: jsonSerialization['vatType'] as String?,
79-
customerType: _i2.BillingCustomerType.fromJson(
80-
(jsonSerialization['customerType'] as String)),
79+
customerType: jsonSerialization['customerType'] == null
80+
? null
81+
: _i2.BillingCustomerType.fromJson(
82+
(jsonSerialization['customerType'] as String)),
8183
);
8284
}
8385

@@ -112,7 +114,7 @@ abstract class BillingInfo implements _i1.SerializableModel {
112114

113115
String? vatType;
114116

115-
_i2.BillingCustomerType customerType;
117+
_i2.BillingCustomerType? customerType;
116118

117119
/// Returns a shallow copy of this [BillingInfo]
118120
/// with some or all fields replaced by the given arguments.
@@ -151,7 +153,7 @@ abstract class BillingInfo implements _i1.SerializableModel {
151153
'country': country,
152154
if (vatNumber != null) 'vatNumber': vatNumber,
153155
if (vatType != null) 'vatType': vatType,
154-
'customerType': customerType.toJson(),
156+
if (customerType != null) 'customerType': customerType?.toJson(),
155157
};
156158
}
157159

@@ -217,7 +219,7 @@ class _BillingInfoImpl extends BillingInfo {
217219
String? country,
218220
Object? vatNumber = _Undefined,
219221
Object? vatType = _Undefined,
220-
_i2.BillingCustomerType? customerType,
222+
Object? customerType = _Undefined,
221223
}) {
222224
return BillingInfo(
223225
id: id ?? this.id,
@@ -234,7 +236,9 @@ class _BillingInfoImpl extends BillingInfo {
234236
country: country ?? this.country,
235237
vatNumber: vatNumber is String? ? vatNumber : this.vatNumber,
236238
vatType: vatType is String? ? vatType : this.vatType,
237-
customerType: customerType ?? this.customerType,
239+
customerType: customerType is _i2.BillingCustomerType?
240+
? customerType
241+
: this.customerType,
238242
);
239243
}
240244
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import 'package:ground_control_client/ground_control_client.dart';
2+
3+
class PaymentSetupIntentBuilder {
4+
String _id;
5+
String _clientSecret;
6+
String _status;
7+
8+
PaymentSetupIntentBuilder()
9+
: _id = 'seti_test_123',
10+
_clientSecret = 'mock_secret',
11+
_status = 'requires_payment_method';
12+
13+
PaymentSetupIntentBuilder withId(String id) {
14+
_id = id;
15+
return this;
16+
}
17+
18+
PaymentSetupIntentBuilder withClientSecret(String clientSecret) {
19+
_clientSecret = clientSecret;
20+
return this;
21+
}
22+
23+
PaymentSetupIntentBuilder withStatus(String status) {
24+
_status = status;
25+
return this;
26+
}
27+
28+
PaymentSetupIntent build() {
29+
return PaymentSetupIntent(
30+
id: _id,
31+
clientSecret: _clientSecret,
32+
status: _status,
33+
);
34+
}
35+
}

ground_control_client/lib/src/test_tools/builders/builders.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ export 'billing/owner_builder.dart';
22
export 'billing/billing_info_builder.dart';
33
export 'billing/payment_method_builder.dart';
44
export 'billing/payment_method_card_builder.dart';
5+
export 'billing/payment_setup_intent_builder.dart';
56
export 'role_builder.dart';
67
export 'project_builder.dart';
78
export 'user_builder.dart';

0 commit comments

Comments
 (0)