protected List<PaymentMethod> getPaymentMethodsForAccount( final UUID accountId, final TenantContext context) throws AnalyticsRefreshException { PaymentApiException error; final PaymentApi paymentApi = getPaymentUserApi(); try { // Try to get all payment methods, with plugin information // TODO this will not return deleted payment methods return paymentApi.getAccountPaymentMethods(accountId, true, PLUGIN_PROPERTIES, context); } catch (PaymentApiException e) { error = e; if (e.getCode() == ErrorCode.PAYMENT_NO_SUCH_PAYMENT_PLUGIN.getCode()) { logService.log( LogService.LOG_WARNING, e.getMessage() + ". Analytics tables will be missing plugin specific information"); try { return paymentApi.getAccountPaymentMethods(accountId, false, PLUGIN_PROPERTIES, context); } catch (PaymentApiException e1) { error = e1; } } } logService.log( LogService.LOG_WARNING, "Error retrieving payment methods for account id " + accountId, error); throw new AnalyticsRefreshException(error); }
protected Collection<Payment> getPaymentsWithPluginInfoByAccountId( final UUID accountId, final TenantContext context) throws AnalyticsRefreshException { PaymentApiException error; final PaymentApi paymentApi = getPaymentUserApi(); try { return paymentApi.getAccountPayments(accountId, true, PLUGIN_PROPERTIES, context); } catch (PaymentApiException e) { error = e; if (e.getCode() == ErrorCode.PAYMENT_NO_SUCH_PAYMENT_PLUGIN.getCode()) { logService.log( LogService.LOG_WARNING, e.getMessage() + ". Analytics tables will be missing plugin specific information"); try { return paymentApi.getAccountPayments(accountId, false, PLUGIN_PROPERTIES, context); } catch (PaymentApiException e1) { error = e1; } } } logService.log( LogService.LOG_WARNING, "Error retrieving payments for account id " + accountId, error); throw new AnalyticsRefreshException(error); }