purchaseGooglePlayOneTimePurchase method

  1. @override
Future<LinkFiveActiveProducts> purchaseGooglePlayOneTimePurchase(
  1. GooglePlayPurchaseDetails purchaseDetails,
  2. OneTimePurchaseOfferDetailsWrapper otpDetails
)
override

after a one time purchase purchase on Google we post the data to LinkFIve

Implementation

@override
Future<LinkFiveActiveProducts> purchaseGooglePlayOneTimePurchase(
    GooglePlayPurchaseDetails purchaseDetails, OneTimePurchaseOfferDetailsWrapper otpDetails) async {
  final uri = _makeUri("api/v1/purchases/user/google/one-time-purchase");
  final purchaseBody = PurchaseRequestOneTimePurchaseGoogle(
    productId: purchaseDetails.productID,
    purchaseToken: purchaseDetails.billingClientPurchase.purchaseToken,
    orderId: purchaseDetails.billingClientPurchase.orderId,
    priceAmountMicros: otpDetails.priceAmountMicros,
    priceCurrencyCode: otpDetails.priceCurrencyCode,
  );

  LinkFiveLogger.d("purchase: $purchaseBody");
  final response =
      await httpClient.post(uri, body: purchaseBody.toJson(), headers: await _headers);

  return _parseOneTimePurchaseListResponse(response);
}