Fundraising tech/notes/Draft:DonationInterface architecture refactoring

From mediawiki.org

yaml files for gateway config[edit]

Task: T291699

payment_submethods.yaml[edit]

  • Omitting this file, or just setting it to an empty array, causes the submethod selection buttons not to show up.
  • For Ingenico, submethod properties define numerous properties that are related to processor interaction, including keys (which end up in an inner array on the gateway's transactions property) and paymentproductid, referenced in IngenicoMethodCodec. For Ingencio's rtbt_ideal submethod, there are also validation and issuerids properties.
  • For dlocal (AstroPay) the submethod property bank_code is referenced in AstroPayFinancialNumbers, AstroPayMethodCodec and AstroPaySignature.
  • Currently unused for Adyen Checkout.
  • Despite the presence of the countries property, this does not control which submethods/methods Special:GatewayFormChooser offers for a given country. Rather, this is in DonationInterfaceFormChooser.php.

GatewayAdapter and GatewayType[edit]

Task: T291794

GatewayAdapter is the only class that implements GatewayType. Both are giant and should be divided into smaller classes with more limited responsibilities. Some responsibilities could likely also be moved into SmashPig.

Current areas of responsibility (2021/9)[edit]

  • Basic definitions for gateway: name, identifier, log identifier
  • Config: global or processor-specific from Mediawiki globals, adapter config in yaml files, account config
  • Processor interactions and setup
    • Payments, donor return, processor communication, responses, payment methods and submethods, transactions, statuses, CURL and XML interactions, building requests, donation attempt sequence numbers, postdonation processes, orphan rectification.
    • Data constraints, validation, order and processor request IDs, data transformation, normalization of errors and other things
  • High-level logging actions
  • Queues, message fields
  • Session handling: ensure session, session token, counting session attempts
  • Fraud filtering
  • Convenience methods for interaction with data object
  • UI setup: mustache templates, form fields, client-side validation and transformers, fallback currencies, show monthly convert