コード例 #1
0
  public void testAdapterProxiesAuthorizationCode() throws ConfigurationException {
    Intent successfulPaypal = new Intent();
    PayPalAuthorization successfulAuthorization =
        new PayPalAuthorization(
            PayPalConfiguration.ENVIRONMENT_NO_NETWORK, "fake_paypal_authorization_code", "");
    successfulPaypal.putExtra(
        PayPalFuturePaymentActivity.EXTRA_RESULT_AUTHORIZATION, successfulAuthorization);

    PayPalAccountBuilder accountBuilder =
        PayPalHelper.getBuilderFromActivity(null, Activity.RESULT_OK, successfulPaypal);
    String json = Utils.getGson().toJson(accountBuilder.build());
    assertTrue(json.contains("fake_paypal_authorization_code"));
  }
コード例 #2
0
  public void testGetBuilderFromActivityDoesNotIncludeEmailIfItWasNotPresent()
      throws ConfigurationException {
    Intent successfulPaypal = new Intent();
    PayPalAuthorization successfulAuthorization =
        new PayPalAuthorization(
            PayPalConfiguration.ENVIRONMENT_NO_NETWORK, "fake_paypal_authorization_code", "");
    successfulPaypal.putExtra(
        PayPalFuturePaymentActivity.EXTRA_RESULT_AUTHORIZATION, successfulAuthorization);

    PayPalAccountBuilder accountBuilder =
        PayPalHelper.getBuilderFromActivity(null, Activity.RESULT_OK, successfulPaypal);
    PayPalAccount account = accountBuilder.build();
    assertEquals("", account.getEmail());
  }