PaylinkGatewayOrderRequest.fromMap constructor

PaylinkGatewayOrderRequest.fromMap(
  1. Map<String, dynamic> data
)

Implementation

factory PaylinkGatewayOrderRequest.fromMap(Map<String, dynamic> data) {
  List<PaylinkProduct> products = (data['products'] as List<dynamic>?)
          ?.map((product) =>
              PaylinkProduct.fromMap(product as Map<String, dynamic>))
          .toList() ??
      [];

  return PaylinkGatewayOrderRequest(
    amount: data['amount'] ?? 0.0,
    orderNumber: data['orderNumber'] ?? '',
    callBackUrl: data['callBackUrl'] ?? '',
    clientEmail: data['clientEmail'] ?? '',
    clientName: data['clientName'] ?? '',
    clientMobile: data['clientMobile'] ?? '',
    note: data['note'] ?? '',
    cancelUrl: data['cancelUrl'] ?? '',
    products: products,
    supportedCardBrands: List<String>.from(data['supportedCardBrands'] ?? []),
    currency: data['currency'] ?? '',
    smsMessage: data['smsMessage'] ?? '',
    displayPending: data['displayPending'] ?? true,
    receivers: data['receivers'],
    partnerPortion: data['partnerPortion'],
    metadata: data['metadata'],
  );
}