|
|
@@ -1,34 +1,9 @@
|
|
|
'use strict';
|
|
|
|
|
|
-const { parseXML } = require('../parser');
|
|
|
-
|
|
|
-const {
|
|
|
- parse: parseCreatePartyRegistration,
|
|
|
-} = require('./create-party-registration');
|
|
|
-const { parse: parseQueryRegistration } = require('./query-registration');
|
|
|
-const {
|
|
|
- parse: parseCancelPartyRegistration,
|
|
|
-} = require('./cancel-party-registration');
|
|
|
-
|
|
|
-async function parse(input) {
|
|
|
- const json = await parseXML(input);
|
|
|
- const o = json['oadrPayload']['$$']['oadrSignedObject'][0]['$$'];
|
|
|
-
|
|
|
- if (o['oadrCreatePartyRegistration']) {
|
|
|
- return await parseCreatePartyRegistration(input);
|
|
|
- }
|
|
|
-
|
|
|
- if (o['oadrCancelPartyRegistration']) {
|
|
|
- return await parseCancelPartyRegistration(input);
|
|
|
- }
|
|
|
-
|
|
|
- if (o['oadrQueryRegistration']) {
|
|
|
- return await parseQueryRegistration(input);
|
|
|
- }
|
|
|
-
|
|
|
- throw new Error(`Unexpected payload type: ${Object.keys(o)}`);
|
|
|
-}
|
|
|
-
|
|
|
-module.exports = {
|
|
|
- parse,
|
|
|
-};
|
|
|
+module.exports = [
|
|
|
+ require('./cancel-party-registration'),
|
|
|
+ require('./canceled-party-registration'),
|
|
|
+ require('./create-party-registration'),
|
|
|
+ require('./created-party-registration'),
|
|
|
+ require('./query-registration'),
|
|
|
+];
|