#mattiaferrari_code

1 messages ยท Page 1 of 1 (latest)

sage lindenBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1387356961795739722

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

slender spruce
#

The code that creates the exception is this

    public void discoverReaderAndConnectHandoff() {
        Terminal instance = Terminal.getInstance();

        instance.discoverReaders(
            new DiscoveryConfiguration.HandoffDiscoveryConfiguration(),
            new CustomDiscoveryListener(reader -> {
                instance.connectReader(
                    reader,
                    new ConnectionConfiguration.HandoffConnectionConfiguration(
                        new HandoffReaderListener() {
                            @Override
                            public void onDisconnect(@NonNull DisconnectReason reason) {
                                HandoffReaderListener.super.onDisconnect(reason);
                            }
                        }
                    ),
                    new ReaderCallback() {
                        @Override
                        public void onSuccess(@NonNull Reader reader) {
                            System.out.println("FATTO " + reader.toString());
                        }

                        @Override
                        public void onFailure(@NonNull TerminalException e) {

                        }
                    }
                );
            }),
            new com.stripe.stripeterminal.external.callable.Callback() {
                @Override
                public void onSuccess() {
                    System.out.println("SUCCESS");
                }

                @Override
                public void onFailure(@NonNull TerminalException e) {
                    System.out.println(e.getMessage());
                }
            }
        );
    }

sage lindenBOT
slender spruce
#

after that it seems that the connection still goes through successfully

lofty salmon
#

๐Ÿ‘‹ Happy to help!

slender spruce
#

Hi

lofty salmon
#

What Stripe SDK version are you using ?

slender spruce
#

4.5.0.

lofty salmon
slender spruce
lofty salmon
#

What guide are you following exactly between ?

slender spruce
#

A bit of both

lofty salmon
#

That's not supposed to work like that, these are two different integration flows...

#

You can't have both on the same app

slender spruce
#

Well i'm taking every piece of code that can help.

#

In majority i followed this

lofty salmon
slender spruce
#

app on device with handoff

#

Ok sorry

#

Point-of-sale app on a Stripe smart reader

#

I'm trying out deploying on the s700 devkit

lofty salmon
#

What was the missing part of your reproduction ?

#

Sorry I need to understand how exactly you are facing this issue

slender spruce
#

I called initTerminal with this

public void initTerminal(Context context) {
        TerminalListener listener = new TerminalListener() {
            @Override
            public void onConnectionStatusChange(ConnectionStatus status) {
                System.out.printf("onConnectionStatusChange: %s\n", status);
            }

            @Override
            public void onPaymentStatusChange(PaymentStatus status) {
                System.out.printf("onPaymentStatusChange: %s\n ", status);
            }
        };
        
        LogLevel logLevel = LogLevel.VERBOSE;

        // Create your token provider.
        ConnectionTokenProvider tokenProvider = new ConnectionTokenProvider() {
            @Override
            public void fetchConnectionToken(@NonNull ConnectionTokenCallback callback) {
                try {
                    OkHttpClient client = new OkHttpClient();

                    Request request = new Request.Builder()
                        .url("")
                        .post(RequestBody.create(null, new byte[0])) // Empty body
                        .build();

                   // ecc ecc
                    });
                } catch (Exception e) {
                    callback.onFailure(
                        new ConnectionTokenException("Failed to fetch connection token", e));
                }
            }
        };

        try {
            if (!Terminal.isInitialized()) {
                Terminal.initTerminal(context, logLevel, tokenProvider, listener);
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }


    }
#

Here it uses handoff actually:
well yes but it isn't imported anywhere

#

Maybe i should pass somewhere an instance HandoffRpcCallbackListener

lofty salmon
#

Could you try remove HandoffReaderListener.super.onDisconnect(reason); from your HandoffReaderListener?

slender spruce
#

Yeah but the thing that i intended was that if i was supposed to use any of this

#

Could you try remove HandoffReaderListener.super.onDisconnect(reason); from your HandoffReaderListener?
Ok let me try

lofty salmon
slender spruce
#

Nope still getting the error

#

Let me try deploying the example app to see if i get the error

#

Yeah

#

This is the logcat from the example app

#

The flow still work but i get this error

lofty salmon
#

Ah wait, so this isn't blocking ? the app doesn't crush ?

slender spruce
#

Nono i was just wondering

#

my integration is a bit wacky so im investigating on every error that i see

#

maybe i was missing something that should be integrated

lofty salmon
#

Well this seems to be just a false alarm...

slender spruce
#

No

#

Wait

#

The screenshot above is made using the example app

#

The error is print out also in the example app

lofty salmon
#

Ok then yeah that could be expected then...