FASEB

FASEB is a support organization that Dryad has contracted to perform back-office support functions and some sales functions.

Current duties

 * Management of Dryad payment plans. Track organizations and journals participating in the various plans, and send invoices. Facilitate the purchase/renewal of plans.
 * Provide front-line support for Dryad's organizational members and subscribers. (Note that front-line support for Dryad *submitters* is primarily managed by the curation staff.)
 * Reconcile transaction information between Dryad's database, FASEB's database, and PayPal's database.

AssociationAnywhere API
FASEB uses the AssociationAnywhere software to manage Dryad's memberships and payment plans. Dryad submits transaction data to AssociationAnywhere using its API. Although the AssociationAnywhere API allows us to read the status of payment plans (and dynamically determine whether a new transaction is covered by a plan), this feature is not currently used.

Documentation:
 * [[Media:AssociationAnywhereUsageOverview.pdf|API Usage Overview]]
 * [[Media:AssociationAnywhereCustomerAPI.pdf|Customer Info API]] -- retrieves a description of the customer, including indication of subscription and deferred payment plans
 * [[Media:AssociationAnywhereAuthenticationAPI.pdf|Authentication API]] -- for end-user authentication (not currently used)
 * [[Media:AssociationAnywhereLogoffAPI.pdf|Authentication API (Logoff)]] -- for end-user authentication (not currently used)
 * [[Media:AssociationAnywhereCreditDetailsAPI.pdf|Credit Details API]] -- retrieves transactions from the customer's credit history
 * [[Media:AssociationAnywhereCreditsAvailableAPI.pdf|Credits Available API]] -- retrieves total number of credits available for a customer (for use with prepaid plans)
 * [[Media:AssociationAnywhereCreditUpdateAPI.pdf|Update Credits API]] -- records a new transaction the the customer's credit history
 * Full AssociationAnywhere APIs (Restricted Access)

Development (URLs):
 * https://online.datadryad.org/dryaddevsvc/CENCREDWEBSVCLIB.GET_CREDITS_DTL_XML
 * https://online.datadryad.org/dryaddevsvc/CENCREDWEBSVCLIB.GET_CREDITS_XML
 * https://online.datadryad.org/dryaddevsvc/CENCREDWEBSVCLIB.INS_CREDIT_XML
 * https://online.datadryad.org/dryaddevsvc/CENSSAWEBSVCLIB.AUTHENTICATION
 * https://online.datadryad.org/dryaddevsvc/CENSSAWEBSVCLIB.GET_CUST_INFO_XML
 * https://online.datadryad.org/dryaddevsvc/CENSSAWEBSVCLIB.INVALIDATELOGINBYHASH_XML
 * https://online.datadryad.org/dryaddevsvc/CENSSAWEBSVCLIB.LOGOFF

Production URLs:
 * https://online.datadryad.org/dryadsvc/CENCREDWEBSVCLIB.GET_CREDITS_DTL_XML
 * https://online.datadryad.org/dryadsvc/CENCREDWEBSVCLIB.GET_CREDITS_XML
 * https://online.datadryad.org/dryadsvc/CENCREDWEBSVCLIB.INS_CREDIT_XML
 * https://online.datadryad.org/dryadsvc/CENSSAWEBSVCLIB.AUTHENTICATION
 * https://online.datadryad.org/dryadsvc/CENSSAWEBSVCLIB.GET_CUST_INFO_XML
 * https://online.datadryad.org/dryadsvc/CENSSAWEBSVCLIB.INVALIDATELOGINBYHASH_XML
 * https://online.datadryad.org/dryadsvc/CENSSAWEBSVCLIB.LOGOFF
 * https://online.datadryad.org/dryadsvc/CENSSAWEBSVCLIB.VALIDATELOGINBYHASH_XML

Although the documentation mentions sending the request as a "document", the actual request is an HTTP GET that contains a single parameter. This parameter is encoded XML. To create the GET query:
 * 1) construct the desired input XML
 * 2) URL-encode the XML
 * 3) Add it to the target URL as a parameter with the name p_input_xml_doc

