Braintree/src/main/java/com/braintreepayments/api/UnionPay.java
public static void fetchCapabilities(final BraintreeFragment fragment, final String cardNumber) {
        fragment.waitForConfiguration(new ConfigurationListener() {
            @Override
            public void onConfigurationFetched(Configuration configuration) {
                if (!configuration.getUnionPay().isEnabled()) {
                    fragment.postCallback(new ConfigurationException("UnionPay is not enabled"));
                    return;
                }

                String fetchCapabilitiesUrl = Uri.parse(UNIONPAY_CAPABILITIES_PATH)
                        .buildUpon()
                        .appendQueryParameter("creditCard[number]", cardNumber)
                        .build()
                        .toString();

                fragment.getHttpClient().get(fetchCapabilitiesUrl, new HttpResponseCallback() {
                    @Override
                    public void success(String responseBody) {
                        fragment.postCallback(UnionPayCapabilities.fromJson(responseBody));
                        fragment.sendAnalyticsEvent("union-pay.capabilities-received");
                    }

                    @Override
                    public void failure(Exception exception) {
                        fragment.postCallback(exception);
                        fragment.sendAnalyticsEvent("union-pay.capabilities-failed");
                    }
                });
            }
        });
    }
public static void fetchCapabilities(final BraintreeFragment fragment, final String cardNumber) {
        fragment.waitForConfiguration(new ConfigurationListener() {
            @Override
            public void onConfigurationFetched(Configuration configuration) {
                if (!configuration.getUnionPay().isEnabled()) {
                    fragment.postCallback(new ConfigurationException("UnionPay is not enabled"));
                    return;
                }

                String fetchCapabilitiesUrl = Uri.parse(UNIONPAY_CAPABILITIES_PATH)
                        .buildUpon()
                        .appendQueryParameter("creditCard[number]", cardNumber)
                        .build()
                        .toString();

                fragment.getHttpClient().get(fetchCapabilitiesUrl, new HttpResponseCallback() {
                    @Override
                    public void success(String responseBody) {
                        fragment.postCallback(UnionPayCapabilities.fromJson(responseBody));
                        fragment.sendAnalyticsEvent("union-pay.capabilities-received");
                    }

                    @Override
                    public void failure(Exception exception) {
                        fragment.postCallback(exception);
                        fragment.sendAnalyticsEvent("union-pay.capabilities-failed");
                    }
                });
            }
        });
    }
public static void fetchCapabilities ( final BraintreeFragment fragment , final String cardNumber ) { fragment . waitForConfiguration ( new ConfigurationListener ( ) { @ Override public void onConfigurationFetched ( Configuration configuration ) { if ( ! configuration . getUnionPay ( ) . isEnabled ( ) ) { fragment . postCallback ( new ConfigurationException ( "UnionPay is not enabled" ) ) ; return ; } String fetchCapabilitiesUrl = Uri . parse ( UNIONPAY_CAPABILITIES_PATH ) . buildUpon ( ) . appendQueryParameter ( "creditCard[number]" , cardNumber ) . build ( ) . toString ( ) ; fragment . getHttpClient ( ) . get ( fetchCapabilitiesUrl , new HttpResponseCallback ( ) { @ Override public void success ( String responseBody ) { fragment . postCallback ( UnionPayCapabilities . fromJson ( responseBody ) ) ; fragment . sendAnalyticsEvent ( "union-pay.capabilities-received" ) ; } @ Override public void failure ( Exception exception ) { fragment . postCallback ( exception ) ; fragment . sendAnalyticsEvent ( "union-pay.capabilities-failed" ) ; } } ) ; } } ) ; }
Fetches the capabilities of a card. If the card needs to be enrolled use {@link
UnionPay#enroll(BraintreeFragment, UnionPayCardBuilder)}.
<p/>
On completion, returns the {@link UnionPayCapabilities} to
{@link com.braintreepayments.api.interfaces.UnionPayListener#onCapabilitiesFetched(UnionPayCapabilities)}
<p/>
On error, an exception will be passed back to
{@link com.braintreepayments.api.interfaces.BraintreeErrorListener#onError(Exception)}

@param fragment {@link BraintreeFragment}
@param cardNumber The card number to check for Union Pay capabilities.
Fetches the capabilities of a card . If the card needs to be enrolled use { @link UnionPay#enroll ( BraintreeFragment UnionPayCardBuilder ) } . <p / > On completion returns the { @link UnionPayCapabilities } to { @link com . braintreepayments . api . interfaces . UnionPayListener#onCapabilitiesFetched ( UnionPayCapabilities ) } <p / > On error an exception will be passed back to { @link com . braintreepayments . api . interfaces . BraintreeErrorListener#onError ( Exception ) }