|
Go.Event
(Clicked!)
string request
long rc
//
using prototype input address fields
// prepare address for CASS/DPV request
request = address_line_1.text + '~r~n' +
address_line_2.text
+ '~r~n' +
city.text + ' ' +
state.text
+ ' ' +
zipcode.text
//
request CASS certification DPV validation
// API returns the number of solutions
rc = AESapigen(response.text,request)
//
if zero CASS/DPV API addresses solutions
// report and return
if rc = 0 then
response.text
= 'NO ADDRESSES'
return
end if
//
if there was a CASS/DPV API service error
if rc < 0 then
return
end if
//
if there is only one CASS/DPV address
// replace the input address
if rc = 1 then
Accept.Event(Clicked!)
end if |
Accept.Event(Clicked!)
string buf
long at //
find CASS/DPV address solution
// using the selected address status
at = pos(response.text,status.text)
// isolate CASS/DPV address solution
buf = mid(response.text,at)
// drop status line
at = pos(buf,"~r~n")
buf = mid(buf,at + 2)
// find end of address line one
// replace the input address line
at = pos(buf,"~r~n")
add_line_1.text = left(buf,at - 1)
buf = mid(buf,at + 2)
// find end of address line two
// replace the input address line
at = pos(buf,"~r~n")
add_line_2.text = left(buf,at - 1)
buf = mid(buf,at + 2)
// find end of city/state/ZIP-code line
at = pos(buf,"~r~n")
// set POSTNET barcode
barcode.text = mid(buf,at + 2)
buf = left(buf,at - 1)
//
replace the input ZIP-code, state-code and city
zipcode.text = right(buf,10)
buf = left(buf,len(buf) - 11)
state.text = right(buf,2)
city.text = left(buf,len(buf) - 3) |