Search in sources :

Example 11 with Country

use of org.incode.module.country.dom.impl.Country in project estatio by estatio.

the class EstatioApplicationTenancyRepositoryForProperty_Test method propertyWith.

private Property propertyWith(String countryCode, String reference) {
    Property property = new Property();
    property.setReference(reference);
    property.setCountry(new Country(countryCode, countryCode, countryCode));
    return property;
}
Also used : EstatioApplicationTenancyRepositoryForCountry(org.estatio.module.countryapptenancy.dom.EstatioApplicationTenancyRepositoryForCountry) Country(org.incode.module.country.dom.impl.Country)

Example 12 with Country

use of org.incode.module.country.dom.impl.Country in project estatio by estatio.

the class EstatioApplicationTenancyRepositoryForProperty_Test method testFindOrCreatePropertyTenancy_whenCountryAndPropertyExists.

@Test
public void testFindOrCreatePropertyTenancy_whenCountryAndPropertyExists() throws Exception {
    // given
    final Property property = new Property();
    property.setReference("GRA");
    property.setCountry(new Country("ITA", "ITA", "Italy"));
    // when
    ApplicationTenancy propertyTenancy = estatioApplicationTenancyRepositoryForProperty.findOrCreateTenancyFor(property);
    // then
    assertThat(propertyTenancy).isEqualTo(grande);
}
Also used : EstatioApplicationTenancyRepositoryForCountry(org.estatio.module.countryapptenancy.dom.EstatioApplicationTenancyRepositoryForCountry) Country(org.incode.module.country.dom.impl.Country) ApplicationTenancy(org.isisaddons.module.security.dom.tenancy.ApplicationTenancy) Test(org.junit.Test)

Example 13 with Country

use of org.incode.module.country.dom.impl.Country in project estatio by estatio.

the class DemoObjectWithNote_and_DemoInvoice_create3 method execute.

@Override
protected void execute(final ExecutionContext executionContext) {
    final Country gbrCountry = countryRepository.findCountry(CountriesRefData.GBR);
    final DemoObjectWithNotes custA = wrap(demoCustomerMenu).createDemoObjectWithNotes(FRED_HAS_EMAIL_AND_PHONE);
    addEmailAddress(custA, "fred@gmail.com");
    addEmailAddress(custA, "freddy@msn.com");
    addPhoneOrFaxNumber(custA, CommunicationChannelType.PHONE_NUMBER, "555 1234");
    addPhoneOrFaxNumber(custA, CommunicationChannelType.FAX_NUMBER, "555 4321");
    final DemoInvoice custA_1 = demoInvoiceRepository.create("1", custA);
    attachReceipt(custA_1, "Sample4.PDF");
    final DemoInvoice custA_2 = demoInvoiceRepository.create("2", custA);
    attachReceipt(custA_2, "Sample5.PDF");
    final DemoObjectWithNotes custB = wrap(demoCustomerMenu).createDemoObjectWithNotes(MARY_HAS_PHONE_AND_POST);
    addPhoneOrFaxNumber(custB, CommunicationChannelType.PHONE_NUMBER, "777 0987");
    addPhoneOrFaxNumber(custB, CommunicationChannelType.FAX_NUMBER, "777 7890");
    addPostalAddress(custB, gbrCountry, null, "45", "High Street", null, "OX1 4BJ", "Oxford");
    addPostalAddress(custB, gbrCountry, null, "23", "Railway Road", null, "WN7 4AA", "Leigh");
    final DemoInvoice custB_1 = demoInvoiceRepository.create("1", custB);
    attachReceipt(custB_1, "xlsdemo1.pdf");
    final DemoInvoice custB_2 = demoInvoiceRepository.create("2", custB);
    attachReceipt(custB_2, "xlsdemo2.pdf");
    final DemoObjectWithNotes custC = wrap(demoCustomerMenu).createDemoObjectWithNotes(JOE_HAS_EMAIL_AND_POST);
    addEmailAddress(custC, "joe@yahoo.com");
    addEmailAddress(custC, "joey@friends.com");
    addPostalAddress(custC, gbrCountry, null, "5", "Witney Gardens", null, "WA4 5HT", "Warrington");
    addPostalAddress(custC, gbrCountry, null, "3", "St. Nicholas Street Road", null, "YO11 2HF", "Scarborough");
    final DemoInvoice custC_1 = demoInvoiceRepository.create("1", custC);
    attachReceipt(custC_1, "pptdemo1.pdf");
    final DemoInvoice custC_2 = demoInvoiceRepository.create("2", custC);
    attachReceipt(custC_2, "pptdemo2.pdf");
}
Also used : DemoInvoice(org.incode.platform.dom.communications.integtests.demo.dom.invoice.DemoInvoice) Country(org.incode.module.country.dom.impl.Country) DemoObjectWithNotes(org.incode.platform.dom.communications.integtests.demo.dom.demowithnotes.DemoObjectWithNotes)

