ChargeCreateOptions.fromJson constructor
ChargeCreateOptions.fromJson(
- Object? json
Implementation
factory ChargeCreateOptions.fromJson(Object? json) {
final map = (json as Map).cast<String, Object?>();
return ChargeCreateOptions(
amount: map['amount'] == null ? null : (map['amount'] as num).toInt(),
applicationFee: map['application_fee'] == null
? null
: (map['application_fee'] as num).toInt(),
applicationFeeAmount: map['application_fee_amount'] == null
? null
: (map['application_fee_amount'] as num).toInt(),
capture: map['capture'] == null ? null : (map['capture'] as bool),
currency: map['currency'] == null ? null : (map['currency'] as String),
customer: map['customer'] == null ? null : (map['customer'] as String),
description:
map['description'] == null ? null : (map['description'] as String),
destination: map['destination'] == null
? null
: ChargeDestination.fromJson(map['destination']),
expand: map['expand'] == null
? null
: (map['expand'] as List<Object?>)
.map((el) => (el as String))
.toList(),
metadata: map['metadata'] == null
? null
: (map['metadata'] as Map).cast<String, Object?>().map((
key,
value,
) =>
MapEntry(
key,
(value as String),
)),
onBehalfOf:
map['on_behalf_of'] == null ? null : (map['on_behalf_of'] as String),
radarOptions: map['radar_options'] == null
? null
: RadarRadarOptions.fromJson(map['radar_options']),
receiptEmail: map['receipt_email'] == null
? null
: (map['receipt_email'] as String),
shipping: map['shipping'] == null
? null
: ChargeCreateOptionsShipping.fromJson(map['shipping']),
source: map['source'] == null ? null : (map['source'] as String),
statementDescriptor: map['statement_descriptor'] == null
? null
: (map['statement_descriptor'] as String),
statementDescriptorSuffix: map['statement_descriptor_suffix'] == null
? null
: (map['statement_descriptor_suffix'] as String),
transferData: map['transfer_data'] == null
? null
: ChargeCreateOptionsTransferData.fromJson(map['transfer_data']),
transferGroup: map['transfer_group'] == null
? null
: (map['transfer_group'] as String),
);
}