fromJson static method
Implementation
static Invoice? fromJson(Map<String, dynamic>? json) {
if (json == null) {
return null;
}
return Invoice(
currency: (json['currency'] as String?) ?? '',
priceParts: List<LabeledPricePart>.from(
tdListFromJson(json['price_parts'])
.map((item) => LabeledPricePart.fromJson(tdMapFromJson(item)))
.whereType<LabeledPricePart>(),
),
subscriptionPeriod: (json['subscription_period'] as int?) ?? 0,
maxTipAmount: (json['max_tip_amount'] as int?) ?? 0,
suggestedTipAmounts: List<int>.from(
tdListFromJson(
json['suggested_tip_amounts'],
).map((item) => int.tryParse((item as dynamic)?.toString() ?? '') ?? 0),
),
recurringPaymentTermsOfServiceUrl:
(json['recurring_payment_terms_of_service_url'] as String?) ?? '',
termsOfServiceUrl: (json['terms_of_service_url'] as String?) ?? '',
isTest: (json['is_test'] as bool?) ?? false,
needName: (json['need_name'] as bool?) ?? false,
needPhoneNumber: (json['need_phone_number'] as bool?) ?? false,
needEmailAddress: (json['need_email_address'] as bool?) ?? false,
needShippingAddress: (json['need_shipping_address'] as bool?) ?? false,
sendPhoneNumberToProvider:
(json['send_phone_number_to_provider'] as bool?) ?? false,
sendEmailAddressToProvider:
(json['send_email_address_to_provider'] as bool?) ?? false,
isFlexible: (json['is_flexible'] as bool?) ?? false,
);
}