public PaymentApiException(final AccountApiException e) { super(e, e.getCode(), e.getMessage()); }
@Override public UUID getAccountId() { return account.getId(); }
@Override public DateTimeZone getAccountTimeZone() { return account.getTimeZone(); }
public BusinessAccountModelDao(final Account account) { super(account.getId(), account.getCreatedDate(), account.getUpdatedDate()); this.accountId = account.getId(); this.name = account.getName(); this.key = account.getExternalKey(); if (account.getCurrency() != null) { this.currency = account.getCurrency().toString(); } }
private Account createAccount(final int billCycleDay) throws AccountApiException { final Account account = Mockito.mock(Account.class); Mockito.when(account.getBillCycleDayLocal()).thenReturn(billCycleDay); Mockito.when(account.getCurrency()).thenReturn(Currency.USD); Mockito.when(account.getId()).thenReturn(UUID.randomUUID()); Mockito.when(account.getTimeZone()).thenReturn(DateTimeZone.UTC); Mockito.when(accountInternalApi.getAccountById(Mockito.<UUID>any(), Mockito.<InternalTenantContext>any())).thenReturn(account); return account; }
@Override public UUID getIdFromKey(final String externalKey, final TenantContext context) { for (final Account account : accounts) { if (externalKey.equals(account.getExternalKey())) { return account.getId(); } } return null; }
private final UUID getAccountIdFromRecordId(final BusInternalEventType eventType, final UUID objectId, final Long recordId, final InternalCallContext context) { // accountRecord_id is not set for ACCOUNT_CREATE event as we are in the transaction and value is known yet if (eventType == BusInternalEventType.ACCOUNT_CREATE) { return objectId; } try { final Account account = accountApi.getAccountByRecordId(recordId, context); return account.getId(); } catch (final AccountApiException e) { log.warn("Failed to retrieve acount from recordId {}", recordId); return null; } }
@Override @BeforeMethod(groups = "fast") public void beforeMethod() throws Exception { super.beforeMethod(); final Account account = Mockito.mock(Account.class); Mockito.when(account.getTimeZone()).thenReturn(DateTimeZone.UTC); Mockito.when(accountApi.getAccountById(Mockito.<UUID>any(), Mockito.<InternalTenantContext>any())).thenReturn(account); }
public DateTime fromNowAndReferenceTime(final DateTime referenceDateTime, final InternalTenantContext callContext) throws EntitlementApiException { try { final Account account = accountApi.getAccountByRecordId(callContext.getAccountRecordId(), callContext); return fromNowAndReferenceTime(referenceDateTime, account.getTimeZone()); } catch (AccountApiException e) { throw new EntitlementApiException(e); } }
@Override public Account getAccountByKey(final String key, final TenantContext context) { for (final Account account : accounts) { if (key.equals(account.getExternalKey())) { return account; } } return null; }
public TestDateConversion() throws AccountApiException { super(null, null, null, null, Mockito.mock(AccountUserApi.class), new ClockMock(), null); final Account account = Mockito.mock(Account.class); Mockito.when(account.getTimeZone()).thenReturn(dateTimeZone); Mockito.when(accountUserApi.getAccountById(accountId, null)).thenReturn(account); }
@Override public boolean apply(final AccountEmail input) { return input.getEmail().equals(json.getEmail()); } })
private InternalCallContext createInternalCallContext(final Account blockable, final CallContext context) { return internalCallContextFactory.createInternalCallContext(blockable.getId(), ObjectType.ACCOUNT, context); }
public DateTime fromLocalDateAndReferenceTime(final LocalDate requestedDate, final DateTime referenceDateTime, final InternalTenantContext callContext) throws EntitlementApiException { try { final Account account = accountApi.getAccountByRecordId(callContext.getAccountRecordId(), callContext); return fromLocalDateAndReferenceTime(requestedDate, referenceDateTime, account.getTimeZone()); } catch (AccountApiException e) { throw new EntitlementApiException(e); } }
protected void clearFutureNotification(final Account account, final InternalCallContext context) { // Need to clear the override table here too (when we add it) checkPoster.clearOverdueCheckNotifications(account.getId(), OverdueCheckNotifier.OVERDUE_CHECK_NOTIFIER_QUEUE, OverdueCheckNotificationKey.class, context); }
@Override public Account getAccountById(final UUID uid, final TenantContext context) { for (final Account account : accounts) { if (uid.equals(account.getId())) { return account; } } return null; }
private void avoid_extra_credit_by_toggling_AUTO_INVOICE_OFF(final Account account, final OverdueState previousOverdueState, final OverdueState nextOverdueState, final InternalCallContext context) throws OverdueApiException { if (isBlockBillingTransition(previousOverdueState, nextOverdueState)) { set_AUTO_INVOICE_OFF_on_blockedBilling(account.getId(), context); } else if (isUnblockBillingTransition(previousOverdueState, nextOverdueState)) { remove_AUTO_INVOICE_OFF_on_clear(account.getId(), context); } }
@Override public Refund createRefundWithItemsAdjustments(final Account account, final UUID paymentId, final Map<UUID, BigDecimal> invoiceItemIdsWithAmounts, final CallContext context) throws PaymentApiException { return refundProcessor.createRefund(account, paymentId, null, true, invoiceItemIdsWithAmounts, internalCallContextFactory.createInternalCallContext(account.getId(), context)); }
@Override public void notifyPendingRefundOfStateChanged(final Account account, final UUID refundId, final boolean isSuccess, final CallContext context) throws PaymentApiException { refundProcessor.notifyPendingRefundOfStateChanged(account, refundId, isSuccess, internalCallContextFactory.createInternalCallContext(account.getId(), context)); }
@Override public Collection<NotificationEventWithMetadata<OverdueCheckNotificationKey>> inTransaction(final EntitySqlDaoWrapperFactory<EntitySqlDao> entitySqlDaoWrapperFactory) throws Exception { return ((OverdueCheckPoster)checkPoster).getFutureNotificationsForAccountInTransaction(entitySqlDaoWrapperFactory, overdueQueue, account.getId(), OverdueCheckNotificationKey.class, internalCallContext); } });