Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
basic
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
xrm
basic
Commits
7000cb6d
Commit
7000cb6d
authored
5 years ago
by
Johannes Hörmann
Browse files
Options
Downloads
Patches
Plain Diff
First version of Address/Communication validation webservice
parent
3e402491
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
process/AddressValidation_lib/AddressValidation_lib.aod
+9
-0
9 additions, 0 deletions
process/AddressValidation_lib/AddressValidation_lib.aod
process/AddressValidation_lib/process.js
+104
-0
104 additions, 0 deletions
process/AddressValidation_lib/process.js
with
113 additions
and
0 deletions
process/AddressValidation_lib/AddressValidation_lib.aod
0 → 100644
+
9
−
0
View file @
7000cb6d
<?xml version="1.0" encoding="UTF-8"?>
<process
xmlns=
"http://www.adito.de/2018/ao/Model"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
VERSION=
"1.2.1"
xsi:schemaLocation=
"http://www.adito.de/2018/ao/Model adito://models/xsd/process/1.2.1"
>
<name>
AddressValidation_lib
</name>
<majorModelMode>
DISTRIBUTED
</majorModelMode>
<process>
%aditoprj%/process/AddressValidation_lib/process.js
</process>
<variants>
<element>
LIBRARY
</element>
</variants>
</process>
This diff is collapsed.
Click to expand it.
process/AddressValidation_lib/process.js
0 → 100644
+
104
−
0
View file @
7000cb6d
import
(
"
system.vars
"
);
import
(
"
system.neon
"
);
import
(
"
system.net
"
);
import
(
"
system.util
"
);
import
(
"
system.logging
"
);
function
AddressValidationType
(
pKey
,
pParamName
)
{
this
.
key
=
pKey
;
this
.
paramName
=
pParamName
;
}
AddressValidationType
.
get
=
function
(
pKey
)
{
if
(
!
this
.
_cache
)
this
.
_cache
=
{
TYPE_ZIP
:
new
AddressValidationType
(
"
TYPE_ZIP
"
,
"
zip
"
),
TYPE_CITY
:
new
AddressValidationType
(
"
TYPE_CITY
"
,
"
city
"
)
}
if
(
pKey
)
return
this
.
_cache
[
pKey
];
return
this
.
_cache
;
}
/**
* Class containing utility functions for address validation
* do not create an instance of this
*
* @class
*/
function
AddressValidationUtils
()
{}
AddressValidationUtils
.
validate
=
function
(
pValue
,
pType
,
pCountry
)
{
// TODO: Options for url, user, pw
var
userName
=
"
Admin
"
;
var
pw
=
"
a
"
;
// get AddressValidationType-Object if it is only the key
if
(
typeof
pType
==
"
string
"
)
pType
=
AddressValidationType
.
get
(
pType
);
if
(
pValue
&&
pType
)
{
var
parameters
=
{};
if
(
pCountry
)
{
parameters
.
country
=
pCountry
;
}
parameters
[
pType
.
paramName
]
=
pValue
;
var
url
=
"
https://services.aditosoftware.local/services/rest/ws_checkAddress
"
;
var
actionType
=
"
GET
"
;
var
ret
=
JSON
.
parse
(
net
.
callRestWebserviceBasicAuth
(
url
,
actionType
,
parameters
,
null
,
null
,
"
text/plain
"
,
"
text/plain
"
,
util
.
DATA_TEXT
,
util
.
DATA_TEXT
,
userName
,
pw
,
true
));
if
(
ret
.
hasHttpSuccessStatusCode
)
{
return
JSON
.
parse
(
ret
.
body
).
map
(
function
(
pAddress
)
{
var
data
=
pAddress
[
0
];
return
[
JSON
.
stringify
(
data
),
pAddress
[
1
],
data
.
zip
,
data
.
city
,
data
.
country
,
data
.
district
,
data
.
region
,
data
.
state
,
data
[
pType
.
paramName
]
]
});
}
else
{
// error handling
}
}
return
[];
}
AddressValidationUtils
.
setFields
=
function
()
{
var
data
=
JSON
.
parse
(
vars
.
get
(
"
$this.value
"
));
_setField
(
"
$field.ZIP
"
,
data
.
zip
);
_setField
(
"
$field.COUNTRY
"
,
data
.
country
);
_setField
(
"
$field.CITY
"
,
data
.
city
);
_setField
(
"
$field.DISTRICT
"
,
data
.
district
);
_setField
(
"
$field.REGION
"
,
data
.
region
);
_setField
(
"
$field.STATE
"
,
data
.
state
);
function
_setField
(
pField
,
pValue
)
{
if
(
pValue
)
neon
.
setFieldValue
(
pField
,
pValue
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment