当前位置: 首页>>代码示例>>Java>>正文


Java Tenant类代码示例

本文整理汇总了Java中org.killbill.billing.tenant.api.Tenant的典型用法代码示例。如果您正苦于以下问题:Java Tenant类的具体用法?Java Tenant怎么用?Java Tenant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Tenant类属于org.killbill.billing.tenant.api包,在下文中一共展示了Tenant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: respondTaxCodes

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
private void respondTaxCodes(final Tenant tenant, final String taxZone,
        final String productName, final String taxCode, final DateTime validDate,
        final HttpServletResponse resp) throws IOException {
    final List<EasyTaxTaxCode> taxCodesRecords;
    try {
        taxCodesRecords = dao.getTaxCodes(tenant.getId(), taxZone, productName, taxCode,
                validDate);
    } catch (final SQLException e) {
        buildErrorResponse(e, resp);
        return;
    }

    final byte[] data = JSON_MAPPER.writeValueAsBytes(taxCodesRecords);
    resp.setContentType(APPLICATION_JSON_UTF8);
    buildOKResponse(data, resp);
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:17,代码来源:EasyTaxServlet.java

示例2: addTaxCode

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
private void addTaxCode(final Tenant tenant, final String taxZone, final String productName,
        final String taxCode, final ServletRequest req, final HttpServletResponse resp)
        throws IOException {
    final EasyTaxTaxCode code = JSON_MAPPER.readValue(getRequestData(req),
            EasyTaxTaxCode.class);
    code.setCreatedDate(clock.getUTCNow());
    code.setKbTenantId(tenant.getId());
    code.setTaxZone(taxZone);
    code.setProductName(productName);
    code.setTaxCode(taxCode);
    try {
        dao.saveTaxCode(code);
    } catch (final SQLException e) {
        buildErrorResponse(e, resp);
        return;
    }

    buildCreatedResponse(
            "/plugins/killbill-easytax/taxCodes/" + taxZone + "/" + productName + "/" + taxCode,
            resp);
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:22,代码来源:EasyTaxServlet.java

示例3: addTaxCodes

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
private void addTaxCodes(final Tenant tenant, final ServletRequest req,
        final HttpServletResponse resp) throws IOException {
    final List<EasyTaxTaxCode> taxCodes = JSON_MAPPER.readValue(getRequestData(req),
            TAX_CODE_LIST_MAPPING_TYPE);
    if (taxCodes == null) {
        return;
    }
    DateTime now = clock.getUTCNow();
    UUID tenantId = tenant.getId();
    for (EasyTaxTaxCode code : taxCodes) {
        code.setKbTenantId(tenantId);
        code.setCreatedDate(now);
    }
    try {
        dao.saveTaxCodes(taxCodes);
    } catch (final SQLException e) {
        buildErrorResponse(e, resp);
        return;
    }

    buildOKResponse(null, resp);
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:23,代码来源:EasyTaxServlet.java

示例4: getEventTypesPerAccount

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@GET
@Path("/accounts/:kbAccountId")
public Result getEventTypesPerAccount(@Named("kbAccountId") final UUID kbAccountId, @Local @Named("killbill_tenant") final Tenant tenant,
                            Optional<ExtBusEventType> eventType) {
    final UUID kbTenantId = tenant.getId();

    if (!eventType.isPresent())
    {
        return EmailNotificationService.getEventTypesPerAccount(this.dao, kbAccountId, kbTenantId);
    }
    else
    {
        return EmailNotificationService.getEventTypePerAccount(this.dao, kbAccountId, kbTenantId, eventType.get());

    }
}
 
开发者ID:killbill,项目名称:killbill-email-notifications-plugin,代码行数:17,代码来源:EmailNotificationServlet.java

示例5: shouldDispatchGetAccountTaxCountry

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetAccountTaxCountry() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/taxCountry");

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(vatinController);
    verify(taxCountryController).getAccountTaxCountry(accountId, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:19,代码来源:TestSimpleTaxServlet.java

示例6: shouldRenderAccountTaxCountry

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldRenderAccountTaxCountry() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/taxCountry");

    TaxCountryRsc rsc = new TaxCountryRsc(accountId, FRANCE);
    when(taxCountryController.getAccountTaxCountry(accountId, tenant)).thenReturn(rsc);

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
    assertEquals(mocks.getResponseContent(), "{\"accountId\":\"" + accountId + "\",\"taxCountry\":\"" + FR + "\"}");
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:21,代码来源:TestSimpleTaxServlet.java

示例7: shouldDispatchGetAccountVATIN

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetAccountVATIN() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/vatin");

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController);
    verify(vatinController).getAccountVatin(eq(accountId), eq(tenant));
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:19,代码来源:TestSimpleTaxServlet.java

示例8: shouldRenderAccountVATIN

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldRenderAccountVATIN() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/taxCountry");

    VATINRsc rsc = new VATINRsc(accountId, FR_TEST6_VATIN);
    when(taxCountryController.getAccountTaxCountry(accountId, tenant)).thenReturn(rsc);

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
    assertEquals(mocks.getResponseContent(), "{\"accountId\":\"" + accountId + "\",\"vatin\":\""
            + FR_TEST6_VATIN_NUM + "\"}");
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:22,代码来源:TestSimpleTaxServlet.java

示例9: shouldDispatchGetTaxCountries

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetTaxCountries() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    when(mocks.req().getPathInfo()).thenReturn(TAX_COUNTRIES_RSC_URI);

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(vatinController);
    verify(taxCountryController).listTaxCountries(null, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:18,代码来源:TestSimpleTaxServlet.java

示例10: shouldDispatchGetTaxCountriesWhenAccountRestrictionIsBlank

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetTaxCountriesWhenAccountRestrictionIsBlank() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    when(mocks.req().getPathInfo()).thenReturn(TAX_COUNTRIES_RSC_URI);
    when(mocks.req().getHeader(ACCOUNT_PARAM_NAME)).thenReturn("\t");

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(vatinController);
    verify(taxCountryController).listTaxCountries(null, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:19,代码来源:TestSimpleTaxServlet.java

示例11: shouldDispatchGetTaxCountriesWithAccountRestriction

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetTaxCountriesWithAccountRestriction() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn(TAX_COUNTRIES_RSC_URI);
    when(mocks.req().getParameter(ACCOUNT_PARAM_NAME)).thenReturn(accountId.toString());

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(vatinController);
    verify(taxCountryController).listTaxCountries(accountId, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:20,代码来源:TestSimpleTaxServlet.java

示例12: shouldDispatchGetVATINs

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetVATINs() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    when(mocks.req().getPathInfo()).thenReturn(VATINS_RSC_URI);

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController);
    verify(vatinController).listVatins(null, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:18,代码来源:TestSimpleTaxServlet.java

示例13: shouldDispatchGetVATINsWhenAccountRestrictionIsBlank

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetVATINsWhenAccountRestrictionIsBlank() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    when(mocks.req().getPathInfo()).thenReturn(VATINS_RSC_URI);
    when(mocks.req().getHeader(ACCOUNT_PARAM_NAME)).thenReturn("\t");

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController);
    verify(vatinController).listVatins(null, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:19,代码来源:TestSimpleTaxServlet.java

示例14: shouldDispatchGetVATINsWithAccountRestriction

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldDispatchGetVATINsWithAccountRestriction() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn(VATINS_RSC_URI);
    when(mocks.req().getParameter(ACCOUNT_PARAM_NAME)).thenReturn(accountId.toString());

    // When
    servlet.doGet(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(taxCountryController);
    verify(vatinController).listVatins(accountId, tenant);
    assertEquals(mocks.getResponseContentType(), APPLICATION_JSON);
    assertEquals(mocks.getResponseStatus(), SC_OK);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:20,代码来源:TestSimpleTaxServlet.java

示例15: shouldRespondInternalServerErrorWhenSavingAccountTaxCountryFails

import org.killbill.billing.tenant.api.Tenant; //导入依赖的package包/类
@Test(groups = "fast")
public void shouldRespondInternalServerErrorWhenSavingAccountTaxCountryFails() throws Exception {
    // Given
    ServletMocks mocks = new ServletMocks();
    Tenant tenant = withTenant(mocks.req());

    UUID accountId = randomUUID();
    when(mocks.req().getPathInfo()).thenReturn("/accounts/" + accountId + "/taxCountry");
    mocks.withRequestBody("{\"accountId\":\"" + accountId + "\",\"taxCountry\":\"" + FR + "\"}");

    // When
    servlet.doPut(mocks.req(), mocks.resp());

    // Then
    verifyZeroInteractions(vatinController);
    verify(taxCountryController).saveAccountTaxCountry(eq(accountId), taxCountryRsc.capture(), eq(tenant));
    assertEquals(taxCountryRsc.getValue().accountId, accountId);
    assertEquals(taxCountryRsc.getValue().taxCountry, FRANCE);
    assertEquals(mocks.getResponseStatus(), SC_INTERNAL_SERVER_ERROR);
}
 
开发者ID:bgandon,项目名称:killbill-simple-tax-plugin,代码行数:21,代码来源:TestSimpleTaxServlet.java


注:本文中的org.killbill.billing.tenant.api.Tenant类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。