Example 14 with Country

use of org.incode.module.country.dom.impl.Country in project estatio by estatio.

the class IncomingDocAsInvoiceViewModel_Test method bankaccount_is_set_when_creating_seller.

@Test
public void bankaccount_is_set_when_creating_seller() {
    // given
    IncomingDocAsInvoiceViewModel viewModel = new IncomingDocAsInvoiceViewModel();
    viewModel.organisationRepository = mockOrganisationRepo;
    viewModel.bankAccountRepository = mockBankAccountRepository;
    Country country = new Country();
    Organisation seller = new Organisation();
    BankAccount bankAccount = new BankAccount();
    String sellerName = "some name";
    OrganisationNameNumberViewModel candidate = new OrganisationNameNumberViewModel(sellerName, null);
    String iban = "NL02RABO0313246581";
    // expect
    context.checking(new Expectations() {

        {
            oneOf(mockOrganisationRepo).newOrganisation(null, true, sellerName, country);
            will(returnValue(seller));
            oneOf(mockBankAccountRepository).newBankAccount(seller, iban, null);
            will(returnValue(bankAccount));
            oneOf(mockBankAccountRepository).getFirstBankAccountOfPartyOrNull(seller);
            will(returnValue(bankAccount));
        }
    });
    // when
    viewModel.createSeller(candidate, country, iban);
    // then
    Assertions.assertThat(viewModel.getSeller()).isEqualTo(seller);
    Assertions.assertThat(viewModel.getBankAccount()).isEqualTo(bankAccount);
}
Also used : OrganisationNameNumberViewModel(org.estatio.module.party.app.services.OrganisationNameNumberViewModel) Expectations(org.jmock.Expectations) Organisation(org.estatio.module.party.dom.Organisation) Country(org.incode.module.country.dom.impl.Country) BankAccount(org.estatio.module.financial.dom.BankAccount) Test(org.junit.Test)

Example 15 with Country

use of org.incode.module.country.dom.impl.Country in project estatio by estatio.

the class IBANHelper method assembleIBAN.

public static void assembleIBAN(final BankAccount account) {
    Country country = account.getCountry();
    if (country != null) {
        IBANFormat format = IBANFormat.valueOf(country.getAlpha2Code());
        if (format != null && account.getAccountNumber() != null) {
            String iban = format.format();
            iban = injectPartWithCharacter(iban, "x", account.getNationalCheckCode());
            iban = injectPartWithCharacter(iban, "a", account.getNationalBankCode());
            iban = injectPartWithCharacter(iban, "b", account.getBranchCode());
            iban = injectPartWithCharacter(iban, "c", account.getAccountNumber());
            iban = iban.replace("kk", "00");
            if (iban.length() != format.format().length()) {
                return;
            }
            if (IBANValidator.valid(iban)) {
                account.setIban(iban);
            }
        }
    }
}
Also used : Country(org.incode.module.country.dom.impl.Country)

Aggregations

Country (org.incode.module.country.dom.impl.Country)20 Test (org.junit.Test)6 EstatioApplicationTenancyRepositoryForCountry (org.estatio.module.countryapptenancy.dom.EstatioApplicationTenancyRepositoryForCountry)4 ApplicationTenancy (org.isisaddons.module.security.dom.tenancy.ApplicationTenancy)4 Programmatic (org.apache.isis.applib.annotation.Programmatic)3 Party (org.estatio.module.party.dom.Party)3 State (org.incode.module.country.dom.impl.State)3 Property (org.estatio.module.asset.dom.Property)2 Lease (org.estatio.module.lease.dom.Lease)2 Organisation (org.estatio.module.party.dom.Organisation)2 Expectations (org.jmock.Expectations)2 ArrayList (java.util.ArrayList)1 ApplicationException (org.apache.isis.applib.ApplicationException)1 DomainObject (org.apache.isis.applib.annotation.DomainObject)1 Persistable_datanucleusIdLong (org.apache.isis.core.metamodel.services.jdosupport.Persistable_datanucleusIdLong)1 PostalAddressDto (org.estatio.canonical.communicationchannel.v1.PostalAddressDto)1 AgreementRole (org.estatio.module.agreement.dom.AgreementRole)1 AgreementRoleCommunicationChannelType (org.estatio.module.agreement.dom.AgreementRoleCommunicationChannelType)1 AgreementRoleType (org.estatio.module.agreement.dom.role.AgreementRoleType)1 AdminDashboard (org.estatio.module.application.app.AdminDashboard)1