Skip to content
Snippets Groups Projects
README.rst 1.08 KiB
Newer Older
  • Learn to ignore specific revisions
  • Jean-Paul Calderone's avatar
    Jean-Paul Calderone committed
    
    
    Jean-Paul Calderone's avatar
    Jean-Paul Calderone committed
    PaymentServer maintains the state of a voucher database with respect to payments.
    It receives payment notifications from payment processors and notes this in the database.
    
    Currently, Stripe is supported.
    
    Building
    --------
    
    
    Get all the build dependencies with nix::
    
      $ nix-shell PrivateStorageio/shell.nix   # Might be needed depending on your system, see #88
      $ nix-shell PaymentServer/shell.nix
    
    
    Jean-Paul Calderone's avatar
    Jean-Paul Calderone committed
    Build using Stack::
    
      $ stack build
    
    
    Jean-Paul Calderone's avatar
    Jean-Paul Calderone committed
    Testing
    -------
    
    
    You can perform manual integration testing against Stripe.
    
    Jean-Paul Calderone's avatar
    Jean-Paul Calderone committed
    First, run the server::
    
      $ stack run
    
    
    Then create a testing charge::
    
    Jean-Paul Calderone's avatar
    Jean-Paul Calderone committed
    
       $ curl \
    
         http://<youraddress>:8081/v1/stripe/charge \
         -X POST \
         -H 'content-type: application/json' \
         --data '{ "token":"tok_visa", "voucher":"abcdefg", "amount":"650", "currency":"USD" }'
    
    
    Jean-Paul Calderone's avatar
    Jean-Paul Calderone committed
    The PaymentServer marks the voucher as paid in its database.
    
    Then redeem the vouncher for tokens::
    
       $ curl \
         http://<youraddress>:8081/v1/redeem \
         -X POST \
         -H 'content-type: application/json' \
         --data '{ "redeemVoucher": "abcdefg", "redeemTokens":[]}'