User:AGreen (WMF)/Draft:Adyen Classic and Checkout Integrations

Checkout process
Overview documentation

Rough notes

 * Entry point: Special:AdyenCheckoutGateway sends us to AdyenCheckoutGateway::execute, configured in SpecialPages section of extension.json.
 * URL has parameters that determine recurring and method (cc vs. rtbt).
 * General setup in parent method GatewayPage::execute
 * language setup
 * check for maintenance mode
 * find gateway identifier (adyen), as set in AdyenCheckoutGateway::gatewayIdentifier, taken from constant AdyenCheckoutAdapter::IDENTIFIER
 * use gateway identifier and $wgDonationInterfaceGatewayAdapters to get name of adapter class (AdyenCheckoutAdapter), default set in extension.json, ca be overridden in LocalSettings.php.
 * also use gateway identifier to set up SmashPig via DonationInterface::setSmashPigProvider, which gets config information from adyen/main.yaml in provider directory and in defaults in source code.
 * determine variant from URL or session
 * instantiate gateway adapter, sending in variant, if there is one
 * set up gateway config based on gateway identifier and global config variables, including AdyenCheckoutAdapter::GLOBAL_PREFIX, which is wgAdyenCheckoutGateway.
 * set up order_id_meta, hardcoded settings provided in AdyenCheckoutAdapter::defineOrderIDMeta
 * set up data_constraints (such as max field lengths and allowed contents) from config (may not exist, none currently for Adyen)
 * set up payment_methods and payment_submethods based on config
 * set up and instantiate data_transformers based on config
 * sets up some session stuff
 * instantiates DoantionData
 * Sets up bi-directional reference between DonationData and AdyenCheckoutAdapter instances
 * Gets gatewayID (adyen) from AdyenCheckoutAdapter
 * Sets initial field values directly from URL query values and session
 * Performs initial data normalization
 * Gets contribution_tracking_id from queue as needed
 * Sets order_id
 * Normalizes other stuff
 * May save things to session
 * Sets instance variables with copies of data (unstaged_data and staged_data)
 * Sets account from global config
 * Other misc. setup
 * Validates and stages data.
 * Set up logging, client-side style modules, sets class handler for JS variables, other hacky html bits
 * handleRequest: handleDonationRequest
 * Tells adapter to add stuff to session
 * Displays form (takes into account ffname URL parameter, which should be adyen ** change this to adyen_checkout)
 * Back in AdyenCheckoutGateway::execute
 * adds more specific scripts, css and scrpt and style tags for adyen checkout stuff