Account updateAccount = new Account(); updateAccount.setAccountCode(account.getAccountCode()); CustomFields fields = account.getCustomFields();
Account updateAccount = new Account(); updateAccount.setAccountCode(account.getAccountCode()); CustomFields fields = account.getCustomFields();
final Account accountCodeData = new Account(); accountCodeData.setAccountCode(account.getAccountCode()); subscriptionData.setAccount(accountCodeData);
final Account accountCodeData = new Account(); accountCodeData.setAccountCode(account.getAccountCode()); subscriptionData.setAccount(accountCodeData);
@Test(groups = "integration") public void testShippingAddressesOnSubscription() throws Exception { final Account accountData = TestUtils.createRandomAccount(); final Plan planData = TestUtils.createRandomPlan(CURRENCY); final ShippingAddress shippingAddressData = TestUtils.createRandomShippingAddress(); final BillingInfo billingInfoData = TestUtils.createRandomBillingInfo(); billingInfoData.setAccount(null); // null out random account fixture accountData.setBillingInfo(billingInfoData); // add the billing info to account data try { final Account account = recurlyClient.createAccount(accountData); final Plan plan = recurlyClient.createPlan(planData); // Subscribe the user to the plan final Subscription subscriptionData = new Subscription(); // set our shipping address subscriptionData.setShippingAddress(shippingAddressData); // set our sub data subscriptionData.setPlanCode(plan.getPlanCode()); subscriptionData.setCurrency(CURRENCY); subscriptionData.setUnitAmountInCents(1242); // attach the account final Account existingAccount = new Account(); existingAccount.setAccountCode(account.getAccountCode()); subscriptionData.setAccount(existingAccount); final Subscription subscription = recurlyClient.createSubscription(subscriptionData); Assert.assertNotNull(subscription.getHref()); } finally { recurlyClient.closeAccount(accountData.getAccountCode()); recurlyClient.deletePlan(planData.getPlanCode()); } }
@Test(groups = "integration") public void testShippingAddressesOnSubscription() throws Exception { final Account accountData = TestUtils.createRandomAccount(); final Plan planData = TestUtils.createRandomPlan(CURRENCY); final ShippingAddress shippingAddressData = TestUtils.createRandomShippingAddress(); final BillingInfo billingInfoData = TestUtils.createRandomBillingInfo(); billingInfoData.setAccount(null); // null out random account fixture accountData.setBillingInfo(billingInfoData); // add the billing info to account data try { final Account account = recurlyClient.createAccount(accountData); final Plan plan = recurlyClient.createPlan(planData); // Subscribe the user to the plan final Subscription subscriptionData = new Subscription(); // set our shipping address subscriptionData.setShippingAddress(shippingAddressData); // set our sub data subscriptionData.setPlanCode(plan.getPlanCode()); subscriptionData.setCurrency(CURRENCY); subscriptionData.setUnitAmountInCents(1242); // attach the account final Account existingAccount = new Account(); existingAccount.setAccountCode(account.getAccountCode()); subscriptionData.setAccount(existingAccount); final Subscription subscription = recurlyClient.createSubscription(subscriptionData); Assert.assertNotNull(subscription.getHref()); } finally { recurlyClient.closeAccount(accountData.getAccountCode()); recurlyClient.deletePlan(planData.getPlanCode()); } }
/** * Creates a random {@link com.ning.billing.recurly.model.Account} object for testing use given a seed * * @param seed The RNG seed * @return The random {@link com.ning.billing.recurly.model.Account} object */ public static Account createRandomAccount(final int seed) { final Account account = new Account(); account.setAcceptLanguage("en-US"); account.setPreferredLocale("en-US"); account.setAccountCode(randomAlphaNumericString(10, seed)); account.setCompanyName(randomAlphaNumericString(10, seed)); account.setEmail(randomAlphaNumericString(4, seed) + "@test.com"); account.setFirstName(randomAlphaNumericString(5, seed)); account.setLastName(randomAlphaNumericString(6, seed)); account.setAddress(createRandomAddress(seed)); account.setVatNumber(randomAlphaNumericString(15, seed)); return account; }
/** * Creates a random {@link com.ning.billing.recurly.model.Account} object for testing use given a seed * * @param seed The RNG seed * @return The random {@link com.ning.billing.recurly.model.Account} object */ public static Account createRandomAccount(final int seed) { final Account account = new Account(); account.setAcceptLanguage("en-US"); account.setPreferredLocale("en-US"); account.setAccountCode(randomAlphaNumericString(10, seed)); account.setCompanyName(randomAlphaNumericString(10, seed)); account.setEmail(randomAlphaNumericString(4, seed) + "@test.com"); account.setFirstName(randomAlphaNumericString(5, seed)); account.setLastName(randomAlphaNumericString(6, seed)); account.setAddress(createRandomAddress(seed)); account.setVatNumber(randomAlphaNumericString(15, seed)); return account; }