public ShippingInformation getShippingInformation() { if (!validateAllFields()) { return null; } Address address = new Address.Builder().setCity(mCityEditText.getText().toString()) .setCountry(mCountryAutoCompleteTextView.getSelectedCountryCode()).setLine1 (mAddressEditText.getText().toString()).setLine2 (mAddressEditText2.getText().toString()).setPostalCode (mPostalCodeEditText.getText().toString()).setState(mStateEditText .getText().toString()).build(); ShippingInformation shippingInformation = new ShippingInformation(address, mNameEditText .getText().toString(), mPhoneNumberEditText.getText().toString()); return shippingInformation; }
@NonNull private ShippingInformation getExampleShippingInfo() { Address address = new Address.Builder() .setCity("San Francisco") .setCountry("US") .setLine1("123 Market St") .setLine2("#345") .setPostalCode("94107") .setState("CA") .build(); return new ShippingInformation(address, "Fake Name", "(555) 555-5555"); }
mCountryAutoCompleteTextView = mShippingInfoWidget.findViewById(R.id.country_autocomplete_aaw); mAddress = new Address.Builder() .setCity("San Francisco") .setState("CA") .setCountry("US")
@Test public void createTokenSynchronous_withValidAccount_passesIntegrationTest() { try { final Address exampleAddress = new Address .Builder() .setCity("SF") .setCountry("US") .setState("CA").build(); final Map<String, Object> exampleLegalEntity = new HashMap<String, Object>() {{ put("personal_address", exampleAddress.toMap()); put("type", "individual"); put("ssn_last_4", "1234"); put("first_name", "Kathy"); put("last_name", "Sun"); }}; Stripe stripe = new Stripe(mContext, FUNCTIONAL_PUBLISHABLE_KEY); TestLoggingListener listener = new TestLoggingListener(true); stripe.setLoggingResponseListener(listener); Token token = stripe.createAccountTokenSynchronous( AccountParams.createAccountParams(true, exampleLegalEntity)); assertNotNull(token); assertEquals(Token.TYPE_ACCOUNT, token.getType()); assertFalse(token.getLivemode()); assertFalse(token.getUsed()); assertNotNull(token.getId()); assertAllLogsAreValid(listener, 2); } catch (StripeException stripeEx) { fail(stripeEx.getMessage()); } }
@Test public void builderConstructor_whenCalled_createsExpectedAddress() { Address address = new Address.Builder() .setCity("San Francisco") .setCountry("US") .setLine1("123 Market St") .setLine2("#345") .setPostalCode("94107") .setState("CA") .build(); assertMapEquals(address.toMap(), mAddress.toMap()); }
private ShippingInformation getExampleShippingInfo() { Address address = new Address.Builder() .setCity("San Francisco") .setCountry("US") .setLine1("123 Market St") .setLine2("#345") .setPostalCode("94107") .setState("CA") .build(); return new ShippingInformation(address, "Fake Name", "(555) 555-5555"); } }