A sample Customer Info API call, with the login credentials replaced by asterisks: https://online.datadryad.org/dryaddevsvc/CENSSAWEBSVCLIB.GET_CUST_INFO_XML?p_input_xml_doc=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%3CcustInfoRequest%3E%3CcustId%3E1224345%3C%2FcustId%3E%3CintegratorUsername%3E*******%3C%2FintegratorUsername%3E%3CintegratorPassword%3E********%3C%2FintegratorPassword%3E%3Cdetails%20includeCodeValues%3D%22true%22%3E%3Croles%20include%3D%22true%22%20%2F%3E%3Caddresses%20include%3D%22true%22%20includeBad%3D%22true%22%20%2F%3E%3Cphones%20include%3D%22true%22%20%2F%3E%3Cemails%20include%3D%22true%22%20includeBad%3D%22true%22%20%2F%3E%3Cwebsites%20include%3D%22true%22%20includeBad%3D%22true%22%20%2F%3E%3Cjobs%20include%3D%22true%22%20includeInactive%3D%22true%22%20%2F%3E%3CcommitteePositions%20include%3D%22true%22%20includeInactive%3D%22true%22%20%2F%3E%3Cmemberships%20include%3D%22true%22%20includeInactive%3D%22true%22%20%2F%3E%3Csubscriptions%20include%3D%22true%22%20includeExpired%3D%22true%22%20%2F%3E%3CcommunicationPreferences%20include%3D%22true%22%20%2F%3E%3CcustomerAttributes%20include%3D%22true%22%20includeAll%3D%22true%22%3E%3C%2FcustomerAttributes%3E%3Cbio%20include%3D%22true%22%20%2F%3E%3C%2Fdetails%3E%3C%2FcustInfoRequest%3E

A sample Credit Details API call, with the login credentials replaced by asterisks: https://online.datadryad.org/dryaddevsvc/CENCREDWEBSVCLIB.GET_CREDITS_DTL_XML?p_input_xml_doc=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%3F%3E%3CcreditInfoRequest%3E%3CcustId%3E1224345%3C%2FcustId%3E%3CintegratorUsername%3E********%3C%2FintegratorUsername%3E%3CintegratorPassword%3E**********%3C%2FintegratorPassword%3E%3C%2FcreditInfoRequest%3E

A sample Credits Available API call, with the login credentials replaced by asterisks: https://online.datadryad.org/dryaddevsvc/CENCREDWEBSVCLIB.GET_CREDITS_XML?p_input_xml_doc=%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-8%22%20%3F%3E%3CcreditRequest%3E%3CintegratorUsername%3E********%3C%2FintegratorUsername%3E%3CintegratorPassword%3E*******%3C%2FintegratorPassword%3E%3CcustId%3E1224345%3C%2FcustId%3E%3CtxTy%3EPREPAID%3C%2FtxTy%3E%3C%2FcreditRequest%3E

A sample Update Credits API call, with the login credentials replaced by asterisks. Note that the cred-accepted field should be positive when adding new credits to an account, and negative when recording a transaction that deducts credit from the account. https://online.datadryad.org/dryaddevsvc/CENCREDWEBSVCLIB.INS_CREDIT_XML?p_input_xml_doc=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%3Ccredit-request%3E%3Cvendor-id%3E********%3C%2Fvendor-id%3E%3Cvendor-password%3E********%3C%2Fvendor-password%3E%3Ccust-id%3E1230729%3C%2Fcust-id%3E%3Ctrans-type%3EPREPAID%3C%2Ftrans-type%3E%3Ctrans-date%3E07%2F22%2F2015%3C%2Ftrans-date%3E%3Ccred-accepted%3E-1%3C%2Fcred-accepted%3E%3Ccred-unit%3EVCH%3C%2Fcred-unit%3E%3C%2Fcredit-request%3E

AssociationAnywhere Client
Dryad has a command-line client that allows control of the data in AssociationAnywhere. The functionality is managed by the AssociationAnywhere class. To run it, use a command like: /opt/dryad/bin/dspace association-anywhere [-l | -t | -u] -i customerID [-p packageID]

The command always takes the -i argument to indicate the customerID. If this is the only argument, the available credits for the customer will be returned. If an additional flag is present, the action will be:
 * -l list all customer information
 * -t tally the use of a credit from customer (if this option is present, the packageID may also be included to record a specific data package associated with the tally, preferably formatted as a DOI)
 * -u update Dryad's amount of credits for customer, using the value currently in AssociationAnyware (this feature is not currently used -- it needs to be tested before using again)

Implementation
Most of the interaction is controlled by the AssociationAnywhere class. Calls to the API are implemented by passing parameters into XML templates, and then converting these templates into URL-encoded form. The XML templates are in dspace/modules/api/src/main/resources/anywhere/request-templates.xsl.

When a data package is approved, the transaction is logged in AssociationAnywhere. The AssociationAnywhere API can only be called from specified IP addresses. Therefore, this code is deployed on the dev server for testing purposes.

Viewing transactions in AssociationAnywhere

 * 1) Login to the AssociationAnywhere.
 * 2) In the upper right corner of the screen, lookup a journal by Customer Name.
 * 3) Click on the journal's customer ID number in the search results.
 * 4) Click on the Credit History tab -- this table will display the transactions that have been processed so far. Note: This table will only show 10 items until you press the button to load the next 10. it's best to sort by date to find recent items.

Setup of customer IDs
For the AA integration to function correctly, a concept must be present in Dryad that contains
 * journal.customerID = an AA customerID
 * journal.subscriptionPaid = true
 * journal.paymentPlanType = DEFERRED or SUBSCRIPTION or PREPAID