Build facturx invoice with Mustang library - java

I do try to build a factur-x using Mustang library.
For minimum profile, a Buyer legal registration identifier is required.
For this I build a trade party object:
TradeParty recipient = new TradeParty(
"My Client",
"My address",
"06000",
"City",
"FR")
.setID("123 456 789 10111");
My issue is the following:
I'm able to build an XML (that's what I want)
I'm not able to set the organization ID and pass the schemeID to 0002 (for french factur-X).
I didn't find how to set
Here is what is expected:
<ram:SpecifiedLegalOrganization>
<ram:ID schemeID="0002">123 456 789 10111</ram:ID>
</ram:SpecifiedLegalOrganization>
I do also have to set the business process type, which is specific for Chorus Pro (in france):
<ram:BusinessProcessSpecifiedDocumentContextParameter>
<ram:ID>A1</ram:ID>
</ram:BusinessProcessSpecifiedDocumentContextParameter>
Here, A1 means invoice deposit, A2 means prepaid invoice deposit, ... By default (in the absence of this field), the case A1 is applied.
The output for recipient :
<ram:BuyerTradeParty>
<ram:ID>123 456 789 10111</ram:ID>
<ram:Name>My Client</ram:Name>
<ram:PostalTradeAddress>
<ram:PostcodeCode>06000</ram:PostcodeCode>
<ram:LineOne>My address</ram:LineOne>
<ram:CityName>City</ram:CityName>
<ram:CountryID>FR</ram:CountryID>
</ram:PostalTradeAddress>
</ram:BuyerTradeParty>

SpecifiedLegalOrganisation/ID has been added to Mustang 2.5 https://www.mustangproject.org/mustang-2-5-0/, please report an issue via https://github.com/ZUGFeRD/mustangproject/issues if there are further requirements vis á vis Chorus Pro I am not aware of.

as you indicated (and as described in the english FX spec 1.05 e.g. on page 115 as well as in the technical annex to ZUGFeRD with a cardinality 0..1) BT-23, i.e. ram:BusinessProcessSpecifiedDocumentContextParameter is optional so you can just omit it unless you need other values. Do you require to set anything nonstandard here?
However, so far nobody ever requested being able to set the legalorganisation +ID and scheme ID, which means that probably nobody ever used Mustang so far to write invoices vis á vis the french authorities (only to german ones or for factur-x B2B invoices).
However, I just added the possibility, you can now use someTradeParty.setLegalOrganisation(new LegalOrganisation("0815", "0002")). This will become part of the next release, could you please confirm that this works and is all you need?

Related

Deleting LDAP record with 0x0A in CN (Java)

