Requirements


Functional Requirements:

  • Ability to send money to someone through different method (wire, credit/debit card, etc)
  • Account management
    • See current account status (how much money)
    • See transaction history
    • Ability to manage recipient
  • Multi-currency support with clear fees, rate conversion mechanisms
  • Buyers
    • Ability to request a refund (reason required, like item not received or not matching description)
  • Seller
    • Ability to dispute a refund request



Non-Functional Requirements:

  • Scalable: in order to handle many payment worldwide
  • Secure:
    • personal informations from buyers/sellers must remain confidential
    • transaction must no be tempered with
  • latency: transaction should be concluded fast (buyers should not wait)
  • availability: available 24/24h 7/7j



API Design

  • sendMoney(buyerId, sellerId, amount, buyerCurrency, paymentMethod, offerId)
    • description: Ability to send money from a buyer to a seller for a specific offer and amount, through a provided method)
    • returns:
      • a transaction identifier
      • in case of synchronous transaction processing the status may be returned, in case of asynchronous processing an additional endpoint would be required to fetch the transaction status
  • accountStatus(userId)
    • Description: Display account information, namely how much money for a specific user
    • returns:
      • amountOfmoney
      • currency
      • userInformation
  • transactionHistory(userId)
    • Description: display transaction history for a specific user
    • Returns:
      • list of transaction, may be already processed, in progress, or under refund request/dispute


Other APIs to consider later:

  • addRecipient(userId, recipientName, recipientMetadata)
    • Description: Ability to a recipient for a specific user, with a recipient name for clarity. recipientMetadata will contain information such as method (wire, credit/debit card, etc) and additional data like account number for a wire, card number, etc
    • Returns:
      • recipientId
  • findConversionRateAndFees(originalAmount, originalCurrency, targetCurrency)
    • Description: Find the conversion rate and fees applied to an amount based on the original and target currency, as well as the amount (likely more useful for fee calculation)
    • Returns:
      • Conversion rate between original and target currency.
      • Transaction fees in case the transaction is actually made
  • requestRefund(userId, offerId, reason)
    • Description: Buyer can request a refund for a specific offer. A reason must be provided
    • Returns:
      • requestRefundId
  • disputeRefundRequest(userId, refundRequestId)
    • Description: Seller can dispute a refund request. Status of the refund request will be updated to something like "disputed" to underline in progress dispute process
    • Returns:
      • Success



High-Level Design

See "High level diagram"





Detailed Component Design

Deep dive into 2-3 key components. Explain how they work, how they scale, discuss tradeoffs, capacity, and any relevant algorithms or data structures.