B4J Question Google Purchase Structure

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I saved a Google Purchase structure to a raf file on my Android Device
and want to read it in using B4J on windows

But B4J doesn't know what a Purchase is.

How do I define it?

B4X:
Type  TSubscriptionFileV1(VersionNumber As Int, LastGoogleDate As Long, Subscriptions As List)   
Type  TSubscriptionTypeData(ValidData As Int, DeviceID As String, MacAddress As String, Brackets As Int)

Type  TSubscription(IsValid As Boolean, IsPaid            As Boolean, ProductExpired    As Boolean, ProductEntry         As Int,                    _
                                           IsSubcription    As Boolean, ProductType    As Int,    PurchaseOrderID     As String,                _
                                           PurchaseDate    As Long,    PurchaseState    As Int,    SubscriptionTypeData As TSubscriptionTypeData, GooglePurchase As Purchase, PurchaseEmail As String)



Public  Sub ReadSubscriptions As Boolean
            Dim raf As RandomAccessFile

'ToastMessageShow("ReadSubscriptions", True)

            Try
               '-------------------------------------------------------------------------------------
               '  Read Subscriptions if they exist and we do not have them
               '-------------------------------------------------------------------------------------               
                If  File.Exists("C:\Users\Robert Valentino\Documents\BBs", mFileName) Then
                   Dim FileData     As Object
                   
                    raf.Initialize("C:\Users\Robert Valentino\Documents\BBs", mFileName, True)
                       FileData = raf.ReadEncryptedObject(gBOBs, 0)
                   
                    raf.Close

                   
                   If  (FileData Is TSubscriptionFileV1) = True Then
                        Dim  SubscriptionFile As TSubscriptionFileV1 = FileData
                       
                        Return True
                   End If
                End If               
               
               Return False
           Catch
               
               Return False
           End Try                       
End Sub

How do I make the below code a Purchase structure for B4J

B4X:
{
  "kind": "androidpublisher#productPurchase",
  "purchaseTimeMillis": long,
  "purchaseState": integer,
  "consumptionState": integer,
  "developerPayload": string,
  "orderId": string,
  "purchaseType": integer
}

Thanks
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
FYI I just did a Type

B4X:
    Type  Purchase(Time As Long, State As Int, Consumption As Int, Payload As String, OrderID As String, PurchaseType As Int)

And that at least allowed me to complete reading the file.
 
Upvote 0
Top