Skip to content

Commit

Permalink
Add performace logging Mermaid diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
derekherman committed Feb 1, 2025
1 parent 9d27024 commit 9a131c9
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
44 changes: 44 additions & 0 deletions docs/payment-backend.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
sequenceDiagram
title: Square Payment Gateway - Backend Performance Logging Points

WC->>Payment_Gateway: process_payment()

Note over Payment_Gateway,WC: Start: process_payment

alt Has Subscription
Note over Payment_Gateway,Payment_Gateway_Integration: Start: force_tokenization
Payment_Gateway->>Payment_Gateway_Integration: maybe_force_tokenization()
Payment_Gateway_Integration-->>Payment_Gateway: Token Response
Note over Payment_Gateway,Payment_Gateway_Integration: End: force_tokenization
end

Note over Payment_Gateway,Square_API: Start: create_order
Payment_Gateway->>Square_API: create_order()
Square_API-->>Payment_Gateway: Square Order
Note over Payment_Gateway,Square_API: End: create_order

alt Is Subscription
Note over Payment_Gateway,Payment_Gateway_Integration: Start: process_change_payment
Payment_Gateway_Integration->>Payment_Gateway: process_change_payment()
alt No Existing Token
Payment_Gateway->>Square_API: create_token()
Square_API-->>Payment_Gateway: Token Response
end
Payment_Gateway-->>Payment_Gateway_Integration: Process Complete
Note over Payment_Gateway,Payment_Gateway_Integration: End: process_change_payment
else Regular Payment
Note over Payment_Gateway,Square_API: Start: payment_transaction
Payment_Gateway->>Square_API: do_payment_method_transaction()
Square_API-->>Payment_Gateway: Payment Response
Note over Payment_Gateway,Square_API: End: payment_transaction
end

Note over Payment_Gateway: Start: handle_payment_response
Payment_Gateway->>Payment_Gateway: handle_single_payment_method()
Payment_Gateway->>Payment_Gateway: handle_multi_payment_methods()
Note over Payment_Gateway: End: handle_payment_response

Payment_Gateway->>WC: Update Order Status
Note over Payment_Gateway,WC: End: process_payment

WC-->>Customer: Order Confirmation
35 changes: 35 additions & 0 deletions docs/payment-frontend.mmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
sequenceDiagram
title: Square Payment Gateway - Frontend Performance Logging Points

Customer->>WC_Square_Payment_Form_Handler: Loads checkout page

Note over WC_Square_Payment_Form_Handler: Start: initialize_payment_form
WC_Square_Payment_Form_Handler->>Square API: Initialize Square.js
Square API-->>WC_Square_Payment_Form_Handler: Form ready
Note over WC_Square_Payment_Form_Handler: End: initialize_payment_form

Customer->>WC_Square_Payment_Form_Handler: Submits payment form

Note over WC_Square_Payment_Form_Handler: Start: validate_payment_data
WC_Square_Payment_Form_Handler->>WC_Square_Payment_Form_Handler: Check if processing
WC_Square_Payment_Form_Handler->>WC_Square_Payment_Form_Handler: Check for existing nonce

alt Has Tokenized Card ID
WC_Square_Payment_Form_Handler->>WC: Get Token
WC-->>WC_Square_Payment_Form_Handler: Token
Note over WC_Square_Payment_Form_Handler,Square API: Start: verify_buyer
WC_Square_Payment_Form_Handler->>Square API: verifyBuyer()
Square API-->>WC_Square_Payment_Form_Handler: Verification token
Note over WC_Square_Payment_Form_Handler,Square API: End: verify_buyer
else New Card
Note over WC_Square_Payment_Form_Handler,Square API: Start: generate_payment_nonce
WC_Square_Payment_Form_Handler->>Square API: Request payment nonce
Square API-->>WC_Square_Payment_Form_Handler: Payment nonce
Note over WC_Square_Payment_Form_Handler,Square API: End: generate_payment_nonce
end

Note over WC_Square_Payment_Form_Handler: End: validate_payment_data

WC_Square_Payment_Form_Handler->>WC: Submit form with nonce/token

WC-->>Customer: Order Confirmation

0 comments on commit 9a131c9

Please sign in to comment.