PaymentPaymobResponse.fromJson constructor

PaymentPaymobResponse.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory PaymentPaymobResponse.fromJson(Map<String, dynamic> json) {
  return PaymentPaymobResponse(
    success: json['success']?.toString() == "true",
    transactionID: json['id']?.toString(),
    message: json['message']?.toString() ??
        (json['data.message'] != null
            ? Uri.decodeComponent(json['data.message'].toString())
            : ''),
    responseCode: json['txn_response_code']?.toString(),
    amountCents: int.tryParse(json['amount_cents']?.toString() ?? '0') ?? 0,
    dataMessage: json['data.message'] != null
        ? Uri.decodeComponent(json['data.message'].toString())
        : '',
  );
}