diff --git a/examples/example.py b/examples/example.py index 91e2cc6..8ffc6df 100755 --- a/examples/example.py +++ b/examples/example.py @@ -18,8 +18,9 @@ logging.basicConfig(level=logging.INFO) im = Internetmarke(PARTNER_ID, KEY, KEY_PHASE) im.authenticate(USER, PASS) +pn = im.build_pers_name(first='Harald', last='Welte') sysmo_addr = im.build_addr('Alt-Moabit','93','10559','Berlin','DEU') -sysmo_naddr = im.build_comp_addr('sysmocom - s.f.m.c. GmbH', sysmo_addr) +sysmo_naddr = im.build_comp_addr('sysmocom - s.f.m.c. GmbH', sysmo_addr, person=pn) dest_addr = im.build_addr('Glanzstrasse','11','12437','Berlin','DEU') dest_naddr = im.build_pers_addr('Harald', 'Welte', dest_addr) diff --git a/inema/inema.py b/inema/inema.py index d700d8e..eef91bc 100644 --- a/inema/inema.py +++ b/inema/inema.py @@ -171,6 +171,13 @@ class Internetmarke(object): houseNo = house, zip = zipcode, city = city, country= country) + def build_pers_name(self, first, last, salutation=None, title=None): + zclient = self.client + pntype = zclient.get_type('{http://oneclickforapp.dpag.de/V3}PersonName') + pn = pntype(firstname = first, lastname = last, + salutation = salutation, title = title) + return pn + def build_comp_addr(self, company, address, person = None): zclient = self.client cntype = zclient.get_type('{http://oneclickforapp.dpag.de/V3}CompanyName') @@ -182,9 +189,7 @@ class Internetmarke(object): def build_pers_addr(self, first, last, address, salutation = None, title = None): zclient = self.client - pntype = zclient.get_type('{http://oneclickforapp.dpag.de/V3}PersonName') - pn = pntype(firstname = first, lastname = last, - salutation = salutation, title = title) + pn = self.build_pers_name(first, last, salutation, title) ntype = zclient.get_type('{http://oneclickforapp.dpag.de/V3}Name') name = ntype(personName = pn) atype = zclient.get_type('{http://oneclickforapp.dpag.de/V3}NamedAddress')