     }
 }
 
-extension BSApplePayPaymentNetworkType: CustomStringConvertible {
+
+// This extention is required only to extract enum string values of the OBJC Passkit type
+extension PKPaymentMethodType: CustomStringConvertible {
     public var description: String {
         switch self {
         case .unknown:

    public init(payment:PKPayment)
    {
        self.payment = payment;
        //self.paymentdataString = String(data:payment.token.paymentData, encoding: .utf8);
        self.token = payment.token
        self.tokenPaymentNetwork = payment.token.paymentMethod.network?.rawValue;
        self.transactionId = payment.token.transactionIdentifier;
        self.tokenInstrumentName = payment.token.paymentMethod.displayName;
        self.billingContact = payment.billingContact;
        self.shippingContact = payment.shippingContact;
        
        
        try {
         //   self.tokenPaymentNetworkType = payment.token.paymentMethod.type.rawValue;
            
            let networkType : BSApplePayNetworkType =payment.token.paymentMethod.type
        }
    }
}

extension BSApplePayInfo: DictionaryConvertible
{
//    public func toDictionary() -> [String : Any] {
//        var map = [String:Any]();
//        map.setValueIfExists(value: self.token, for: "token");
//        map.setValueIfExists(value: self.tokenInstrumentName, for: "token_instrument_name");
//        map.setValueIfExists(value: self.tokenPaymentNetwork, for: "token_payment_network");
//        map.setValueIfExists(value: self.transactionId, for: "transactionIdentifier");
//        map.setValueIfExists(value: self.billingContact?.toDictionary(), for: "billingContact");
//        map.setValueIfExists(value: self.shippingContact?.toDictionary(), for: "shippingContact");
//        return map;
//    }

    public func toDictionary() throws -> [String: Any] {

        let desrilaziedToken = try JSONSerialization.jsonObject(with: payment.token.paymentData, options: JSONSerialization.ReadingOptions())

        let shippingContactDict = [
                //"addressLines": shippingContact?.postalAddress?.description,
                //"country": shippingContact?.postalAddress?.country,
                //"countryCode": shippingContact?.postalAddress?.isoCountryCode,
                "familyName": shippingContact?.name?.familyName ?? "",
                "givenName": shippingContact?.name?.givenName ?? "",
                //"locality": shippingContact?.postalAddress?.street,
                //"emailAddress": shippingContact?.emailAddress,
                //"phoneNumber": shippingContact?.phoneNumber?.stringValue,

            return "prepaid"
        case .store:
            return "store"
        default:
            return "unknown"
        
        }
    }
}
