I am trying to create a web service method that asynchronously runs a process while the client makes synchronous calls to check the status of the process.
Basically I want a purchase of a product to be triggered (BeginPurchaseDigitalWalletTest), then immediately after the status will be polled via another web call PollTransactionResponse. I have come up with the following so far however it does not seem to be working for me at all and I feel as though I have got this completely wrong.
<WebMethod()> _
Public Function BeginPurchaseDigitalWalletTest(ByVal AgentGUID As String, _
ByVal items() As vrlEbusInterfaces.ShoppingCartItem, _
ByVal WebSessionID As String, _
ByVal Title As String, _
ByVal FirstName As String, _
ByVal LastName As String, _
ByVal Email As String, _
ByVal Company As String, _
ByVal Address1 As String, _
ByVal Address2 As String, _
ByVal Suburb As String, _
ByVal State As String, _
ByVal Phone As String, _
ByVal Country As String, _
ByVal PostCode As String, _
ByVal CardName As String, _
ByVal CardNumber As String, _
ByVal CardExpiry As String, _
ByVal CardCSV As String, _
ByVal IsMember As Boolean, _
ByVal BillingAddress As String, _
ByVal BillingPostcode As String, _
ByVal MailingFirstName As String, _
ByVal MailingLastName As String, _
ByVal MailingAddress1 As String, _
ByVal MailingAddress2 As String, _
ByVal MailingSuburb As String, _
ByVal MailingState As String, _
ByVal MailingPostCode As String, _
ByVal MailingCountry As String, _
ByVal MailingTitle As String, _
ByVal MailingCompany As String, _
ByVal MailingPhone As String, _
ByVal MailingMessage As String, _
ByVal MailingEmail As String, _
ByVal HoldToken As Integer, _
ByVal AdditionalInfo As String, _
ByVal IsGift As Boolean, _
ByVal GiftTo As String, _
ByVal GiftFrom As String, _
ByVal GiftEmail As String, _
ByVal GiftMessage As String, _
ByVal PromoCodeID As Integer, _
ByVal PromoCodeInstance As String, _
ByVal PromoDiscountValue As Integer, _
ByVal GiftCards As vrlEbusInterfaces.GiftCard(), _
ByVal FraudScore As Integer, _
ByVal Club As String, _
ByVal TransactionNotes As String, _
ByVal MerchantTransactionID As String, _
ByVal WebTransactionType As String, _
ByVal callback As AsyncCallback, _
ByVal asyncState As Object) As IAsyncResult
Retu PurchaseAll(AgentGUID, items, WebSessionID, Title, FirstName, LastName, Email, Company, Address1, Address2, Suburb, State, Phone, Country, _
PostCode, CardName, CardNumber, CardExpiry, CardCSV, IsMember, BillingAddress, BillingPostcode, MailingFirstName, MailingLastName, _
MailingAddress1, MailingAddress2, MailingSuburb, MailingState, MailingPostCode, MailingCountry, MailingTitle, MailingCompany, _
MailingPhone, MailingMessage, MailingEmail, HoldToken, AdditionalInfo, IsGift, GiftTo, GiftFrom, GiftEmail, GiftMessage, PromoCodeID, _
PromoCodeInstance, PromoDiscountValue, GiftCards, FraudScore, Club, TransactionNotes, , , , , , MerchantTransactionID, , , WebTransactionType, callback, asyncState)
End Function
<WebMethod()> _
Public Function EndPurchaseDigitalWalletTest(ByVal asyncResult As IAsyncResult) As TransactionResponse
Retu asyncResult
End Function
<WebMethod()> _
Public Function PollTransactionResponse(ByVal webSessionId As String, ByVal email As String) As Boolean
Dim DA As New EbusDAL.DAL(SQLCoectionString)
Dim RetuTransactionResponse As New EbusInterfaces.TransactionResponse
Dim ResponseData As DataTable = DA.GetTransactionSuccess(webSessionId, email)
If (ResponseData.Rows.Count > 0) Then
If ResponseData.Rows(0).Item("TransactionSuccess") = 1 Then
Retu True
End If
End If
Retu False
End Function
