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;
}
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);
}
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");
}
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);
}
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);
}
}
}
}
Aggregations