import 'dart:convert'; class ApplePayResponse { PaymentMethod paymentMethod; dynamic billingContact; dynamic shippingMethod; dynamic shippingContact; Token token; ApplePayResponse( {this.paymentMethod, this.billingContact, this.shippingMethod, this.shippingContact, this.token}); ApplePayResponse.fromJson(Map jsonValue) { paymentMethod = jsonValue['paymentMethod'] != null ? new PaymentMethod.fromJson(jsonValue['paymentMethod']) : null; // billingContact = json['billingContact'] != null ? json['billingContact'] : ""; // shippingMethod = json['shippingMethod'] != null ? json['shippingMethod'] : ""; // shippingContact = json['shippingContact'] != null ? json['shippingContact'] : ""; token = jsonValue['token'] != null ? new Token.fromJson(json.decode(jsonValue['token'])) : null; } Map toJson() { final Map data = new Map(); if (this.paymentMethod != null) { data['paymentMethod'] = this.paymentMethod.toJson(); } data['billingContact'] = this.billingContact; data['shippingMethod'] = this.shippingMethod; data['shippingContact'] = this.shippingContact; if (this.token != null) { data['token'] = this.token.toJson(); } return data; } } class PaymentMethod { dynamic network; dynamic displayName; dynamic type; PaymentMethod({this.network, this.displayName, this.type}); PaymentMethod.fromJson(Map json) { network = json['network']; displayName = json['displayName']; type = json['type']; } Map toJson() { final Map data = new Map(); data['network'] = this.network; data['displayName'] = this.displayName; data['type'] = this.type; return data; } } class Token { String version; String data; String signature; Header header; Token({this.version, this.data, this.signature, this.header}); Token.fromJson(Map json) { version = json['version']; data = json['data']; signature = json['signature']; header = json['header'] != null ? new Header.fromJson(json['header']) : null; } Map toJson() { final Map data = new Map(); data['version'] = this.version; data['data'] = this.data; data['signature'] = this.signature; if (this.header != null) { data['header'] = this.header.toJson(); } return data; } } class Header { String ephemeralPublicKey; String publicKeyHash; String transactionId; Header({this.ephemeralPublicKey, this.publicKeyHash, this.transactionId}); Header.fromJson(Map json) { ephemeralPublicKey = json['ephemeralPublicKey']; publicKeyHash = json['publicKeyHash']; transactionId = json['transactionId']; } Map toJson() { final Map data = new Map(); data['ephemeralPublicKey'] = this.ephemeralPublicKey; data['publicKeyHash'] = this.publicKeyHash; data['transactionId'] = this.transactionId; return data; } }