triniwiz / triniwiz/nativescript-plugins

[android] EphemeralKeyProvider called 4 times

Open
#135 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
87
Forks
57
Avg merge
1h 36m
Merged PRs (30d)
4

Description

Hi @triniwiz @NathanWalker

Sorry for reporting 3 separated issues but I discover then as i go!

I've seen 4 call to get the Ephemeral key! the problem come from com.stripe.android.CustomerSession.initCustomerSession that accept a 3rd attribute to avoid sending other request when PaymentSession is initialized. see here

We can expose an attribute at the constructor as below but strangely enough setting shouldPrefetchCustomer to false this does prevent the prefetech call but doesn't resolve the problem !! I'll investigate that more, I yhink the problem come from the PaymentSession !

Also Application.android.contextis deprecated for Utils.android.getApplicationContext()

export class StripeStandardCustomerSession {
    constructor(shouldPrefetchEphemeralKey: boolean = false) {
        StripeStandardConfig.shared.initPaymentConfiguration();
        com.stripe.android.CustomerSession.initCustomerSession(StripeStandardCustomerSession.context, createKeyProvider(), shouldPrefetchEphemeralKey);
        this.native = com.stripe.android.CustomerSession.getInstance();
    }
    static get context() {
        return Utils.android.getApplicationContext();
    }
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading StripeStandardCustomerSession and the calls to CustomerSession.initCustomerSession, PaymentSession, and createKeyProvider described in the issue. Reproduce or trace the four EphemeralKeyProvider calls, then verify the constructor option and Utils.android.getApplicationContext() behavior; done means the redundant requests and deprecated context usage are resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, typescript
Domain
mobile, payments
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.