@Test(groups = "integration") public void testGetBillingInfo() throws Exception { final Account accountData = TestUtils.createRandomAccount(); final BillingInfo billingInfoData = TestUtils.createRandomBillingInfo(); billingInfoData.setAccount(null); // need to null out test account accountData.setBillingInfo(billingInfoData); try { // Create account and fetch billing info final Account account = recurlyClient.createAccount(accountData); final BillingInfo retrievedBillingInfo = recurlyClient.getBillingInfo(account.getAccountCode()); Assert.assertNotNull(retrievedBillingInfo); Assert.assertEquals(retrievedBillingInfo.getType(), "credit_card"); } finally { // Close the account recurlyClient.closeAccount(accountData.getAccountCode()); } }
@Test(groups = "integration") public void testGetBillingInfo() throws Exception { final Account accountData = TestUtils.createRandomAccount(); final BillingInfo billingInfoData = TestUtils.createRandomBillingInfo(); billingInfoData.setAccount(null); // need to null out test account accountData.setBillingInfo(billingInfoData); try { // Create account and fetch billing info final Account account = recurlyClient.createAccount(accountData); final BillingInfo retrievedBillingInfo = recurlyClient.getBillingInfo(account.getAccountCode()); Assert.assertNotNull(retrievedBillingInfo); Assert.assertEquals(retrievedBillingInfo.getType(), "credit_card"); } finally { // Close the account recurlyClient.closeAccount(accountData.getAccountCode()); } }
final Plan planData = TestUtils.createRandomPlan(); billingInfoData.setAccount(null); accountData.setBillingInfo(billingInfoData); try {
final Plan planData = TestUtils.createRandomPlan(); billingInfoData.setAccount(null); accountData.setBillingInfo(billingInfoData); try {
accountData.setBillingInfo(billingInfoData); // add the billing info to account data
subFields.add(subField); final Account accountData = TestUtils.createRandomAccount(); accountData.setBillingInfo(billingInfoData);
accountData.setBillingInfo(billingInfoData); // add the billing info to account data
subFields.add(subField); final Account accountData = TestUtils.createRandomAccount(); accountData.setBillingInfo(billingInfoData);
/** * Creates a random {@link GiftCard} object for use in Tests given a seed * * @param seed The RNG seed * @return The random {@link GiftCard} object */ public static GiftCard createRandomGiftCard(final int seed) { final GiftCard giftCardData = new GiftCard(); final Account accountData = createRandomAccount(seed); final Delivery deliveryData = createRandomDelivery(seed); final BillingInfo billingInfoData = createRandomBillingInfo(seed); // need to null out account // TODO - account should not be writeable in XML billingInfoData.setAccount(null); accountData.setBillingInfo(billingInfoData); // Gift card product needs to be created on the site with // product code "test_gift_card" giftCardData.setGifterAccount(accountData); giftCardData.setDelivery(deliveryData); giftCardData.setCurrency("USD"); giftCardData.setProductCode("test_gift_card"); giftCardData.setUnitAmountInCents(2000); return giftCardData; }
accountData.setBillingInfo(billingInfoData); t.setAccount(accountData); t.setAmountInCents(15);
/** * Creates a random {@link GiftCard} object for use in Tests given a seed * * @param seed The RNG seed * @return The random {@link GiftCard} object */ public static GiftCard createRandomGiftCard(final int seed) { final GiftCard giftCardData = new GiftCard(); final Account accountData = createRandomAccount(seed); final Delivery deliveryData = createRandomDelivery(seed); final BillingInfo billingInfoData = createRandomBillingInfo(seed); // need to null out account // TODO - account should not be writeable in XML billingInfoData.setAccount(null); accountData.setBillingInfo(billingInfoData); // Gift card product needs to be created on the site with // product code "test_gift_card" giftCardData.setGifterAccount(accountData); giftCardData.setDelivery(deliveryData); giftCardData.setCurrency("USD"); giftCardData.setProductCode("test_gift_card"); giftCardData.setUnitAmountInCents(2000); return giftCardData; }
accountData.setBillingInfo(billingInfoData); t.setAccount(accountData); t.setAmountInCents(15);
accountData.setBillingInfo(billingInfoData); // add the billing info to account data
@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()); } }
accountData.setBillingInfo(billingInfoData); // add the billing info to account data
@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()); } }
accountData.setBillingInfo(billingInfoData); // add the billing info to account data
accountData.setBillingInfo(billingInfoData); // add the billing info to account data
accountData.setBillingInfo(billingInfoData); // add the billing info to account data
accountData.setBillingInfo(billingInfoData); // add the billing info to account data