Android Question PayGate by DonManfred v0.2

Pokmot

Member
Licensed User
Longtime User
Continuing from https://www.b4x.com/android/forum/t...anfred-service-intent-must-be-explicit.89147/

Some strange behaviour here (in v0.2).

At first, I could access:

device.DeviceType = null
device.DefaultMsg = "Swipe Card please"

I had errors when trying to access device.DeviceActivated, .DeviceConnected and .DeviceReadyForSwipe:

B4X:
java.lang.RuntimeException: Method: getDeviceReadyForSwipe not found in: com.SafeWebServices.PaymentGateway.PGSwipeIPS
java.lang.RuntimeException: Method: getDeviceConnected not found in: com.SafeWebServices.PaymentGateway.PGSwipeIPS
java.lang.RuntimeException: Method: getDeviceActivated not found in: com.SafeWebServices.PaymentGateway.PGSwipeIPS

In Activity_Create I have:
B4X:
  Dim pg As SwipeController
  pg.Initialize("swipe", 30, True, True, "IPS")

I tried device.requestSwipe and it made no difference.

I wanted to call pg.keepAlive in swipe_onDeviceReadyForSwipe so I moved my "Dim" to "Sub Globals".

Before that my code ran well, and swipe_onDeviceDisconnected, swipe_onDeviceConnected and swipe_onDeviceReadyForSwipe worked just fine.

Then I got this error:
B4X:
java.lang.IllegalArgumentException: method lstw.swiper.main._swipe_ondevicereadyforswipe argument 1 has type de.donmanfred.PGSwipeDeviceWrapper, got com.SafeWebServices.PaymentGateway.PGSwipeIPS

So I moved my Dim statement back to Activity_Create - and I STILL get the same error message.

This now happens for all of my 3 events. I have restarted B4A and restarted my tablet, but the code has completely stopped working.

To confirm - the code worked before, and after moving the Dim statement to Sub Globals and back to Activity_Create - the identical code has stopped working.

The code is

B4X:
Sub swipe_onDeviceReadyForSwipe(device As SwipeDevice)
  Label1.Text = "Ready for swipe"
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
NO NEED to use my Username in all your Threads!!!

Upload the app you have written so far. Posting incomplete codesnipperts is of no help for me
 
Upvote 0

Pokmot

Member
Licensed User
Longtime User
Sure, will take note of that. Here's the code so far.
 

Attachments

  • B4ASwiper.zip
    12.1 KB · Views: 265
Upvote 0

Pokmot

Member
Licensed User
Longtime User
NOTHING is used in your code!? WHY?
I have added, edited and removed code and tried various things. Not everything I have tried is in the code as it stands. I have tried calling swipe_onSwipedCard for instance. But at the moment nothing runs due to the error message "java.lang.IllegalArgumentException: method lstw.swiper.main._swipe_ondevicereadyforswipe argument 1 has type de.donmanfred.PGSwipeDeviceWrapper, got com.SafeWebServices.PaymentGateway.PGSwipeIPS"
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
PGSwipeIPS
i´ve change the events to get a PGSqipeIPS now.

B4X:
Sub swipe_onDeviceDisconnected(device As PGSwipeIPS)
    'Label1.Text = device
    Label1.Text = "Device is Disconnected"
    Label2.Text = ""
    Label3.Text = Label3.Text & "Disconnected "
End Sub


Sub swipe_onDeviceConnected(device As PGSwipeIPS)
    Label1.Text = "Device is Connected"
    'Label2.Text = "Hello"
    Label2.Text = device.DefaultMsg
    Label3.Text = Label3.Text & "OnDeviceConnected "
    device.requestSwipe
End Sub


Sub swipe_onDeviceReadyForSwipe(device As PGSwipeIPS)
'    Label1.Text = device
  Label1.Text = "Ready for swipe"
    'Label2.Text = "readyreadyready"
'    Label3.Text = Label3.Text & "onDeviceReadyForSwipe "
End Sub


Sub swipe_onSwipedCard(card As String, device As PGSwipeIPS)
    'Label1.Text = device
    Label1.Text = "Test3-Swiped"
    Label2.Text = card
    Label3.Text = Label3.Text & "onSwipedCard "
End Sub


If this does not bring us a BIG STEP forward then i must give up. I nearly spent 10 Hours now of doing the wrapper, reading docs, anylizing the example...
 

Attachments

  • PayGateV0.3.zip
    9.2 KB · Views: 262
Upvote 0
Top