@@ -20,6 +20,7 @@ import com.google.gson.JsonObject
20
20
import io.snabble.sdk.PaymentMethod
21
21
import io.snabble.sdk.Project
22
22
import io.snabble.sdk.Snabble
23
+ import io.snabble.sdk.checkout.AuthorizePaymentRequest
23
24
import io.snabble.sdk.utils.GsonHolder
24
25
import io.snabble.sdk.utils.Logger
25
26
@@ -219,7 +220,18 @@ class GooglePayHelper(
219
220
project.checkout.abortError()
220
221
} else {
221
222
val base64Token = String (Base64 .encode(token.toByteArray(), Base64 .NO_WRAP ))
222
- project.checkout.authorizePayment(base64Token)
223
+ val address: BillingAddress ? = jsonPaymentData.get(" paymentMethodData" )
224
+ ?.asJsonObject?.get(" info" )
225
+ ?.asJsonObject?.get(" billingAddress" )
226
+ ?.let { GsonHolder .get().fromJson(it, BillingAddress ::class .java) }
227
+ project.checkout.authorizePayment(
228
+ AuthorizePaymentRequest (
229
+ encryptedOrigin = base64Token,
230
+ name = address?.name,
231
+ countryCode = address?.countryCode,
232
+ state = address?.administrativeArea
233
+ )
234
+ )
223
235
}
224
236
} catch (e: Exception ) {
225
237
project.checkout.abortError()
@@ -240,6 +252,8 @@ class GooglePayHelper(
240
252
}
241
253
}
242
254
255
+ private data class BillingAddress (val name : String? , val countryCode : String? , val administrativeArea : String? )
256
+
243
257
interface IsReadyToPayListener {
244
258
fun isReadyToPay (isReadyToPay : Boolean )
245
259
}
0 commit comments