I'm trying to delete ADLDS user records created by Microsoft's conflict resolution model.
Microsoft describes the creation of the new records as
The new RDN will be <Old RDN>\0ACNF:<objectGUID>
These are the records I'm trying to delete from my environment.
My search for uid=baduser will return two CNs:
cn=John R. Doe 123456
and
cn=John R. Doe 123456 CNF:123e4567-e89b-12d3-a456-426614174000
The second record has the \0A in the cn.
Executing a ctx.destroySubcontext(cn) on it errors out like this:
cn=John R. Doe 123456CNF:123e4567-e89b-12d3-a456-426614174000,c=US: [LDAP: error code 34 - 0000208F: NameErr: DSID-0310022D, problem 2006 (BAD_NAME), data 8349
What am I missing to be able to delete a record with a cn that contains a line feed character?
note: I also can't seem to read/modify this \0A record using JXplorer. Clicking on the record after a search results in the same BAD_NAME error.
String commonName = attr.get("cn").get().toString().replace("\n", "\\\\0A");
A simple replacement of the \n character worked for me.

How to add 2nd street-line in google contacts StructuredPostalAddres (GData)

After reading the documentation and Google's developer guide, I did not find a to add a second address line.
For example, if I want to store this address as a Google contact :
Mr. Ace Person
Amphitheatre Village Premium Outlets
1600 Amphitheatre Pkwy
Mountain View CA 94043
I can add the street as demonstrated in the developer guide :
StructuredPostalAddress postalAddress = new StructuredPostalAddress();
postalAddress.setStreet(new Street("1600 Amphitheatre Pkwy"));
I couldn't find a structured solution to add a "2 line street address".
Obviously I could add one of the two lines as a house-name (setHousename(housename)) or Neighborhood (setNeighborhood(neighborhood)) but this is not quiet right.
Unfortunately, there is no document or feature that support what you want to accomplish. According to the current document pertaining to the element's property which you can choose what appropriate property to work around you 2nd street line. I hope it helps.

FRED Economic Series IDs

I am trying to use the FRED API to get the economic data. The examples provided on the FRED website uses series Id to get the observations/values for a particular series. I am not able to find where I can find the series IDs. For example, in the below example it is asking for series id to get the data-
https://api.stlouisfed.org/fred/series/observations?series_id=GNPCA&api_key=*your_key*
Any help is appreciated.
From the documentation on FRED API, fred/category/series, "Get the series in a category."; an example:
https://api.stlouisfed.org/fred/category/series?category_id=125&api_key=abcdefghijklmnopqrstuvwxyz123456
Just go here Federal Reserve Economic Data | FRED | St. Louis Fed and search for the series you're interested in. Alternately, you can browse by several attributes, including Category from there. Once you've searched, if you find it, click one of the results. A search for S&P 500 yielded a link to S&P 500 | FRED | St. Louis Fed, which has a chart of it. You'll see some letters and/or numbers in parentheses right beside the page's title. In this case, it is SP500. THAT is your series ID.
Your complete link will be https://api.stlouisfed.org/fred/series/observations?series_id=SP500&file_type=json&api_key=YourAPIKey. More parameters are here: St. Louis Fed Web Services: fred/series/observations
Perhaps this will help you:
GET https://api.stlouisfed.org/fred/series/search?search_text=**your+search+query**&api_key=**abc123**&file_type=json&observation_start=2016-03-01&observation_end=2016-03-15
This will return JSON data with the series id you are looking for....
{
"realtime_start": "2016-04-06",
"realtime_end": "2016-04-06",
"order_by": "search_rank",
"sort_order": "desc",
"count": 164,
"offset": 0,
"limit": 1000,
"series**s**": [
{
"id": "**FEDFUNDS**",
"realtime_start": "2016-04-06",
"realtime_end": "2016-04-06",
"title": "Effective Federal Funds Rate",
------------------ json result intentionally cut off -------------
There are different ways to get the series id's and category id's found here:
https://research.stlouisfed.org/docs/api/fred/

RestFB get events in Java

Using FQL, by means of which finds events that contain a given word. FQL works only in API version <2.1. By which I use the Graph API Explorer to display events. Eg.
search?q=york&type=event
Example of FQL
SELECT Eid, name, location, start_time, description, pic_small, creator, event venue FROM WHERE start_time> "Sun Jun 21 0:00:35 GMT 2015" AND (CONTAINS ("york")
I would like to make a search events by using RestFB not using FQL, but do not know how. The documentation is scarce.
I answered this already on github, but perhaps someone else find this useful.
Your special case is not in the documentation, but you can transfer the knowledge you find in the documentation and solve your problem: http://restfb.com/#searching
Connection<Event> eventList =
facebookClient.fetchConnection("search", Event.class,
Parameter.with("q", "york"), Parameter.with("type", "event"));
Now, you can iterate over the eventList.
Here you can find how this can be done: http://restfb.com/#fetching-connections

regex extraction of data

I have a hundred Whois files of different top level domains(.com, .se, .uk, .cz etc.). Each has a different format. My main task is to extract information such as registrar, registrant, expiry date, updated date etc. The below code works for com. net. org & info. I am using Java SE 6.
Admin contact: "\\bAdmin\\sEmail:\\s*\\w+\\-*\\w*\\.*\\w*#\\w+(\\.\\w+)+"
Technical contact: "\\bTech\\sEmail:\\s*\\w+\\-*\\w*\\.*\\w*#\\w+(\\.\\w+)+"
Whois Registrant: "\\bRegistrant\\sName:\\s*\\w+\\-*\\.*\\w+\\s*\\w*"
Registrar: "\\bRegistrar:\\w+\\.*\\w*"
Registered on Date: "\\bCreation\\sDate:\\s*\\d+-\\d+-\\d+T\\d+:\\d+:\\d+Z"
Expiry Date: "\\bExpiry\\sDate:\\s*\\d+-\\d+-\\d+T\\d+:\\d+:\\d+Z"
Updated Date: "\\bUpdated\\sDate:\\s*\\d+-\\d+-\\d+T\\d+:\\d+:\\d+Z"
Name Servers: "\\bName\\sServer:\\s*\\w+\\d*\\.*\\w*\\-*\\w*(\\.\\w+)+"
Registrant Status: "\\bDomain\\sStatus:\\s*\\w+"
How do I add alternatives for each of the above points for other TLDs. For example :
I would like to have Name Servers:
"\\bName\\sServer:\\s*\\w+\\d*\\.*\\w*\\-*\\w*(\\.\\w+)+"
OR
alternative pattern
OR
alternative Pattern
Is it doable? If not is there an alternative way?
Alternative patterns can be concatenated with the | operator:
"\\bName\\sServer:\\s*\\w+\\d*\\.*\\w*\\-*\\w*(\\.\\w+)+|alternative pattern|alternative Pattern"
(If this isn't what you need, then your question should be reformulated.)

Categories