// Copyright © 2022 Olo Inc. All rights reserved. // This software is made available under the Olo Pay SDK License (See LICENSE.md file) package com.olopaysdkreactnative.extensions import com.facebook.react.bridge.Arguments import com.facebook.react.bridge.ReadableMap import com.olo.olopay.data.IPaymentMethod import com.olo.olopay.data.OloPayEnvironment import com.olopaysdkreactnative.data.DataKeys fun IPaymentMethod.toMap(): ReadableMap { val data = Arguments.createMap() data.putString(DataKeys.IDKey, this.id ?: "") data.putString(DataKeys.Last4Key, this.last4 ?: "") data.putString(DataKeys.CardTypeKey, this.cardType?.description ?: "") data.putString(DataKeys.ExpirationMonthKey, this.expirationMonth?.toString() ?: "") data.putString(DataKeys.ExpirationYearKey, this.expirationYear?.toString() ?: "") data.putString(DataKeys.PostalCodeKey, this.postalCode ?: "") data.putString(DataKeys.CountryCodeKey, this.country ?: "") data.putBoolean(DataKeys.IsDigitalWalletKey, this.isGooglePay) data.putBoolean(DataKeys.ProductionEnvironmentKey, this.environment == OloPayEnvironment.Production) return data }