protected AccountData getAccountData(final int billingDay) { return new MockAccountBuilder().name(UUID.randomUUID().toString().substring(1, 8)) .firstNameLength(6) .email(UUID.randomUUID().toString().substring(1, 8)) .phone(UUID.randomUUID().toString().substring(1, 8)) .migrated(false) .isNotifiedForInvoices(false) .externalKey(UUID.randomUUID().toString().substring(1, 8)) .billingCycleDayLocal(billingDay) .currency(Currency.USD) .paymentMethodId(UUID.randomUUID()) .timeZone(DateTimeZone.UTC) .build(); }
public Account createAccount(final CallContext callContext) throws AccountApiException { final AccountData accountData = new MockAccountBuilder().name(UUID.randomUUID().toString().substring(1, 8)) .firstNameLength(6) .email(UUID.randomUUID().toString().substring(1, 8)) .phone(UUID.randomUUID().toString().substring(1, 8)) .migrated(false) .isNotifiedForInvoices(true) .externalKey(UUID.randomUUID().toString().substring(1, 8)) .billingCycleDayLocal(31) .currency(accountCurrency) .paymentMethodId(UUID.randomUUID()) .timeZone(DateTimeZone.UTC) .build(); return accountUserApi.createAccount(accountData, callContext); }
public AccountData initAccountData() { final AccountData accountData = new MockAccountBuilder().name(UUID.randomUUID().toString()) .firstNameLength(6) .email(UUID.randomUUID().toString()) .phone(UUID.randomUUID().toString()) .migrated(false) .isNotifiedForInvoices(false) .externalKey(UUID.randomUUID().toString()) .billingCycleDayLocal(1) .currency(Currency.USD) .paymentMethodId(UUID.randomUUID()) .timeZone(DateTimeZone.forID("Europe/Paris")) .build(); assertNotNull(accountData); return accountData; }
@BeforeMethod(groups = "slow") public void beforeMethod() throws Exception { super.beforeMethod(); Mockito.when(catalogService.getFullCatalog()).thenReturn(new MockCatalog()); final PaymentMethod paymentMethod = Mockito.mock(PaymentMethod.class); final UUID paymentMethodId = UUID.randomUUID(); Mockito.when(paymentMethod.getId()).thenReturn(paymentMethodId); final Account account = new MockAccountBuilder(UUID.randomUUID()) .externalKey(ACCOUNT_KEY) .currency(ACCOUNT_CURRENCY) .paymentMethodId(paymentMethodId) .build(); Mockito.when(accountInternalApi.getAccountById(Mockito.eq(account.getId()), Mockito.<InternalCallContext>any())).thenReturn(account); try { // Create events for the bus and expected results createSubscriptionTransitionEvent(account); createAccountCreationEvent(account); createInvoiceAndPaymentCreationEvents(account); } catch (Throwable t) { fail("Initializing accounts failed.", t); } }
accountBuilder.migrated(true); accountBuilder.name(UUID.randomUUID().toString()); accountBuilder.paymentMethodId(UUID.randomUUID()); accountBuilder.phone(UUID.randomUUID().toString()); accountBuilder.postalCode(UUID.randomUUID().toString());
.currency(currency) .billingCycleDayLocal(billCycleDayLocal) .paymentMethodId(paymentMethodId) .timeZone(timeZone) .locale(locale)
public MockAccountBuilder(final AccountData data) { this.id = UUID.randomUUID(); this.address1(data.getAddress1()); this.address2(data.getAddress2()); this.billingCycleDayLocal(data.getBillCycleDayLocal()); this.city(data.getCity()); this.companyName(data.getCompanyName()); this.country(data.getCountry()); this.currency(data.getCurrency()); this.email(data.getEmail()); this.externalKey(data.getExternalKey()); this.firstNameLength(data.getFirstNameLength()); this.isNotifiedForInvoices(data.isNotifiedForInvoices()); this.locale(data.getLocale()); this.migrated(data.isMigrated()); this.name(data.getName()); this.paymentMethodId(data.getPaymentMethodId()); this.phone(data.getPhone()); this.postalCode(data.getPostalCode()); this.stateOrProvince(data.getStateOrProvince()); this.timeZone(data.getTimeZone()); }