Ibrahim Farah
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Payments Journey flow === ## Table of Contents [TOC] # Stripe Test Journeys --- ```gherkin= Feature: Create a Stripe Customer (Customer Stream) Scenario: Create a stripe customer (success) Given a customer.created/enrolled event And the BillingEngineId exists When the event is consumed from the Customers Stream Then the record is persisted with a stripe id in our db And stripeCustomer.created event gets fired onto payments stream Scenario: Create a stripe customer without BillingEngineId (failure) Given a customer.created/enrolled event And there is no BillingEngineId When the event is consumed from the Customers Stream Then a record is not created for this customer in our db Scenario: Error whilst creating a stripe customer (4xx) Given a customer.created event And the BillingEngineId exists And Stripe returns statusCode 4xx twice then a 200 When the event is consumed from the Customers Stream Then the Stripe Api has been called once And the record is persisted without a stripe id in our db Scenario: Transient Error whilst creating a stripe customer (5xx) Given a customer.created event And the BillingEngineId exists And Stripe returns statusCode 5xx twice then a 200 When the event is consumed from the Customers Stream Then the Stripe Api has been called thrice And the record is persisted with a stripe id in our db And stripeCustomer.created event gets fired onto payments stream ``` ```gherkin= Feature: Update a Stripe Customer (Customer Stream) Scenario: Update a stripe customer (success) Given a customer.updated event And the StripeCustomerId exists When the record metadata is updated (billingEngineId and billingEngineDisplayNumber) Then the record is updated in our db And the customer is updated in stripe wit the updated metadata And stripeCustomer.updted event gets fired onto payments stream Scenario: Error whilst updating a stripe customer (4xx) Given a customer.updated event And the StripeCustomerId exists And Stripe returns statusCode 4xx twice then a 200 When the event is consumed from the Customers Stream Then the Stripe Api has been called once And the record is persisted without a stripe id in our db Scenario: Transient Error whilst updating a stripe customer (5xx) Given a customer.updated event And the StripeCustomerId exists And Stripe returns statusCode 5xx twice then a 200 When the event is consumed from the Customers Stream Then the Stripe Api has been called thrice And the record is persisted with a stripe id in our db And stripeCustomer.created event gets fired onto payments stream ``` ```gherkin= Feature: Scheduler updates missing stripe customer ids (Scheduler) Scenario: Create a stripe customer (success) Given there are some customer records with no StripeCustomerId And the stripeCustomerCreated index is equal to awaiting-creation And the BillingEngineId exists When the scheduler is ran Then the records are populated with their StripeCustomerId And stripeCustomer.created event gets fired onto payments stream Scenario: Create a stripe customer (partial failure) Given there are some customer records with no StripeCustomerId And the stripeCustomerCreated index is equal to awaiting-creation And the BillingEngineId exists And some records fail to create due to invalid data When the scheduler is ran Then the unsuccessful records fail And the remainder of the records are populated with their StripeCustomerId And stripeCustomer.created event gets fired onto payments stream ``` ```gherkin= Feature: Create Payment Intent (API) Scenario: Create a payment intent (success) Given a valid payment payload is supplied And the request contains products When the endpoint is invoked Then the payment intent is created And a client secret and the payment id is returned Scenario: Create a payment intent (success with products) Given a valid payment payload is supplied And the request does not contains products When the endpoint is invoked Then the payment intent is created And a client secret and the payment id is returned Scenario: Create a payment intent (failure invalid signature) Given a payment payload is supplied And the request contains products with an invalid signature When the endpoint is invoked Then a 400 responce is returned Scenario: Create a payment intent (failure totals not matching up) Given a valid payment payload is supplied And the request contains products And the total products does not match the total amount When the endpoint is invoked Then a 400 responce is returned Scenario: Create a payment intent (failure invalid payload) Given an invalid payment payload is supplied When the endpoint is invoked Then a 400 response is returned Scenario: Create a payment intent (failure invalid stripeCustomerId) Given a payment payload is supplied And no stripeCustomerId exists for the customer When the endpoint is invoked Then a 400 error response is returned indicating the customer does not exist ``` ```gherkin= Feature: Publish webhook to stream (Stripe Webhook) Scenario: Publish webhook to payment stream (success) Given any Event is recieved from stripe When the event is consumed Then the event is published to the payments stream Scenario: Publish webhook to payment stream (failure) Given any Event is recieved from stripe And the webhookSigningSecret is invalid When the event is consumed Then then a 401 invalid signature is returned ``` ```gherkin= Feature: Save payment response (Payments Stream) Scenario: Save payment response (success) Given a payment intent succeeded event When the event is consumed Then the payment response is saved to our db And a payment.created event is fired onto the payments stream Scenario: Save payment response (failure) Given a payment intent paymentFailed event When the event is consumed Then the payment response is saved to our db And a payment.created event is fired onto the payments stream ``` ```gherkin= Feature: Get payment methods (API) Scenario: Get stripe payment methods (default limit of 10) Given a customer has more than 10 saved stripe payment methods And the limit query param is not specified When the endpoint is invoked Then 10 of their payments methods are returned by default Scenario: Get stripe payment methods (limit to 1) Given a customer has several stripe payment methods And the limit query param is set to 1 When the endpoint is invoked Then only one of their payment methods is returned ``` # Get Payments ```gherkin= Feature: Get payments (API) Scenario: Get payments (default limit of 20) Given a customer has more than 20 saved payments And the limit query param is not specified When the endpoint is invoked Then the 20 most recent of their payments are returned Scenario: Get payments (limit to 1) Given a customer has more than 1 saved payment And the limit query param is set to 1 When the endpoint is invoked Then only one of their payments is returned Scenario: Get payments (pagination) Given a customer has 4 saved payments And the limit query param is set to 2 And the page query param is set to 2 When the endpoint is invoked Then only the last 2 payment records should be displayed Scenario: Get payments (status filter) Given a customer has 3 saved payments And one has failed And the status query param is set to failed Then only the failed endpoint should be returned Scenario: Get payments (no saved payments for the customer) Given a customer does not have any saved payments When the endpoint is invoked Then an empty result set is returned ``` # Junifer ```gherkin= Feature: Save Junifer payment.accepted response (Billing Engine Stream) Scenario: Creates new payment for successful Junifer originating payments. Given the requestStatus on the event is 'Successful' And there is no apiIdempotency field on the payment object And no payment already exists for the BillingEngineId on the event When the event is handled Then a new payment record is created And the summary.status is 'success' And the source of the payment should be 'junifer' Scenario: Creates new payment for pending Junifer originating payments. Given the requestStatus on the event is 'Pending' And there is no apiIdempotency field on the payment object And no payment already exists for the BillingEngineId on the event When the event is handled Then a new payment record is created And the summary.status is 'pending' And the source of the payment should be 'junifer' Scenario: Creates new payment for cancelled Junifer originating payments. Given the requestStatus on the event is 'Cancelled' And there is no apiIdempotency field on the payment object And no payment already exists for the BillingEngineId on the event When the event is handled Then a new payment record is created And the summary.status is 'cancelled' And the source of the payment should be 'junifer' Scenario: Creates new payment for failing Junifer originating payments. Given the requestStatus on the event is 'FailedPendingRetry' And there is no apiIdempotency field on the payment object And no payment already exists for the BillingEngineId on the event When the event is handled Then a new payment record is created And the summary.status is 'failed' And the source of the payment should be 'junifer' Scenario: Creates new payment for failing Junifer originating payments. Given the requestStatus on the event is 'FailedRequestingAgain' And there is no apiIdempotency field on the payment object And no payment already exists for the BillingEngineId on the event When the event is handled Then a new payment record is created And the summary.status is 'failed' And the source of the payment should be 'junifer' Scenario: Missing account/customer id on the junifer originating payment Given a successful payment.accepted event And there is no customerId and accountId on the event When the event is handled Then a new payment record is NOT created (MissingAccountIdentifyingDataError error) Scenario: Multiple records against a given BillingEngineId Given a successful payment.accepted event And there are two payment records with the given BillingEngineId When the event is handled Then a new payment record is NOT created (MultiplePaymentsForBillingEngineIdError error) Scenario: Junifer payment.accepted event for an existing payment record Given a successful payment.accepted event And there is an apiIdempotency field on the payment object linking to a payment id And that paymentId exists When the event is handled Then we update the record with the billingEngineId and billingEngineStatus And the source is not set to junifer Scenario: Junifer event containing payment id that does not exist Given a successful payment.accepted event And there is an apiIdempotency field on the payment object linking to a payment id And that paymentId that does not exist. When the event is handled Then a new payment record is NOT created (PaymentNotFoundByPaymentIdError error) ``` ###### tags: `payments` `journey` `component-tests` # Checklist: ## Stripe ✔ ## Get payments ✔ ## Junifer ✔ ## Top ups :::info **Perhaps makes sense to be done as part of when integrating stripe refunds???** ::: ## Sagepay ```gherkin= Feature: Get Sagepay merchant session keys (API) Scenario: Get Sagepay merchant session keys (success) Given a valid request When the endpoint is invoked Then the merchant session key and the expiry time of the key is returned Scenario: Get Sagepay merchant session keys (failure) Given a valid request And there is an outage with sagepay When the endpoint is invoked Then an error is returned ``` ```gherkin= Feature: Make Sagepay Payment (API) Scenario: Post Sagepay Payment (success) Given a valid payment payload And no products is present And 3d auth is not required When the endpoint is invoked Then the transaction is returned And the status is set to 'success' And a payment.created event is fired onto the payments stream Scenario: Post Sagepay Payment (success) Given a valid payment payload And no products is present And 3d auth is required When the endpoint is invoked Then the transaction is returned And the status is set to '3D_secure' Scenario: Post Sagepay Payment (failure) Given a valid payment payload And no products is present And a card with insufficient balance is supplied When the endpoint is invoked Then a 422 response is returned Scenario: Post Sagepay Payment (failure) Given a valid payment payload And no products is present And a card that does not meet the fraud rules is supplied When the endpoint is invoked Then a 400 response is returned Scenario: Post Sagepay Payment (failure) Given a payment payload with no account id or customer id When the endpoint is invoked Then a validation error is returned ``` ```gherkin= Feature: Sagepay 3D Secure Authentication (API) Scenario: Callback Sagepay 3D Secure (success) Given redirect urls are not provided And a valid payment id, customer id and account id are provided And the PaRes response from the bank is successful When the endpoint is invoked Then a 200 response is returned And it contains the successful result of the authentication And a payment.created event is fired onto the payments stream Scenario: Callback Sagepay 3D Secure (success) Given redirect urls are provided And a valid payment id, customer id and account id are provided And the PaRes response from the bank is successful When the endpoint is invoked Then a 301 response is returned And the url contains the successful authentication result And a payment.created event is fired onto the payments stream Scenario: Callback Sagepay 3D Secure (failure) Given redirect urls are not provided And a valid payment id, customer id and account id are provided And the PaRes response from the bank is unsuccessful When the endpoint is invoked Then a 422 response is returned And contains the result of the failed authentication Scenario: Callback Sagepay 3D Secure (failure) Given redirect urls are provided And a valid payment id, customer id and account id are provided And the PaRes response from the bank is unsuccessful When the endpoint is invoked Then a 301 response is returned And the url contains the failed authentication result Scenario: Callback Sagepay 3D Secure (failure) Given no redirect urls are provided And the payment id supplied does not exist When the endpoint is invoked Then a 404 response is returned Scenario: Callback Sagepay 3D Secure (failure) Given no redirect urls are provided And no account id or customer is provided When the endpoint is invoked Then a 400 response is returned ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully