├── .gitignore ├── .jshintignore ├── .jshintrc ├── FAQ.md ├── FEATURES.md ├── Gruntfile.js ├── HACKING.md ├── LICENSE.md ├── README.md ├── bin ├── country-codes.js ├── db-audit.js ├── payflow-client.js ├── promo.js ├── url-info.js ├── usaepay-client.js └── validate-address.js ├── configs ├── bin.dev.js ├── common.js ├── constants.js ├── dev-data.js ├── payswarm.dev.js ├── permissions.js ├── roles.js ├── test.js └── yahoo-av.example.js ├── email-templates ├── bedrock.Identity.created-identity.tpl ├── common.Deposit.ach-merchant-account-log.tpl ├── common.Deposit.cc-merchant-account-log.tpl ├── common.Deposit.failure.tpl ├── common.Deposit.success-identity.tpl ├── common.Deposit.success.tpl ├── common.FinancialAccount.created.tpl ├── common.FinancialAccount.unbackedCreditPayoffFailed-identity.tpl ├── common.FinancialAccount.unbackedCreditPayoffFailed.tpl ├── common.PaymentToken.bankAccountCreated-identity.tpl ├── common.PaymentToken.bankAccountCreated.tpl ├── common.PaymentToken.unverified-identity.tpl ├── common.PaymentToken.unverified.tpl ├── common.PaymentToken.unverifiedLimitReached.tpl ├── common.PaymentToken.verified-identity.tpl ├── common.PaymentToken.verifyBalanceTooLow.tpl ├── common.PaymentToken.verifyFailed.tpl ├── common.Purchase.success-identity.tpl ├── common.Purchase.success.tpl ├── common.Transaction.externalTransactionVoided.tpl ├── common.Transaction.statusCheckError.tpl ├── common.Transaction.statusChecksExceeded.tpl ├── common.Withdrawal.ach-merchant-account-log.tpl ├── common.Withdrawal.failure.tpl ├── common.Withdrawal.success-identity.tpl ├── common.Withdrawal.success.tpl ├── hosted.Listing.assetExpired-identity.tpl └── mapper.js ├── less ├── app.less └── cc-logos.less ├── lib ├── payswarm-auth │ ├── audit-map-reduce.js │ ├── audit-txn-worker.js │ ├── audit.js │ ├── authority.js │ ├── av.test.js │ ├── av.yahoo.js │ ├── financial.account.js │ ├── financial.budget.js │ ├── financial.contract.js │ ├── financial.deposit.js │ ├── financial.js │ ├── financial.paymentToken.js │ ├── financial.regulation.js │ ├── financial.transaction.js │ ├── financial.transfer.js │ ├── financial.withdrawal.js │ ├── hosted.asset.js │ ├── hosted.listing.js │ ├── identityAddress.js │ ├── identityPreferences.js │ ├── jsonld.js │ ├── money.js │ ├── monitors.js │ ├── payflow-client.js │ ├── pg.authority.js │ ├── pg.payflow.js │ ├── pg.test.js │ ├── pg.usaepay.js │ ├── promo.js │ ├── resource.js │ ├── security.js │ ├── services.account.js │ ├── services.address.js │ ├── services.assetora.js │ ├── services.budget.js │ ├── services.hosted.asset.js │ ├── services.hosted.listing.js │ ├── services.identityPreferences.js │ ├── services.license.js │ ├── services.paymentToken.js │ ├── services.payswarm.identifier.js │ ├── services.promo.js │ ├── services.system.js │ ├── services.test.js │ ├── services.tools.js │ ├── services.transaction.js │ ├── services.vendor.js │ ├── services.well-known.js │ ├── system.js │ ├── tools.js │ └── usaepay-client.js └── rdfa │ └── rdfa.js ├── locales ├── de.js ├── en.js ├── es.js ├── fr.js ├── ja.js ├── ru.js └── zh.js ├── npm-shrinkwrap.json ├── package.json ├── payswarm.dev.js ├── pki ├── README ├── test-payswarm-auth.crt └── test-payswarm-auth.key ├── protractor.conf.js ├── schemas ├── address.js ├── allowBudget.js ├── asset.js ├── bankAccount.js ├── creditCard.js ├── currency.js ├── deposit.js ├── depositAmount.js ├── invoice.js ├── ipv4Address.js ├── money.js ├── payee.js ├── payeeRule.js ├── paymentToken.js ├── promo.js ├── receipt.js ├── referenceId.js ├── refreshInterval.js ├── regulatoryAddress.js ├── resourceHash.js ├── resources.asset.js ├── resources.license.js ├── resources.listing.js ├── services.account.js ├── services.address.js ├── services.budget.js ├── services.hosted.asset.js ├── services.hosted.listing.js ├── services.identityPreferences.js ├── services.license.js ├── services.paymentToken.js ├── services.payswarm.identifier.js ├── services.promo.js ├── services.test.js ├── services.transaction.js ├── services.vendor.js ├── transaction.js ├── transfer.js ├── validatedAddress.js ├── validityInterval.js ├── vendor.js ├── withdrawal.js └── withdrawalAmount.js ├── site ├── img-src │ └── cc-logos.xcf ├── static │ ├── app │ │ ├── bootstrap.js │ │ ├── components │ │ │ ├── account │ │ │ │ ├── account-balance-details-directive.js │ │ │ │ ├── account-balance-details.html │ │ │ │ ├── account-balance-directive.js │ │ │ │ ├── account-balance-summary-directive.js │ │ │ │ ├── account-balance-summary.html │ │ │ │ ├── account-balance.html │ │ │ │ ├── account-controller.js │ │ │ │ ├── account-form.html │ │ │ │ ├── account-routes.js │ │ │ │ ├── account-selection-directive.js │ │ │ │ ├── account-selection.html │ │ │ │ ├── account-selector-directive.js │ │ │ │ ├── account-selector.html │ │ │ │ ├── account-service.js │ │ │ │ ├── account-view.html │ │ │ │ ├── account.html │ │ │ │ ├── account.js │ │ │ │ ├── accounts-directive.js │ │ │ │ ├── accounts-view.html │ │ │ │ ├── accounts.html │ │ │ │ ├── add-account-modal-directive.js │ │ │ │ ├── add-account-modal.html │ │ │ │ ├── add-credit-line-complete.html │ │ │ │ ├── add-credit-line-modal-directive.js │ │ │ │ ├── add-credit-line-modal.html │ │ │ │ ├── add-credit-line-review.html │ │ │ │ ├── deposit-complete.html │ │ │ │ ├── deposit-modal-directive.js │ │ │ │ ├── deposit-modal.html │ │ │ │ ├── deposit-prepare.html │ │ │ │ ├── deposit-review.html │ │ │ │ ├── edit-account-modal-directive.js │ │ │ │ ├── edit-account-modal.html │ │ │ │ ├── update-account-button-directive.js │ │ │ │ ├── update-account-button.html │ │ │ │ ├── withdraw-complete.html │ │ │ │ ├── withdraw-modal-directive.js │ │ │ │ ├── withdraw-modal.html │ │ │ │ ├── withdraw-prepare.html │ │ │ │ └── withdraw-review.html │ │ │ ├── address │ │ │ │ ├── add-address-edit.html │ │ │ │ ├── add-address-modal-directive.js │ │ │ │ ├── add-address-modal.html │ │ │ │ ├── add-address-select.html │ │ │ │ ├── address-form.html │ │ │ │ ├── address-selector-directive.js │ │ │ │ ├── address-selector.html │ │ │ │ ├── address-service.js │ │ │ │ ├── address-settings.html │ │ │ │ ├── address-view-directive.js │ │ │ │ ├── address-view.html │ │ │ │ ├── address.js │ │ │ │ ├── addresses-controller.js │ │ │ │ ├── addresses-directive.js │ │ │ │ ├── addresses-view.html │ │ │ │ ├── edit-address-modal-directive.js │ │ │ │ └── edit-address-modal.html │ │ │ ├── assetora │ │ │ │ ├── add-asset-modal-directive.js │ │ │ │ ├── add-asset-modal.html │ │ │ │ ├── add-invoice-item-modal-directive.js │ │ │ │ ├── add-invoice-item-modal.html │ │ │ │ ├── add-invoice-modal-directive.js │ │ │ │ ├── add-invoice-modal.html │ │ │ │ ├── add-listing-modal-directive.js │ │ │ │ ├── add-listing-modal.html │ │ │ │ ├── asset-form.html │ │ │ │ ├── assetora-controller.js │ │ │ │ ├── assetora-routes.js │ │ │ │ ├── assetora.html │ │ │ │ ├── assetora.js │ │ │ │ ├── causes-controller.js │ │ │ │ ├── causes.html │ │ │ │ ├── content-portal-controller.js │ │ │ │ ├── edit-asset-modal.html │ │ │ │ ├── edit-invoice-modal.html │ │ │ │ ├── edit-listing-modal.html │ │ │ │ ├── hosted-asset-service.js │ │ │ │ ├── hosted-assets-controller.js │ │ │ │ ├── hosted-listing-service.js │ │ │ │ ├── invoice-form.html │ │ │ │ ├── invoice-item-form.html │ │ │ │ ├── invoices-controller.js │ │ │ │ ├── invoices.html │ │ │ │ ├── listing-form.html │ │ │ │ ├── protect-asset-modal-directive.js │ │ │ │ ├── protect-asset-modal.html │ │ │ │ ├── protect-asset-php.html │ │ │ │ ├── tickets-controller.js │ │ │ │ ├── tickets.html │ │ │ │ ├── tools-controller.js │ │ │ │ └── tools.html │ │ │ ├── budget │ │ │ │ ├── add-budget-modal-directive.js │ │ │ │ ├── add-budget-modal.html │ │ │ │ ├── budget-bar-directive.js │ │ │ │ ├── budget-bar.html │ │ │ │ ├── budget-controller.js │ │ │ │ ├── budget-form.html │ │ │ │ ├── budget-routes.js │ │ │ │ ├── budget-selection-directive.js │ │ │ │ ├── budget-selection.html │ │ │ │ ├── budget-selector-directive.js │ │ │ │ ├── budget-selector.html │ │ │ │ ├── budget-service.js │ │ │ │ ├── budget-view.html │ │ │ │ ├── budget.html │ │ │ │ ├── budget.js │ │ │ │ ├── budgets-directive.js │ │ │ │ ├── budgets-view.html │ │ │ │ ├── edit-budget-modal-directive.js │ │ │ │ └── edit-budget-modal.html │ │ │ ├── components.js │ │ │ ├── dashboard │ │ │ │ ├── dashboard-controller.js │ │ │ │ ├── dashboard.html │ │ │ │ ├── dashboard.js │ │ │ │ ├── messages-directive.js │ │ │ │ ├── messages-view.html │ │ │ │ ├── welcome-modal-directive.js │ │ │ │ └── welcome-modal.html │ │ │ ├── identity-preferences │ │ │ │ ├── identity-preferences-service.js │ │ │ │ └── identity-preferences.js │ │ │ ├── payment-token │ │ │ │ ├── add-payment-token-modal-directive.js │ │ │ │ ├── add-payment-token-modal.html │ │ │ │ ├── card-brand-filter.js │ │ │ │ ├── cc-number-filter.js │ │ │ │ ├── credit-card-selector-directive.js │ │ │ │ ├── edit-payment-token-modal-directive.js │ │ │ │ ├── edit-payment-token-modal.html │ │ │ │ ├── external-account-settings.html │ │ │ │ ├── external-accounts-controller.js │ │ │ │ ├── external-accounts-directive.js │ │ │ │ ├── external-accounts-view.html │ │ │ │ ├── kredit-directive.js │ │ │ │ ├── payment-token-form.html │ │ │ │ ├── payment-token-list-directive.js │ │ │ │ ├── payment-token-list-selector-modal-directive.js │ │ │ │ ├── payment-token-list-selector-modal.html │ │ │ │ ├── payment-token-list.html │ │ │ │ ├── payment-token-selection-directive.js │ │ │ │ ├── payment-token-selection.html │ │ │ │ ├── payment-token-selector-directive.js │ │ │ │ ├── payment-token-selector.html │ │ │ │ ├── payment-token-service.js │ │ │ │ ├── payment-token.js │ │ │ │ ├── verify-bank-account-complete.html │ │ │ │ ├── verify-bank-account-modal-directive.js │ │ │ │ ├── verify-bank-account-modal.html │ │ │ │ ├── verify-bank-account-prepare.html │ │ │ │ └── verify-bank-account-review.html │ │ │ ├── promo │ │ │ │ ├── promo-code-checker-directive.js │ │ │ │ ├── promo-service.js │ │ │ │ ├── promo.js │ │ │ │ ├── redeem-promo-code-modal-directive.js │ │ │ │ └── redeem-promo-code-modal.html │ │ │ ├── purchase │ │ │ │ ├── purchase-controller.js │ │ │ │ └── purchase.js │ │ │ ├── system │ │ │ │ ├── dashboard-controller.js │ │ │ │ └── system.js │ │ │ ├── transaction │ │ │ │ ├── money-directive.js │ │ │ │ ├── money.html │ │ │ │ ├── transaction-controller.js │ │ │ │ ├── transaction-details-directive.js │ │ │ │ ├── transaction-details.html │ │ │ │ ├── transaction-routes.js │ │ │ │ ├── transaction-service.js │ │ │ │ ├── transaction-view.html │ │ │ │ ├── transaction.html │ │ │ │ ├── transaction.js │ │ │ │ ├── transactions-directive.js │ │ │ │ └── transactions-view.html │ │ │ └── vendor │ │ │ │ ├── register-controller.js │ │ │ │ └── vendor.js │ │ ├── configs.js │ │ └── configs │ │ │ ├── settings.js │ │ │ └── site.js │ ├── contexts │ │ └── payswarm-v1.jsonld │ ├── css │ │ ├── admin.css │ │ ├── app.css │ │ ├── custom.css │ │ ├── ie.css │ │ └── system-dashboard.css │ ├── favicon.ico │ ├── fonts │ │ ├── GnuMICR.eot │ │ ├── GnuMICR.svg │ │ ├── GnuMICR.ttf │ │ ├── GnuMICR.woff │ │ ├── KreditBack.eot │ │ ├── KreditBack.svg │ │ ├── KreditBack.ttf │ │ ├── KreditBack.woff │ │ ├── KreditFront.eot │ │ ├── KreditFront.svg │ │ ├── KreditFront.ttf │ │ ├── KreditFront.woff │ │ ├── KreditShine.eot │ │ ├── KreditShine.svg │ │ ├── KreditShine.ttf │ │ └── KreditShine.woff │ ├── img │ │ ├── bank-icon.png │ │ ├── cc-background.svg │ │ ├── cc-logos.png │ │ ├── payswarm.png │ │ ├── scode.png │ │ └── swarm.png │ ├── php-json-ld │ │ └── jsonld.php │ ├── polyfill │ │ ├── Blob.js │ │ └── typedarray.js │ ├── robots.txt │ └── zip │ │ ├── deflate.js │ │ ├── inflate.js │ │ ├── mime-types.js │ │ ├── zip-ext.js │ │ ├── zip-fs.js │ │ └── zip.js └── views │ ├── about.html │ ├── assetora.html │ ├── contact.html │ ├── content-portal.html │ ├── create.html │ ├── credits.html │ ├── demo-warning.html │ ├── docs │ ├── index.html │ ├── services.budget.deleteBudget.html │ ├── services.budget.postBudgets.html │ ├── services.transaction.getTransaction.html │ ├── services.transaction.postPurchaseRequest.html │ └── services.well-known.payswarm.html │ ├── help │ ├── index.html │ ├── pricing.html │ └── wordpress.html │ ├── hostedAssets.html │ ├── identity.disabled.html │ ├── index.html │ ├── layout.html │ ├── legal.html │ ├── licenses │ └── blogging.html │ ├── purchase.html │ ├── register-public-key.html │ └── system │ └── dashboard.html └── tests ├── address-examples ├── blacksburg.json └── london.json ├── backend ├── 000-money.js ├── 001-schemas.js └── 002-payee.js ├── frontend ├── e2e │ └── adminLogin.js ├── helper.js ├── pages │ ├── dashboard.js │ └── index.js └── selectors │ └── index.js ├── payflow-examples ├── authorize.json ├── capture.json ├── charge-ach.json ├── charge.json ├── inquire.json ├── verify-ach.json ├── verify-cc.jsonld ├── verify.json └── void.json ├── purchase.js └── usaepay-examples └── bankaccount.json /.gitignore: -------------------------------------------------------------------------------- 1 | *.py[co] 2 | *.sw[nop] 3 | *~ 4 | .project 5 | .settings 6 | TAGS 7 | coverage 8 | node_modules 9 | npm-debug.log 10 | reports 11 | site/static/app/main.min.js 12 | site/static/app/templates.min.js 13 | site/static/css/bundle.min.css 14 | -------------------------------------------------------------------------------- /.jshintignore: -------------------------------------------------------------------------------- 1 | lib/rdfa/rdfa.js 2 | minify.js 3 | site/static/app/main.min.js 4 | site/static/app/templates.min.js 5 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "node": true 3 | } 4 | -------------------------------------------------------------------------------- /FAQ.md: -------------------------------------------------------------------------------- 1 | # Development 2 | 3 | ## How do I setup a local p3 development environment? 4 | 5 | See the [README][] documentation for a QuickStart guide. 6 | 7 | ## What should my mongo database config look like? 8 | 9 | If you choose to use the MongoDB module, a simple config like the following 10 | is fine: 11 | 12 | dbpath=/var/lib/mongodb 13 | logpath=/var/log/mongodb/mongodb.log 14 | logappend=true 15 | journal=true 16 | auth = true 17 | 18 | ## I'm getting an 'auth fails' Mongo error on startup. What's wrong? 19 | 20 | If you are using the MongoDB module, when the system first starts up it will 21 | connect to MongoDB as an administrator and create all of the necessary 22 | databases for p3. If you get an 'auth fails' message, the most likely 23 | culprit is that the admin username and password you're using is wrong, or 24 | you forgot to setup a database admin. 25 | 26 | Check to make sure that the admin username and password is correct by logging 27 | into MongoDB manually: 28 | 29 | > mongo 30 | > use admin 31 | > db.auth('admin', 'password') 32 | 33 | The command above assumes that 'admin' is the username and 'password' is your 34 | password. If it's not, put in whatever your admin username and password is 35 | at the time. The three commands above should return 1 (success). If the 36 | return value is 0, then your admin user isn't configured correctly. Refer to 37 | [README][] to learn how to configure the MongoDB administrator. 38 | 39 | ## How do I clear all p3 data from the MongoDB database? 40 | 41 | Make sure that the p3 process has been halted, then drop the master 42 | p3 database and the local p3 database collection: 43 | 44 | > mongo 45 | > use admin 46 | > db.auth('admin', 'password') 47 | > use payswarm_dev 48 | > db.dropDatabase() 49 | > use local 50 | > db.payswarm_dev.drop() 51 | > exit 52 | 53 | [AUTHORS]: AUTHORS.md 54 | [FEATURES]: FEATURES.md 55 | [HACKING]: HACKING.md 56 | [README]: README.md 57 | [FAQ]: FAQ.md 58 | [LICENSE]: LICENSE.md 59 | -------------------------------------------------------------------------------- /FEATURES.md: -------------------------------------------------------------------------------- 1 | # Basic Features of P3 2 | 3 | This document outlines the basic features of the p3 software platform. 4 | Generally speaking, p3 is a turn-key solution for organizations that 5 | want to process Web Payments. 6 | 7 | It provides a Web Payments as a Service (WPaaS) platform that is typically 8 | operated at banks, financial institutions, retailers, and personal domains. 9 | P3 is capable of processing payments for a single individual on a low-powered 10 | device up to enterprise transaction processing in the tens of millions of 11 | transactions per day range. 12 | 13 | ## Financial Transaction Services 14 | 15 | ### Accounts 16 | 17 | ### Budgets 18 | 19 | ### Transfers and Auditing 20 | 21 | ### Digital Signatures 22 | 23 | ## Identity Services 24 | 25 | ### Address Verification 26 | 27 | ### Credential Storage 28 | 29 | ## Customer Services 30 | 31 | ### Dashboard 32 | 33 | ### Financial Account Management 34 | 35 | ### Budget Management 36 | 37 | ### Transaction History 38 | 39 | ### Email Notification 40 | 41 | ## Payment Gateway Services 42 | 43 | ### Automated Clearing House Services 44 | 45 | ### Bank Account Verification 46 | 47 | ### Deposits and Withdrawals 48 | 49 | ### PayFlow 50 | 51 | ### USA ePay 52 | 53 | ## Retail Services 54 | 55 | ### Hosted Assets 56 | 57 | ### Hosted Offers 58 | 59 | ### External Vendor Registration 60 | 61 | ### Promotional Codes 62 | 63 | ### Digital Receipts 64 | 65 | ## Auditing Services 66 | 67 | ### Real-time Regulatory Reporting 68 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | /* 2 | * PaySwarm Gruntfile. 3 | * 4 | * Copyright (c) 2012-2014 Digital Bazaar, Inc. All rights reserved. 5 | */ 6 | module.exports = function(grunt) { 7 | 'use strict'; 8 | 9 | // configure w/bedrock grunt config 10 | var bedrockGrunt = require(__dirname + '/node_modules/bedrock/Gruntfile'); 11 | bedrockGrunt(grunt); 12 | 13 | // update dirs 14 | var dirs = grunt.config.getRaw('dirs'); 15 | dirs.bedrock = __dirname + '/node_modules/bedrock'; 16 | dirs.payswarm = __dirname; 17 | grunt.config('dirs', dirs); 18 | 19 | // read package configuration 20 | grunt.config('pkg', grunt.file.readJSON('package.json')); 21 | 22 | // add templates 23 | var ngtemplates = grunt.config.getRaw('ngtemplates'); 24 | ngtemplates.myapp.src.push('site/static/app/components/**/*.html'); 25 | grunt.config('ngtemplates', ngtemplates); 26 | 27 | // requirejs 28 | var requirejs = grunt.config.getRaw('requirejs'); 29 | var compileOptions = requirejs.compile.options; 30 | compileOptions.paths.payswarm = '<%= dirs.payswarm %>/site/static'; 31 | compileOptions.paths['app/components'] = '<%= dirs.payswarm %>/site/static/app/components'; 32 | compileOptions.paths['app/configs'] = '<%= dirs.payswarm %>/site/static/app/configs'; 33 | compileOptions.paths['app/templates'] = '<%= dirs.payswarm %>/site/static/app/templates.min'; 34 | compileOptions.shim = { 35 | // export app/bootstrap globals 36 | 'FileSaver': {exports: 'saveAs'}, 37 | 'zip': {exports: 'zip'} 38 | }; 39 | grunt.config('requirejs', requirejs); 40 | 41 | // jscs 42 | var jscs = grunt.config.getRaw('jscs'); 43 | jscs.all.options.excludeFiles.push('<%= dirs.payswarm %>/lib/rdfa/*.js'); 44 | grunt.config('jscs', jscs); 45 | }; 46 | -------------------------------------------------------------------------------- /HACKING.md: -------------------------------------------------------------------------------- 1 | # P3 Hacking 2 | 3 | Please refer to the following document for best practices related to 4 | hacking on the p3 code base: 5 | 6 | https://github.com/digitalbazaar/bedrock/blob/master/HACKING.md 7 | 8 | -------------------------------------------------------------------------------- /configs/yahoo-av.example.js: -------------------------------------------------------------------------------- 1 | var config = require('bedrock').config; 2 | 3 | // yahoo address validator config 4 | config.addressValidator.yahoo = {}; 5 | config.addressValidator.yahoo.hashKey = 'YAHOO_AV_HASH_KEY'; 6 | config.addressValidator.yahoo.consumerKey = 'YAHOO_AV_CONSUMER_KEY'; 7 | config.addressValidator.yahoo.consumerSecret = 'YAHOO_AV_CONSUMER_SECRET'; 8 | -------------------------------------------------------------------------------- /email-templates/bedrock.Identity.created-identity.tpl: -------------------------------------------------------------------------------- 1 | To: {{identity.email}} 2 | From: "{{service.name}} {{support.name}}" <{{support.email}}> 3 | Subject: {{subject.identityPrefix}}Welcome to {{service.name}}! 4 | 5 | {% if productionMode == false %} 6 | ******* 7 | NOTE: This is a demonstration website notification. 8 | More info is available at https://payswarm.com/wiki/Demo_Warning. 9 | ******* 10 | 11 | {% endif -%} 12 | Hello {{identity.label}}, 13 | 14 | Welcome to {{service.name}}! 15 | 16 | We're so glad you joined! Please let us know if there is anything that we 17 | can do to help you settle into the website. 18 | 19 | {{service.name}} is a demo website for testing out PaySwarm. If you're a 20 | developer, feel free to check out the API documentation here: 21 | 22 | {{baseUri}}/docs 23 | 24 | You can manage your identity, financial accounts, credit/debit cards, bank 25 | accounts, and other settings by going here: 26 | 27 | {{identity.id}}/dashboard 28 | 29 | We'd love to hear any feedback you have about {{service.name}}. 30 | Just send an email to {{comments.email}}. 31 | 32 | If you have any questions or comments please contact {{support.email}}. 33 | -------------------------------------------------------------------------------- /email-templates/common.Deposit.ach-merchant-account-log.tpl: -------------------------------------------------------------------------------- 1 | To: {{service.domain}}-merchant-account-logs@digitalbazaar.com 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} ACH deposit log ({{deposit.id}}) 4 | 5 | Merchant Name: Digital Bazaar, Inc. 6 | Merchant Location: Blacksburg, VA, USA 7 | Merchant Company URL: http://digitalbazaar.com/ 8 | Merchant Service URL: {{baseUri}}/ 9 | Deposit Amount: ${{amount}} {{deposit.currency}} 10 | Transaction Amount: ${{deposit.amount}} {{deposit.currency}} 11 | Transaction Date: {{deposit.created}} 12 | Transaction Payment Type: {{deposit.source.paymentMethod}} 13 | Transaction ID: {{deposit.id}} 14 | Owner: {{deposit.source.owner}} 15 | Bank Routing Number: {{deposit.source.bankRoutingNumber}} 16 | Bank Account Number: {{deposit.source.bankAccount}} 17 | ACH Gateway: {{deposit.source.paymentGateway}} 18 | Authorization Approval Code: {{deposit.sysGatewayApprovalCode}} 19 | Transaction Type: purchase 20 | Transaction Description: {{service.name}} deposit 21 | Return/Refund Policy: {{baseUri}}/legal#tos 22 | -------------------------------------------------------------------------------- /email-templates/common.Deposit.cc-merchant-account-log.tpl: -------------------------------------------------------------------------------- 1 | To: {{service.domain}}-merchant-account-logs@digitalbazaar.com 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} card deposit log ({{deposit.id}}) 4 | 5 | Merchant Name: Digital Bazaar, Inc. 6 | Merchant Location: Blacksburg, VA, USA 7 | Merchant Company URL: http://digitalbazaar.com/ 8 | Merchant Service URL: {{baseUri}}/ 9 | Transaction Amount: ${{deposit.amount}} {{deposit.currency}} 10 | Transaction Date: {{deposit.created}} 11 | Transaction Payment Type: {{deposit.source.paymentMethod}} 12 | Transaction ID: {{deposit.id}} 13 | Owner: {{deposit.source.owner}} 14 | Card Brand: {{deposit.source.cardBrand}} 15 | Card Number: {{deposit.source.cardNumber}} 16 | Card Expiration: {{deposit.source.cardExpMonth}}/{{deposit.source.cardExpYear}} 17 | Payment Gateway: {{deposit.source.paymentGateway}} 18 | Authorization Approval Code: {{deposit.sysGatewayApprovalCode}} 19 | Transaction Type: purchase 20 | Transaction Description: {{service.name}} deposit 21 | Return/Refund Policy: {{baseUri}}/legal#tos 22 | -------------------------------------------------------------------------------- /email-templates/common.Deposit.failure.tpl: -------------------------------------------------------------------------------- 1 | To: {{deposits.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} deposit FAILED: {{deposit.currency}} ${{deposit.amount}} ({{deposit.id}}) 4 | 5 | Machine: {{machine}} 6 | Transaction ID: {{deposit.id}} 7 | Date: {{deposit.created}} 8 | Charge: {{deposit.currency}} ${{deposit.amount}} 9 | Requestor: {{identity.id}} 10 | Requestor Email: {{identity.email}} 11 | Requestor Label: {{identity.label}} 12 | 13 | {% if headers %} 14 | ============================== HTTP Headers ================================ 15 | {% for h in headers -%} 16 | {{loop.key}}: {{h}} 17 | {% endfor -%} 18 | {% endif -%} 19 | =============================== Requestor ================================== 20 | {{toJson(identity)}} 21 | ================================ Deposit =================================== 22 | {{toJson(deposit)}} 23 | ================================= Error ==================================== 24 | {{toJson(error)}} 25 | -------------------------------------------------------------------------------- /email-templates/common.Deposit.success-identity.tpl: -------------------------------------------------------------------------------- 1 | To: {{identity.email}} 2 | From: "{{service.name}} {{support.name}}" <{{support.email}}> 3 | Subject: {{subject.identityPrefix}}{{service.name}} deposit receipt 4 | 5 | {% if productionMode == false %} 6 | *** NOTE *** 7 | This is a demonstration website notification and no real money was involved. 8 | More info is available at https://payswarm.com/wiki/Demo_Warning. 9 | *** NOTE *** 10 | 11 | {% endif -%} 12 | Your {% if deposit.source.cardNumber %}card{% elseif deposit.source.bankAccount %}bank account{% else %}account{% endif %} has been charged ${{deposit.amount}} {{deposit.currency}}. 13 | 14 | {%- if deposit.source.bankAccount %} 15 | 16 | It will take between 3-7 business days for the money to be transferred from your 17 | bank account to {{service.name}}. 18 | {%- endif %} 19 | 20 | Here is your deposit receipt: 21 | 22 | Transaction ID: {{deposit.id}} 23 | Date and Time: {{deposit.created}} 24 | Source: 25 | From: {{deposit.source.label}} 26 | {% if deposit.source.cardNumber %} Number: {{deposit.source.cardNumber}} 27 | Exp: {{deposit.source.cardExpMonth}}/{{deposit.source.cardExpYear}} 28 | {% elseif deposit.source.bankAccount %} Routing: {{deposit.source.bankRoutingNumber}} 29 | Account: {{deposit.source.bankAccount}} 30 | {% endif %} Charge: ${{deposit.amount}} {{deposit.currency}} 31 | Deposit Details*: 32 | {%- for transfer in deposit.transfer %} 33 | {{transfer.comment}}: ${{transfer.amount}} {{transfer.currency}} 34 | {%- endfor %} 35 | 36 | You can view your latest financial activity on your account activity page. 37 | 38 | {{deposit.transfer[0].destination}}?view=activity 39 | 40 | If you have any questions or comments please contact {{support.email}}. 41 | 42 | * All deposit fees are used to reimburse {{service.name}} for fees charged by banks and the banking and financial networks. 43 | -------------------------------------------------------------------------------- /email-templates/common.Deposit.success.tpl: -------------------------------------------------------------------------------- 1 | To: {{deposits.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} {{stage}} deposit: {{deposit.currency}} ${{deposit.amount}} ({{deposit.id}}) 4 | 5 | Machine: {{machine}} 6 | Transaction ID: {{deposit.id}} 7 | Date: {{deposit.created}} 8 | Charge: {{deposit.currency}} ${{deposit.amount}} 9 | Requestor: {{identity.id}} 10 | Requestor Email: {{identity.email}} 11 | Requestor Label: {{identity.label}} 12 | 13 | {% if headers %} 14 | ============================== HTTP Headers ================================ 15 | {% for h in headers -%} 16 | {{loop.key}}: {{h}} 17 | {% endfor -%} 18 | {% endif -%} 19 | =============================== Requestor ================================== 20 | {{toJson(identity)}} 21 | ================================ Deposit =================================== 22 | {{toJson(deposit)}} 23 | -------------------------------------------------------------------------------- /email-templates/common.FinancialAccount.created.tpl: -------------------------------------------------------------------------------- 1 | To: {{registration.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} Account created: {{account.id}}) 4 | 5 | -----BEGIN ACCOUNT----- 6 | {{toJson(account)}} 7 | -----END ACCOUNT----- 8 | -------------------------------------------------------------------------------- /email-templates/common.FinancialAccount.unbackedCreditPayoffFailed-identity.tpl: -------------------------------------------------------------------------------- 1 | To: {{identity.email}} 2 | From: "{{service.name}} {{support.name}}" <{{support.email}}> 3 | Subject: {{subject.identityPrefix}}A credit line payment failed for an account on {{service.name}} 4 | 5 | {% if productionMode == false %} 6 | ******* 7 | NOTE: This is a demonstration website notification. 8 | More info is available at https://payswarm.com/wiki/Demo_Warning. 9 | ******* 10 | {% endif %} 11 | Hello {{identity.label}}, 12 | 13 | An attempt to pay off your used credit with your account "{{account.label}}" 14 | has failed on the {{service.name}} website! Please sign into {{service.name}} 15 | and correct your payment information to prevent any problems with future 16 | payments. 17 | 18 | We'd love to hear any feedback you have about {{service.name}}. 19 | Just send an email to {{comments.email}}. 20 | 21 | If you have any questions or comments please contact {{support.email}}. 22 | -------------------------------------------------------------------------------- /email-templates/common.FinancialAccount.unbackedCreditPayoffFailed.tpl: -------------------------------------------------------------------------------- 1 | To: {{notify.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} FinancialAccount intervention required, credit payoff FAILED for {{account.id}} 4 | 5 | Machine: {{machine}} 6 | Account ID: {{account.id}} 7 | Identity ID: {{identity.id}} 8 | -------------------------------------------------------------------------------- /email-templates/common.PaymentToken.bankAccountCreated-identity.tpl: -------------------------------------------------------------------------------- 1 | To: {{identity.email}} 2 | From: "{{service.name}} {{support.name}}" <{{support.email}}> 3 | Subject: {{subject.identityPrefix}}Bank account linking started on {{service.name}} 4 | 5 | {% if productionMode == false %} 6 | ******* 7 | NOTE: This is a demonstration website notification. 8 | More info is available at https://payswarm.com/wiki/Demo_Warning. 9 | ******* 10 | {% endif %} 11 | Hello {{identity.label}}, 12 | 13 | We have begun the verification process for linking your bank account, 14 | which you labeled "{{paymentToken.label}}", with the {{service.name}} website! 15 | In about 3-7 business days, you should see two small deposits appear on your 16 | bank statement for the following bank account: 17 | 18 | Account Number: {{paymentToken.bankAccount}} 19 | Routing Number: {{paymentToken.bankRoutingNumber}} 20 | 21 | The deposits should have the label "DIGITAL BAZAAR CREDIT". You will need to 22 | record the amounts associated with these deposits and enter them into the 23 | {{service.name}} website in order to complete the verification process that will 24 | link your bank account. It may take up to 24 hours after the deposits appear 25 | on your bank statement for the "Verify" link to become available on the 26 | {{service.name}} website. 27 | 28 | You can verify and manage your bank accounts here: 29 | 30 | {{identity.id}}/settings 31 | 32 | We'd love to hear any feedback you have about {{service.name}}. 33 | Just send an email to {{comments.email}}. 34 | 35 | If you have any questions or comments please contact {{support.email}}. 36 | -------------------------------------------------------------------------------- /email-templates/common.PaymentToken.bankAccountCreated.tpl: -------------------------------------------------------------------------------- 1 | To: {{notify.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} PaymentToken Bank Account created for {{identity.id}} 4 | 5 | -----BEGIN IDENTITY----- 6 | {{toJson(identity)}} 7 | -----END IDENTITY----- 8 | -----BEGIN PAYMENT TOKEN----- 9 | {{toJson(paymentToken)}} 10 | -----END PAYMENT TOKEN----- 11 | -------------------------------------------------------------------------------- /email-templates/common.PaymentToken.unverified-identity.tpl: -------------------------------------------------------------------------------- 1 | To: {{identity.email}} 2 | From: "{{service.name}} {{support.name}}" <{{support.email}}> 3 | Subject: {{subject.identityPrefix}}Verify your bank account on {{service.name}} 4 | 5 | {% if productionMode == false %} 6 | ******* 7 | NOTE: This is a demonstration website notification. 8 | More info is available at https://payswarm.com/wiki/Demo_Warning. 9 | ******* 10 | {% endif %} 11 | Hello {{identity.label}}, 12 | 13 | Your bank account "{{paymentToken.label}}" is ready to be verified on the {{service.name}} website! 14 | {% if verify %} 15 | Because this is a development sandbox and this bank account is not real, the 16 | transaction amounts required to verify the bank account are included below. 17 | On a real system you would get these amounts from your bank. 18 | 19 | Amounts: {{verify[0].amount}}, {{verify[1].amount}} 20 | {% endif %} 21 | You can verify and manage your bank accounts here: 22 | 23 | {{identity.id}}/settings 24 | 25 | We'd love to hear any feedback you have about {{service.name}}. 26 | Just send an email to {{comments.email}}. 27 | 28 | If you have any questions or comments please contact {{support.email}}. 29 | -------------------------------------------------------------------------------- /email-templates/common.PaymentToken.unverified.tpl: -------------------------------------------------------------------------------- 1 | To: {{notify.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} PaymentToken unverified for {{identity.id}} 4 | 5 | -----BEGIN IDENTITY----- 6 | {{toJson(identity)}} 7 | -----END IDENTITY----- 8 | -----BEGIN PAYMENT TOKEN----- 9 | {{toJson(paymentToken)}} 10 | -----END PAYMENT TOKEN----- 11 | {%- if verify %} 12 | -----VERIFY DATA----- 13 | {{toJson(verify)}} 14 | -----END VERIFY DATA----- 15 | {% endif -%} 16 | -------------------------------------------------------------------------------- /email-templates/common.PaymentToken.unverifiedLimitReached.tpl: -------------------------------------------------------------------------------- 1 | To: {{notify.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} Unverified PaymentToken limit reached 4 | 5 | Machine: {{machine}} 6 | Token Limit: {{limit}} 7 | 8 | ================================ Error =================================== 9 | {{toJson(error)}} 10 | -------------------------------------------------------------------------------- /email-templates/common.PaymentToken.verified-identity.tpl: -------------------------------------------------------------------------------- 1 | To: {{identity.email}} 2 | From: "{{service.name}} {{support.name}}" <{{support.email}}> 3 | Subject: {{subject.identityPrefix}}Your bank account has been verified on {{service.name}} 4 | 5 | {% if productionMode == false %} 6 | ******* 7 | NOTE: This is a demonstration website notification. 8 | More info is available at https://payswarm.com/wiki/Demo_Warning. 9 | ******* 10 | 11 | {% endif -%} 12 | Hello {{identity.label}}, 13 | 14 | Your bank account "{{paymentToken.label}}" has been verified on {{service.name}}! 15 | 16 | You can manage your bank accounts here: 17 | 18 | {{identity.id}}/settings 19 | 20 | We'd love to hear any feedback you have about {{service.name}}. 21 | Just send an email to {{comments.email}}. 22 | 23 | If you have any questions or comments please contact {{support.email}}. 24 | -------------------------------------------------------------------------------- /email-templates/common.PaymentToken.verifyBalanceTooLow.tpl: -------------------------------------------------------------------------------- 1 | To: {{notify.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} PaymentToken verify balance too low 4 | 5 | Machine: {{machine}} 6 | Account: {{account}} 7 | {% if balance %}Balance: {{currency}} {{balance}}{% endif %} 8 | -------------------------------------------------------------------------------- /email-templates/common.PaymentToken.verifyFailed.tpl: -------------------------------------------------------------------------------- 1 | To: {{notify.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} PaymentToken intervention required, verify FAILED for {{tokenId}} 4 | 5 | Machine: {{machine}} 6 | Token ID: {{tokenId}} 7 | -------------------------------------------------------------------------------- /email-templates/common.Purchase.success-identity.tpl: -------------------------------------------------------------------------------- 1 | To: {{identity.email}} 2 | From: "{{service.name}} {{support.name}}" <{{support.email}}> 3 | Subject: {{subject.identityPrefix}}{{service.name}} purchase notification 4 | 5 | {% if productionMode == false %} 6 | ******* 7 | NOTE: This is a demo website notification and no real money was involved. 8 | More info is available at https://payswarm.com/wiki/Demo_Warning. 9 | ******* 10 | 11 | {% endif -%} 12 | A purchase has just been made using your {{service.name}} account. 13 | 14 | Asset: "{{contract.asset.title}}" by {{contract.asset.creator.name}} 15 | Asset Provider{% if contract.assetProvider.id == contract.vendor.id %} and Vendor{% endif %}: {{contract.assetProvider.label}} ({{contract.assetProvider.url}}) 16 | {% if contract.assetProvider.id != contract.vendor.id -%} 17 | Vendor: {{contract.vendor.label}} ({{contract.vendor.url}}) 18 | {% endif %} 19 | The purchased content is available here: 20 | 21 | {{contract.asset.assetContent}} 22 | 23 | The details of this transaction are located here: 24 | 25 | {{contract.id}} 26 | 27 | If you have any questions or comments about this purchase, please contact: 28 | {{support.email}} 29 | 30 | Digital Bazaar, Inc. 31 | Blacksburg, VA, USA 32 | -------------------------------------------------------------------------------- /email-templates/common.Purchase.success.tpl: -------------------------------------------------------------------------------- 1 | To: {{contracts.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} Purchase for "{{contract.asset.title}}" from {{contract.assetProvider.label}} 4 | 5 | Machine: {{machine}} 6 | Transaction ID: {{contract.id}} 7 | Date: {{contract.created}} 8 | Amount: {{contract.currency}} ${{contract.amount}} 9 | Asset ID: {{contract.asset.id}} 10 | Asset Title: {{contract.asset.title}} 11 | Asset Content: {{contract.asset.assetContent}} 12 | Acquirer ID: {{contract.assetAcquirer.id}} 13 | Provider ID: {{contract.assetProvider.id}} 14 | Vendor ID: {{contract.vendor.id}} 15 | 16 | ================================ Contract =================================== 17 | {{toJson(contract)}} 18 | -------------------------------------------------------------------------------- /email-templates/common.Transaction.externalTransactionVoided.tpl: -------------------------------------------------------------------------------- 1 | To: {{notify.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} possible intervention required for {{transactionId}} 4 | 5 | Machine: {{machine}} 6 | Transaction ID: {{transactionId}} 7 | 8 | The payment gateway indicated that the external transaction was voided during 9 | a status check. Possible intervention is required to deal with this transaction. 10 | -------------------------------------------------------------------------------- /email-templates/common.Transaction.statusCheckError.tpl: -------------------------------------------------------------------------------- 1 | To: {{notify.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} intervention required for {{transactionId}} 4 | 5 | Machine: {{machine}} 6 | Transaction ID: {{transactionId}} 7 | 8 | The payment gateway returned an error during a transaction status check. 9 | Intervention is required to deal with this transaction. 10 | -------------------------------------------------------------------------------- /email-templates/common.Transaction.statusChecksExceeded.tpl: -------------------------------------------------------------------------------- 1 | To: {{notify.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} intervention required for {{transactionId}} 4 | 5 | Machine: {{machine}} 6 | Transaction ID: {{transactionId}} 7 | 8 | Too many external status checks have been performed without an adequate 9 | settled/voided response for the transaction with the above ID. Intervention 10 | is required to deal with this transaction. 11 | 12 | A status check is performed via a payment gateway's API to see if a transaction 13 | has been settled or voided by an external monetary system. A limit is placed 14 | on these automated checks to ensure that transactions are finishing in a 15 | timely fashion and to prevent overuse of an external API that may cost money. 16 | 17 | The maximum number of external status checks (with a payment gateway) 18 | has been exceeded for the transaction with the above ID. 19 | -------------------------------------------------------------------------------- /email-templates/common.Withdrawal.ach-merchant-account-log.tpl: -------------------------------------------------------------------------------- 1 | To: {{service.domain}}-merchant-account-logs@digitalbazaar.com 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} ACH withdrawal log ({{withdrawal.id}}) 4 | 5 | Merchant Name: Digital Bazaar, Inc. 6 | Merchant Location: Blacksburg, VA, USA 7 | Merchant Company URL: http://digitalbazaar.com/ 8 | Merchant Service URL: {{baseUri}}/ 9 | Withdrawal Amount: ${{amount}} {{withdrawal.currency}} 10 | Transaction Total: ${{withdrawal.amount}} {{withdrawal.currency}} 11 | Transaction Date: {{withdrawal.created}} 12 | Transaction Payment Type: {{withdrawal.destination.paymentMethod}} 13 | Transaction ID: {{withdrawal.id}} 14 | Owner: {{withdrawal.destination.owner}} 15 | Bank Routing Number: {{withdrawal.destination.bankRoutingNumber}} 16 | Bank Account Number: {{withdrawal.destination.bankAccount}} 17 | ACH Gateway: {{withdrawal.destination.paymentGateway}} 18 | Authorization Approval Code: {{withdrawal.sysGatewayApprovalCode}} 19 | Transaction Type: credit 20 | Transaction Description: {{service.name}} withdrawal 21 | Return/Refund Policy: {{baseUri}}/legal#tos 22 | -------------------------------------------------------------------------------- /email-templates/common.Withdrawal.failure.tpl: -------------------------------------------------------------------------------- 1 | To: {{deposits.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} withdrawal FAILED: {{withdrawal.currency}} ${{withdrawal.amount}} ({{withdrawal.id}}) 4 | 5 | Machine: {{machine}} 6 | Transaction ID: {{withdrawal.id}} 7 | Date: {{withdrawal.created}} 8 | Credit: {{withdrawal.currency}} ${{amount}} 9 | Requestor ID: {{identity.id}} 10 | Requestor Email: {{identity.email}} 11 | Requestor Label: {{identity.label}} 12 | 13 | {% if headers %} 14 | ============================== HTTP Headers ================================ 15 | {% for h in headers -%} 16 | {{loop.key}}: {{h}} 17 | {% endfor -%} 18 | {% endif -%} 19 | =============================== Requestor ================================== 20 | {{toJson(identity)}} 21 | =============================== Withdrawal ================================= 22 | {{toJson(withdrawal)}} 23 | ================================= Error ==================================== 24 | {{toJson(error)}} 25 | -------------------------------------------------------------------------------- /email-templates/common.Withdrawal.success-identity.tpl: -------------------------------------------------------------------------------- 1 | To: {{identity.email}} 2 | From: "{{service.name}} {{support.name}}" <{{support.email}}> 3 | Subject: {{subject.identityPrefix}}{{service.name}} withdrawal receipt 4 | 5 | {% if productionMode == false %} 6 | *** NOTE *** 7 | This is a demonstration website notification and no real money was involved. 8 | More info is available at https://payswarm.com/wiki/Demo_Warning. 9 | *** NOTE *** 10 | 11 | {% endif -%} 12 | Your {% if withdrawal.destination.bankAccount %}bank account{% else %}account{% endif %} has been credited with ${{amount}} {{withdrawal.currency}}. 13 | 14 | {%- if withdrawal.destination.bankAccount %} 15 | 16 | It will take between 3-7 business days for the money to be transferred from 17 | {{service.name}} to your bank account. 18 | {%- endif %} 19 | 20 | Here is your withdrawal receipt: 21 | 22 | Transaction ID: {{withdrawal.id}} 23 | Date and Time: {{withdrawal.created}} 24 | Source: 25 | From: {{withdrawal.source}} 26 | Destination: 27 | {% if withdrawal.destination.bankAccount %} Routing: {{withdrawal.destination.bankRoutingNumber}} 28 | Account: {{withdrawal.destination.bankAccount}} 29 | {% endif %} Credit: ${{amount}} {{withdrawal.currency}} 30 | Withdrawal Details*: 31 | {%- for transfer in withdrawal.transfer %} 32 | {{transfer.comment}}: ${{transfer.amount}} {{transfer.currency}} 33 | {%- endfor %} 34 | 35 | You can view your latest financial activity on your account activity page. 36 | 37 | {{withdrawal.transfer[0].source}}?view=activity 38 | 39 | If you have any questions or comments please contact {{support.email}}. 40 | 41 | * All withdrawal fees are used to reimburse {{service.name}} for fees charged by banks and the banking and financial networks. 42 | -------------------------------------------------------------------------------- /email-templates/common.Withdrawal.success.tpl: -------------------------------------------------------------------------------- 1 | To: {{withdrawals.email}} 2 | From: "{{service.name}} {{system.name}}" <{{system.email}}> 3 | Subject: {{subject.prefix}}{{service.name}} {{stage}} withdrawal: {{withdrawal.currency}} ${{amount}} ({{withdrawal.id}}) 4 | 5 | Machine: {{machine}} 6 | Transaction ID: {{withdrawal.id}} 7 | Date: {{withdrawal.created}} 8 | Credit: {{withdrawal.currency}} ${{amount}} 9 | Requestor ID: {{identity.id}} 10 | Requestor Email: {{identity.email}} 11 | Requestor Label: {{identity.label}} 12 | 13 | {% if headers %} 14 | ============================== HTTP Headers ================================ 15 | {% for h in headers -%} 16 | {{loop.key}}: {{h}} 17 | {% endfor -%} 18 | {% endif -%} 19 | =============================== Requestor ================================== 20 | {{toJson(identity)}} 21 | =============================== Withdrawal ================================= 22 | {{toJson(withdrawal)}} 23 | -------------------------------------------------------------------------------- /email-templates/hosted.Listing.assetExpired-identity.tpl: -------------------------------------------------------------------------------- 1 | To: {{identity.email}} 2 | From: "{{service.name}} {{support.name}}" <{{support.email}}> 3 | Subject: {{subject.identityPrefix}}{{service.name}} listing asset expired 4 | 5 | {% if productionMode == false %} 6 | *** NOTE *** 7 | This is a demonstration website notification and no real money was involved. 8 | More info is available at https://payswarm.com/wiki/Demo_Warning. 9 | *** NOTE *** 10 | 11 | {% endif -%} 12 | An asset that you have listed for sale has expired. Please log in and change 13 | or remove the listing. 14 | 15 | Asset Title: {{asset.title}} 16 | Asset Creator: {{asset.creator.name}} 17 | Asset Content: {{asset.assetContent}} 18 | Asset Expired: {{asset.listingRestrictions.validUntil}} 19 | Your Listing ID: {{listing.id}} 20 | -------------------------------------------------------------------------------- /email-templates/mapper.js: -------------------------------------------------------------------------------- 1 | module.exports.map = function(mapping) { 2 | var ids = [ 3 | 'bedrock.Identity.created-identity', 4 | 'common.FinancialAccount.created', 5 | 'common.FinancialAccount.unbackedCreditPayoffFailed', 6 | 'common.FinancialAccount.unbackedCreditPayoffFailed-identity', 7 | 'common.Deposit.ach-merchant-account-log', 8 | 'common.Deposit.cc-merchant-account-log', 9 | 'common.Deposit.failure', 10 | 'common.Deposit.success', 11 | 'common.Deposit.success-identity', 12 | 'common.PaymentToken.bankAccountCreated', 13 | 'common.PaymentToken.bankAccountCreated-identity', 14 | 'common.PaymentToken.unverified', 15 | 'common.PaymentToken.unverified-identity', 16 | 'common.PaymentToken.unverifiedLimitReached', 17 | 'common.PaymentToken.verified-identity', 18 | 'common.PaymentToken.verifyBalanceTooLow', 19 | 'common.PaymentToken.verifyFailed', 20 | 'common.Purchase.success', 21 | 'common.Purchase.success-identity', 22 | 'common.Transaction.externalTransactionVoided', 23 | 'common.Transaction.statusCheckError', 24 | 'common.Transaction.statusChecksExceeded', 25 | 'common.Withdrawal.ach-merchant-account-log', 26 | 'common.Withdrawal.failure', 27 | 'common.Withdrawal.success', 28 | 'common.Withdrawal.success-identity', 29 | 'hosted.Listing.assetExpired-identity' 30 | ]; 31 | 32 | ids.forEach(function(id) { 33 | var filename = __dirname + '/' + id + '.tpl'; 34 | mapping[id] = {filename: filename}; 35 | }); 36 | }; 37 | -------------------------------------------------------------------------------- /lib/payswarm-auth/financial.transfer.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2014 Digital Bazaar, Inc. All rights reserved. 3 | */ 4 | var bedrock = require('bedrock'); 5 | var payswarm = { 6 | config: bedrock.module('config'), 7 | db: bedrock.module('bedrock.database'), 8 | financial: require('./financial'), 9 | identity: bedrock.module('bedrock.identity'), 10 | logger: bedrock.module('loggers').get('app'), 11 | security: require('./security'), 12 | tools: require('./tools') 13 | }; 14 | 15 | // constants 16 | var MODULE_NS = payswarm.financial.namespace; 17 | 18 | // module permissions 19 | var PERMISSIONS = payswarm.config.permission.permissions; 20 | 21 | // sub module API 22 | var api = {}; 23 | module.exports = api; 24 | 25 | /** 26 | * Initializes this module. 27 | * 28 | * @param callback(err) called once the operation completes. 29 | */ 30 | api.init = function(callback) { 31 | callback(); 32 | }; 33 | 34 | /** 35 | * Processes a financial Transaction containing a list of financial 36 | * Transfers. The transaction ID will be generated and assigned by this 37 | * method. 38 | * 39 | * @param actor the Identity performing the action. 40 | * @param transaction the Transaction to process. 41 | * @param options the transfer options. 42 | * @param callback(err) called once the operation completes. 43 | */ 44 | api.processTransfer = function(actor, transaction, options, callback) { 45 | // FIXME: implement me 46 | }; 47 | -------------------------------------------------------------------------------- /lib/payswarm-auth/jsonld.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013-2014 Digital Bazaar, Inc. All rights reserved. 3 | */ 4 | var bedrock = require('bedrock'); 5 | module.exports = bedrock.module('jsonld'); 6 | -------------------------------------------------------------------------------- /lib/payswarm-auth/system.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2014 Digital Bazaar, Inc. All rights reserved. 3 | */ 4 | var bedrock = require('bedrock'); 5 | var payswarm = { 6 | logger: bedrock.module('loggers').get('app') 7 | }; 8 | 9 | var api = {}; 10 | module.exports = api; 11 | 12 | api.name = 'System'; 13 | api.init = function(app, callback) { 14 | callback(null); 15 | }; 16 | -------------------------------------------------------------------------------- /locales/de.js: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /locales/en.js: -------------------------------------------------------------------------------- 1 | { 2 | "Service Endpoints": "Service Endpoints", 3 | "Identities": "Identities", 4 | "Accounts": "Accounts", 5 | "Budgets": "Budgets", 6 | "Keys": "Keys", 7 | "Validator not found.": "Validator not found." 8 | } -------------------------------------------------------------------------------- /locales/es.js: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /locales/fr.js: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /locales/ja.js: -------------------------------------------------------------------------------- 1 | { 2 | "Service Endpoints": "ウェブサービス 場所", 3 | "Identities": "恒等式", 4 | "Accounts": "金融勘定", 5 | "Budgets": "予算", 6 | "Keys": "キーにアクセスする" 7 | } 8 | -------------------------------------------------------------------------------- /locales/ru.js: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /locales/zh.js: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /payswarm.dev.js: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2012-2014 Digital Bazaar, Inc. All rights reserved. 3 | */ 4 | var br = require('bedrock'); 5 | 6 | if(module.parent) { 7 | module.exports = br; 8 | } else { 9 | // load PaySwarm config and dev data 10 | require('./configs/payswarm.dev'); 11 | require('./configs/dev-data'); 12 | br.start(); 13 | } 14 | -------------------------------------------------------------------------------- /pki/README: -------------------------------------------------------------------------------- 1 | PaySwarm Authority PKI 2 | ====================== 3 | 4 | To generate new key-pair on the command line: 5 | 6 | openssl genrsa -out newkey.pem 2048 7 | openssl rsa -in newkey.pem -pubout > newkey.pub 8 | 9 | To convert it to a string for use in JSON config files: 10 | 11 | cat newkey.pem | perl -p -e 's/\n/\\n/' && echo 12 | cat newkey.pub | perl -p -e 's/\n/\\n/' && echo 13 | 14 | To generate a OpenSSH public key to use for remote logins: 15 | 16 | openssl genrsa -out sshkey.pem 2048 17 | chmod go-rwx sshkey.pem 18 | ssh-keygen -y -f sshkey.pem > sshkey.pub 19 | # append sshkey.pub to target machine ~ACCOUNT/.ssh/authorized_keys 20 | -------------------------------------------------------------------------------- /pki/test-payswarm-auth.crt: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIEkTCCA3mgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBkTELMAkGA1UEBhMCVVMx 3 | ETAPBgNVBAgTCFZpcmdpbmlhMRMwEQYDVQQHEwpCbGFja3NidXJnMR0wGwYDVQQK 4 | ExREaWdpdGFsIEJhemFhciwgSW5jLjEnMCUGA1UECxMeVGVzdCBCaXRtdW5rIE5l 5 | dHdvcmsgQXV0aG9yaXR5MRIwEAYDVQQDEwliaXRtdW5rLTEwHhcNMTAwMTIzMDIw 6 | MTI5WhcNMzAwMTE4MDIwMTI5WjCBkTELMAkGA1UEBhMCVVMxETAPBgNVBAgTCFZp 7 | cmdpbmlhMRMwEQYDVQQHEwpCbGFja3NidXJnMR0wGwYDVQQKExREaWdpdGFsIEJh 8 | emFhciwgSW5jLjEnMCUGA1UECxMeVGVzdCBCaXRtdW5rIE5ldHdvcmsgQXV0aG9y 9 | aXR5MRIwEAYDVQQDEwliaXRtdW5rLTEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw 10 | ggEKAoIBAQDsNQTe1VPBnXDhUbYkaQLm3cbhxrgwHTTWNnUSz7z4GDvPr3OAQuRR 11 | r+WzHr5jONyJH8d/xlfiic9WMMq3o9lmh1dqMcq2qgOuutdtbbTET6VettergS+2 12 | h8g/BC5/9u6wEAaazHE35H1dbI1uWSE7DFX9B3DLzOldSqrR69uwe0jtD5mq8+MH 13 | uW+3neLgiWkHnKl63pHAPvPrwmVuHLBmG6/1x/LJ8uuoAY5plqLSszdSH7P/7uK5 14 | njgfS94Z+N7XVbNWItvlpz6+hV7aAuj23uEsAmN758RKRfdf2794+8oD8Io6ZTDB 15 | Uq9o9ee4144WNkW6QhZjtdDzMxuC+JgpAgMBAAGjgfEwge4wHQYDVR0OBBYEFGMP 16 | WR61Bu3eO/3GxyTDNntGWo0hMIG+BgNVHSMEgbYwgbOAFGMPWR61Bu3eO/3GxyTD 17 | NntGWo0hoYGXpIGUMIGRMQswCQYDVQQGEwJVUzERMA8GA1UECBMIVmlyZ2luaWEx 18 | EzARBgNVBAcTCkJsYWNrc2J1cmcxHTAbBgNVBAoTFERpZ2l0YWwgQmF6YWFyLCBJ 19 | bmMuMScwJQYDVQQLEx5UZXN0IEJpdG11bmsgTmV0d29yayBBdXRob3JpdHkxEjAQ 20 | BgNVBAMTCWJpdG11bmstMYIBADAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUA 21 | A4IBAQBWzU0fp/pvT7REa3u7UO/SH1XvlB2xswm/JHPkjF+l9C2Bu7uzX71XcyYE 22 | mHcYufKhMxGh1BEkXlJeZBMWVv+7djHmPrOn25ig+g2to1nTGzaFUbygJVxZHvU0 23 | EKmoKMeOPRpMyejerZjx9q9uorVaeX10cIFvlVw7Kaa8O6LguxdE0xRPQLA8BMhf 24 | 99kAxkj9CiN/WQ2Do/8zrqs8ernTaJlFHrBKGyhXavDxGcYM6keRNiXrwvqro5/4 25 | AIZiyUGqCPQwjbkpdTnfv/STK8kxcDoEj3A7wX9Q8udg2kfwqLeAWMQxODlVStB/ 26 | k3pTlRDZu3tgvePFHYEYDip6lkzD 27 | -----END CERTIFICATE----- 28 | -------------------------------------------------------------------------------- /pki/test-payswarm-auth.key: -------------------------------------------------------------------------------- 1 | -----BEGIN PRIVATE KEY----- 2 | MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDsNQTe1VPBnXDh 3 | UbYkaQLm3cbhxrgwHTTWNnUSz7z4GDvPr3OAQuRRr+WzHr5jONyJH8d/xlfiic9W 4 | MMq3o9lmh1dqMcq2qgOuutdtbbTET6VettergS+2h8g/BC5/9u6wEAaazHE35H1d 5 | bI1uWSE7DFX9B3DLzOldSqrR69uwe0jtD5mq8+MHuW+3neLgiWkHnKl63pHAPvPr 6 | wmVuHLBmG6/1x/LJ8uuoAY5plqLSszdSH7P/7uK5njgfS94Z+N7XVbNWItvlpz6+ 7 | hV7aAuj23uEsAmN758RKRfdf2794+8oD8Io6ZTDBUq9o9ee4144WNkW6QhZjtdDz 8 | MxuC+JgpAgMBAAECggEAcMoIX1dCPUuuoQjhjpVOO2tfEmRPgzoPBtLOKINl2pnH 9 | xa4j2vUWDSOO7W8avkpilF/GZW8SfCwOAzwdMH9eyiSKSz0nbP3V8FNrlucx0COv 10 | 9YAdj9mKLQC9T8nxYk1JQG0GmlhRH71NV5UEG9MXmRiU3tP0unxIWrHSy5ZyOtxY 11 | 5uDDR41jG0wnfoFR4W00AoDh+5foScWI82phlTdgtdeOoFznkkQfU1uu0Xz6gfH9 12 | gvkAD7Ezi5upW06E7gve/7FiSfIkBO0C1ApqdM47Ej6CSYcMBslCpEvz3WukyO9i 13 | dfMVwjGPDUy4U1e+rlX3ZA2C+UGdTCCKnUvuxemEWQKBgQD3tTaNb7WI/qCD+kbH 14 | TH6+UOZcIBQBhfJS6iChmH4w75uu0u7YviDajTBDkbpl8ShAJakwjeRTzwc77AXf 15 | Zd/IezFo1Z+Glz26mgpEO2Na3Z16mnxDeh9la1dbSP1BeOy9JCbspra47KHfzgRj 16 | 2cxplapYY4PEDXtAQRdWhhQGVwKBgQD0HT9mkvcxRlesz1jWvdn3Ad35OQG7yIKh 17 | bIo2oFLYbIBT7FqASuk0XewGVIyCyKuLbcm/5MEFn/lSsVod8sUyNbkcSark8mPC 18 | VpnG12xDs5NU/xlHeJGyad1Qmt+WMYAPdvNBruloDUTMh2Q4vbYAmyRi85dYZHsB 19 | Rt/OVMxFfwKBgFeb3PZ7Gv6f6A+lliDo+i6/mCnfIpRDVqhirDXbJE6UgEB91AIO 20 | hLonk3lickWZ3H2LlGJa3PWTVGCqIo2Xj2VtxNTqMSi+FxQHZTgqtQIvPYJeXzLS 21 | X4ZUR6o+j2v3o+tlfOrYL+oJr1rjl4PlRTnWuE/YqoLNrdjU7LcqZqyzAoGAC0OO 22 | OV1uqodkZETtBHueIxei9mz69385B9nKRtr+952KDlVJl8HdIN10lpYwJZi80aIv 23 | PPuBLJFFH9uvHNKm5roz4GpFyGqmz8DPN62ZAUa39aQPtoyJrIHWBHIg/v0pu4zx 24 | jIZVnsd99TIKHdQjIcQG2coDocCBLH3otcyT4GECgYB2LyBZgL9HF5XdbkqGI8t4 25 | NUi7InDfC5xvjD8mCI180sl95zz6jgG3Z6B56p4YkjmF3Cc7ji8f5Y2HHZBKiKp9 26 | 5gNAqa5wwE3dlInhi9IWoe2xSJXqq2TXe7WCyl5P25DgQ//qYye6PLcly/SXy4U9 27 | YdLWowtQZT9fdpU9k9e42A== 28 | -----END PRIVATE KEY----- 29 | -------------------------------------------------------------------------------- /protractor.conf.js: -------------------------------------------------------------------------------- 1 | // ensure local helper is loaded 2 | require(__dirname + '/tests/frontend/helper'); 3 | 4 | var config = require( 5 | __dirname + '/node_modules/bedrock/protractor.conf').config; 6 | exports.config = config; 7 | 8 | var bedrockSuites = config.suites; 9 | config.suites = { 10 | unit: bedrockSuites.unit, 11 | e2e: [bedrockSuites.e2e, __dirname + '/tests/frontend/e2e/**/*js'] 12 | }; 13 | -------------------------------------------------------------------------------- /schemas/allowBudget.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var tools = bedrock.tools; 3 | 4 | var schema = { 5 | required: false, 6 | title: 'Allow Budget', 7 | description: 'A flag to indicate whether a budget can be used in a purchase.', 8 | type: 'boolean', 9 | errors: { 10 | invalid: 'Please enter a valid preference (true/false) for allowing a budget.' 11 | } 12 | }; 13 | 14 | module.exports = function(extend) { 15 | if(extend) { 16 | return tools.extend(true, tools.clone(schema), extend); 17 | } 18 | return schema; 19 | }; 20 | -------------------------------------------------------------------------------- /schemas/asset.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var payee = require('./payee'); 6 | var payeeRule = require('./payeeRule'); 7 | var vendor = require('./vendor'); 8 | 9 | var schema = { 10 | required: true, 11 | title: 'Asset', 12 | description: 'PaySwarm Asset.', 13 | type: 'object', 14 | properties: { 15 | '@context': schemas.jsonldContext(), 16 | // allow up to 4 additional custom types 17 | type: schemas.jsonldType('Asset', 4), 18 | creator: { 19 | required: false, 20 | type: [schemas.url(), {type: 'object'}] 21 | }, 22 | created: schemas.w3cDateTime(), 23 | title: schemas.title({required: false}), 24 | assetContent: schemas.url({required: false}), 25 | assetProvider: schemas.url(), 26 | listingRestrictions: { 27 | title: 'Listing Restrictions', 28 | description: 'Restrictions on the listing of this Asset for sale.', 29 | required: false, 30 | type: 'object', 31 | properties: { 32 | payee: payee({required: false}), 33 | payeeRule: payeeRule({required: false}), 34 | vendor: vendor({required: false}), 35 | validFrom: schemas.w3cDateTime({required: false}), 36 | validUntil: schemas.w3cDateTime({required: false}) 37 | } 38 | }, 39 | // FIXME: is sysPublished desirable? 40 | sysPublished: schemas.w3cDateTime({required: false})//, 41 | // Meritora custom asset properties 42 | // FIXME: need semantic type-based validation 43 | // FIXME: this is currently a hack to allow these to pass through 44 | // 45 | }, 46 | additionalProperties: false 47 | }; 48 | 49 | module.exports = function(extend) { 50 | if(extend) { 51 | return tools.extend(true, tools.clone(schema), extend); 52 | } 53 | return schema; 54 | }; 55 | -------------------------------------------------------------------------------- /schemas/bankAccount.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var address = require('./address'); 6 | 7 | var schema = { 8 | required: true, 9 | title: 'BankAccount', 10 | description: 'A bank account.', 11 | type: 'object', 12 | properties: { 13 | '@context': schemas.jsonldContext(), 14 | type: schemas.jsonldType('BankAccount'), 15 | bankAccount: { 16 | required: true, 17 | type: 'string', 18 | pattern: '^[0-9]+$', 19 | minLength: 5, 20 | maxLength: 30, 21 | errors: { 22 | invalid: 'The bank account number is invalid.', 23 | missing: 'Please enter a bank account number.', 24 | mask: true 25 | } 26 | }, 27 | bankAccountType: { 28 | required: true, 29 | type: 'string', 30 | enum: ['Checking', 'Savings'] 31 | }, 32 | bankRoutingNumber: { 33 | required: true, 34 | type: 'string', 35 | pattern: '^[0-9]+$', 36 | minLength: 9, 37 | maxLength: 9, 38 | errors: { 39 | invalid: 'The bank routing number in invalid.', 40 | missing: 'Please enter a bank account routing number.', 41 | mask: true 42 | } 43 | }, 44 | address: address() 45 | }, 46 | additionalProperties: false 47 | }; 48 | 49 | module.exports = function(extend) { 50 | if(extend) { 51 | return tools.extend(true, tools.clone(schema), extend); 52 | } 53 | return schema; 54 | }; 55 | -------------------------------------------------------------------------------- /schemas/currency.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var tools = bedrock.tools; 3 | 4 | var schema = { 5 | required: true, 6 | title: 'Currency', 7 | description: 'A currency code or identifier.', 8 | type: 'string', 9 | enum: ['USD'], 10 | errors: { 11 | invalid: 'Please enter a valid currency.', 12 | missing: 'Please enter a currency.' 13 | } 14 | }; 15 | 16 | module.exports = function(extend) { 17 | if(extend) { 18 | return tools.extend(true, tools.clone(schema), extend); 19 | } 20 | return schema; 21 | }; 22 | -------------------------------------------------------------------------------- /schemas/deposit.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var currency = require('./currency'); 6 | var depositAmount = require('./depositAmount'); 7 | var ipv4Address = require('./ipv4Address'); 8 | var payee = require('./payee'); 9 | var paymentToken = require('./paymentToken'); 10 | var transfer = require('./transfer'); 11 | 12 | var unsignedDeposit = { 13 | required: true, 14 | title: 'Unsigned Deposit', 15 | description: 'A Deposit that has not been digitally-signed.', 16 | type: 'object', 17 | properties: { 18 | '@context': schemas.jsonldContext(), 19 | type: schemas.jsonldType(['Transaction', 'Deposit']), 20 | payee: payee(), 21 | source: schemas.url() 22 | }, 23 | additionalProperties: false 24 | }; 25 | 26 | var signedDeposit = { 27 | required: true, 28 | title: 'Signed Deposit', 29 | description: 'A digitally-signed Deposit.', 30 | type: 'object', 31 | properties: { 32 | '@context': schemas.jsonldContext(), 33 | id: schemas.url(), 34 | type: schemas.jsonldType(['Transaction', 'Deposit']), 35 | payee: payee(), 36 | source: paymentToken(), 37 | transfer: { 38 | required: true, 39 | type: 'array', 40 | items: transfer() 41 | }, 42 | created: schemas.w3cDateTime(), 43 | currency: currency(), 44 | amount: depositAmount(), 45 | ipv4Address: ipv4Address(), 46 | signature: schemas.graphSignature() 47 | }, 48 | additionalProperties: false 49 | }; 50 | 51 | var deposit = { 52 | required: true, 53 | title: 'Deposit', 54 | description: 'A Deposit.', 55 | type: [unsignedDeposit, signedDeposit] 56 | }; 57 | 58 | module.exports = function(type, extend) { 59 | var schema = deposit; 60 | if(type === 'unsigned') { 61 | schema = unsignedDeposit; 62 | } else if(type === 'signed') { 63 | schema = signedDeposit; 64 | } 65 | 66 | if(extend) { 67 | return tools.extend(true, tools.clone(schema), extend); 68 | } 69 | return schema; 70 | }; 71 | -------------------------------------------------------------------------------- /schemas/depositAmount.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var tools = bedrock.tools; 3 | 4 | var schema = { 5 | required: true, 6 | title: 'Deposit Amount', 7 | description: 'An amount to be deposited.', 8 | type: 'string', 9 | pattern: '^([0-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,10})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,10})?)$', 10 | errors: { 11 | invalid: 'The deposit amount is invalid.', 12 | missing: 'Please deposit a minimum of USD $1.00.' 13 | } 14 | }; 15 | 16 | module.exports = function(extend) { 17 | if(extend) { 18 | return tools.extend(true, tools.clone(schema), extend); 19 | } 20 | return schema; 21 | }; 22 | -------------------------------------------------------------------------------- /schemas/invoice.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var asset = require('./asset'); 6 | var currency = require('./currency'); 7 | var money = require('./money'); 8 | 9 | var invoiceItem = { 10 | required: true, 11 | title: 'Invoice Item', 12 | description: 'An item that is part of an Invoice.', 13 | type: 'object', 14 | properties: { 15 | type: schemas.jsonldType('InvoiceItem'), 16 | title: schemas.title(), 17 | // allow negative values for discounts, etc 18 | amount: money.precise(), 19 | currency: currency(), 20 | comment: schemas.comment({ 21 | minLength: 0 22 | }) 23 | }, 24 | additionalProperties: false 25 | }; 26 | 27 | var schema = { 28 | required: true, 29 | title: 'Invoice', 30 | description: 'An invoice asset.', 31 | type: asset({ 32 | properties: { 33 | type: schemas.jsonldType('Invoice', 4), 34 | invoiceItem: { 35 | required: true, 36 | type: 'array', 37 | items: invoiceItem, 38 | minItems: 1 39 | } 40 | } 41 | }), 42 | additionalProperties: false 43 | }; 44 | 45 | module.exports = function(extend) { 46 | if(extend) { 47 | return tools.extend(true, tools.clone(schema), extend); 48 | } 49 | return schema; 50 | }; 51 | -------------------------------------------------------------------------------- /schemas/ipv4Address.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var tools = bedrock.tools; 3 | 4 | var schema = { 5 | required: true, 6 | title: 'IPv4 Address', 7 | description: 'A numeric IPv4 address in dot-notation.', 8 | type: 'string', 9 | pattern: '^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$', 10 | errors: { 11 | invalid: 'The IPv4 address must be of the in numeric dot-notation, for example: "nnn.nnn.nnn.nnn".', 12 | missing: 'The IPv4 address of the requesting client is missing.' 13 | } 14 | }; 15 | 16 | module.exports = function(extend) { 17 | if(extend) { 18 | return tools.extend(true, tools.clone(schema), extend); 19 | } 20 | return schema; 21 | }; 22 | -------------------------------------------------------------------------------- /schemas/payeeRule.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var money = require('./money'); 6 | 7 | var schema = { 8 | required: true, 9 | title: 'PayeeRule', 10 | description: 'A Payee rule.', 11 | type: 'array', 12 | items: { 13 | type: 'object', 14 | properties: { 15 | id: schemas.url({required: false}), 16 | type: schemas.jsonldType('PayeeRule'), 17 | payeeGroupPrefix: { 18 | required: false, 19 | type: 'array', 20 | items: { 21 | type: 'string' 22 | } 23 | }, 24 | maximumPayeeRate: money.precisePositive({required: false}), 25 | minimumPayeeRate: money.precisePositive({required: false}), 26 | payeeGroup: { 27 | required: false, 28 | type: [{ 29 | type: 'string' 30 | }, { 31 | type: 'array', 32 | uniqueItems: true, 33 | items: { 34 | type: 'string' 35 | } 36 | }] 37 | }, 38 | payeeRateType: { 39 | required: false, 40 | type: 'string', 41 | enum: ['FlatAmount', 'Percentage'] 42 | }, 43 | payeeApplyType: { 44 | required: false, 45 | type: 'string', 46 | enum: ['ApplyExclusively', 'ApplyInclusively'] 47 | } 48 | }, 49 | additionalProperties: false 50 | } 51 | }; 52 | 53 | module.exports = function(extend) { 54 | if(extend) { 55 | return tools.extend(true, tools.clone(schema), extend); 56 | } 57 | return schema; 58 | }; 59 | -------------------------------------------------------------------------------- /schemas/paymentToken.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var schema = { 6 | required: true, 7 | title: 'Payment Token', 8 | description: 'A tokenized source of monetary funds.', 9 | type: [{ 10 | type: 'object', 11 | properties: { 12 | id: schemas.url(), 13 | type: schemas.jsonldType('PaymentToken'), 14 | owner: schemas.url(), 15 | paymentToken: { 16 | required: true, 17 | type: 'string' 18 | }, 19 | paymentGateway: { 20 | required: true, 21 | type: 'string', 22 | minLength: 1, 23 | errorMessage: 'Gateway too short; 1 character minimum.' 24 | }, 25 | paymentMethod: { 26 | required: true, 27 | type: 'string', 28 | enum: ['CreditCard', 'BankAccount'] 29 | } 30 | } 31 | }], 32 | additionalProperties: false 33 | }; 34 | 35 | module.exports = function(extend) { 36 | if(extend) { 37 | return tools.extend(true, tools.clone(schema), extend); 38 | } 39 | return schema; 40 | }; 41 | -------------------------------------------------------------------------------- /schemas/promo.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var currency = require('./currency'); 6 | var money = require('./money'); 7 | 8 | var schema = { 9 | required: true, 10 | title: 'Promotion', 11 | description: 'A promotion description.', 12 | type: 'object', 13 | properties: { 14 | promoCode: { 15 | title: 'Promotional Code', 16 | description: 'The promotional code.', 17 | required: true, 18 | type: 'string', 19 | minLength: 1, 20 | maxLength: 50, 21 | errors: { 22 | invalid: 'The promo code is invalid.', 23 | missing: 'Please enter a promo code.' 24 | } 25 | }, 26 | expires: schemas.w3cDateTime(), 27 | redeemable: { 28 | title: 'Redeemable', 29 | description: 'The number of times the promotional code can be redeemed.', 30 | required: true, 31 | type: 'integer', 32 | minimum: 1 33 | }, 34 | deposit: { 35 | title: 'Promotional Deposits', 36 | description: 'The amounts and comments for deposits that occur when the promotional code is redeemed', 37 | required: true, 38 | type: 'array', 39 | items: { 40 | type: 'object', 41 | properties: { 42 | amount: money.precisePositive(), 43 | currency: currency(), 44 | comment: { 45 | title: 'Deposit Comment', 46 | description: 'The comment that will appear in the deposit when the promotional code is redeemed.', 47 | required: false, 48 | type: 'string' 49 | } 50 | } 51 | } 52 | }, 53 | email: schemas.email({required: false}), 54 | description: { 55 | title: 'Promotion Description', 56 | description: 'A description of the Promotion', 57 | required: false, 58 | type: 'string' 59 | } 60 | } 61 | }; 62 | 63 | module.exports = function(extend) { 64 | if(extend) { 65 | return tools.extend(true, tools.clone(schema), extend); 66 | } 67 | return schema; 68 | }; 69 | -------------------------------------------------------------------------------- /schemas/receipt.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var schema = { 6 | required: true, 7 | title: 'Receipt', 8 | description: 'A financial Receipt.', 9 | type: 'object', 10 | properties: { 11 | '@context': schemas.jsonldContext(), 12 | type: schemas.jsonldType('Receipt'), 13 | preferences: { 14 | required: false, 15 | title: 'Purchase Preferences', 16 | type: 'array', 17 | items: { 18 | type: 'string', 19 | enum: ['PreAuthorization'] 20 | } 21 | }, 22 | contract: { 23 | required: true, 24 | title: 'Contract in Receipt', 25 | description: 'The short-form Contract that appears in a Receipt.', 26 | type: 'object', 27 | properties: { 28 | type: schemas.jsonldType(['Transaction', 'Contract']), 29 | id: schemas.url(), 30 | asset: { 31 | required: true, 32 | type: [schemas.url(), { 33 | required: true, 34 | type: 'object', 35 | properties: { 36 | id: schemas.url(), 37 | type: schemas.jsonldType('Asset'), 38 | assetContent: schemas.url() 39 | }, 40 | additionalProperties: false 41 | }] 42 | }, 43 | license: schemas.url(), 44 | listing: schemas.url(), 45 | assetProvider: schemas.url(), 46 | assetAcquirer: schemas.url(), 47 | vendor: schemas.url() 48 | }, 49 | additionalProperties: false 50 | }, 51 | signature: schemas.graphSignature() 52 | }, 53 | additionalProperties: false 54 | }; 55 | 56 | module.exports = function(extend) { 57 | if(extend) { 58 | return tools.extend(true, tools.clone(schema), extend); 59 | } 60 | return schema; 61 | }; 62 | -------------------------------------------------------------------------------- /schemas/referenceId.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var tools = bedrock.tools; 3 | 4 | var schema = { 5 | title: 'PaySwarm Transaction Reference ID', 6 | required: true, 7 | type: 'string', 8 | // do not start with 'payswarm', 1-128 chars in length 9 | pattern: "^(?!payswarm).{1,128}$" 10 | }; 11 | 12 | module.exports = function(extend) { 13 | if(extend) { 14 | return tools.extend(true, tools.clone(schema), extend); 15 | } 16 | return schema; 17 | }; 18 | -------------------------------------------------------------------------------- /schemas/refreshInterval.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var tools = bedrock.tools; 3 | 4 | var schema = { 5 | required: true, 6 | title: 'Refresh interval', 7 | description: 'The interval on which a budget refills to its original amount.', 8 | type: 'string', 9 | pattern: '^([2-9][0-9]{3}-(0[1-9]|1[0-2])-([0-2][0-9]|3[0-1])T([0-1][0-9]|2[0-3]):([0-5][0-9]):(([0-5][0-9])|60)(\\.[0-9]+)?(Z|((\\+|-)([0-1][0-9]|2[0-3]):([0-5][0-9])))?)|(R(\\d+)?\\/[2-9][0-9]{3}-(0[1-9]|1[0-2])-([0-2][0-9]|3[0-1])T([0-1][0-9]|2[0-3]):([0-5][0-9]):(([0-5][0-9])|60)(\\.[0-9]+)?(Z|((\\+|-)([0-1][0-9]|2[0-3]):([0-5][0-9])))?\\/P((\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?)?(T(\\d+H)?(\\d+M)?(\\d+S)?)?)$', 10 | errors: { 11 | invalid: 'Please enter a valid refresh interval.', 12 | missing: 'Please enter a refresh interval.' 13 | } 14 | }; 15 | 16 | module.exports = function(extend) { 17 | if(extend) { 18 | return tools.extend(true, tools.clone(schema), extend); 19 | } 20 | return schema; 21 | }; 22 | -------------------------------------------------------------------------------- /schemas/regulatoryAddress.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var tools = bedrock.tools; 3 | 4 | var address = require('./address'); 5 | 6 | var schema = address({ 7 | title: 'Regulatory Address', 8 | description: 'An address to identify applicable regulations.', 9 | properties: { 10 | addressLocality: { 11 | required: false 12 | } 13 | } 14 | }); 15 | delete schema.properties.label; 16 | delete schema.properties.name; 17 | delete schema.properties.streetAddress; 18 | delete schema.properties.postalCode; 19 | 20 | module.exports = function(extend) { 21 | if(extend) { 22 | return tools.extend(true, tools.clone(schema), extend); 23 | } 24 | return schema; 25 | }; 26 | -------------------------------------------------------------------------------- /schemas/resourceHash.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var tools = bedrock.tools; 3 | 4 | var schema = { 5 | title: 'PaySwarm Resource Hash', 6 | required: true, 7 | type: 'string', 8 | pattern: "^urn:sha256:[a-f0-9]{64}$" 9 | }; 10 | 11 | module.exports = function(extend) { 12 | if(extend) { 13 | return tools.extend(true, tools.clone(schema), extend); 14 | } 15 | return schema; 16 | }; 17 | -------------------------------------------------------------------------------- /schemas/resources.asset.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var payee = require('./payee'); 6 | var payeeRule = require('./payeeRule'); 7 | var vendor = require('./vendor'); 8 | 9 | var schema = { 10 | required: true, 11 | title: 'Asset', 12 | description: 'An Asset.', 13 | type: 'object', 14 | properties: { 15 | '@context': schemas.jsonldContext(), 16 | id: schemas.url(), 17 | // allow up to 4 additional custom types 18 | type: schemas.jsonldType('Asset', 4), 19 | creator: { 20 | required: false, 21 | type: [schemas.url(), {type: 'object'}] 22 | }, 23 | title: schemas.title({required: false}), 24 | assetContent: schemas.url({required: false}), 25 | assetProvider: schemas.url(), 26 | listingRestrictions: { 27 | required: false, 28 | title: 'Listing Restrictions', 29 | description: 'Restrictions on the listing of this Asset for sale.', 30 | type: 'object', 31 | properties: { 32 | payee: payee({required: false}), 33 | payeeRule: payeeRule({required: false}), 34 | vendor: vendor({required: false}), 35 | validFrom: schemas.w3cDateTime({required: false}), 36 | validUntil: schemas.w3cDateTime({required: false}) 37 | } 38 | }, 39 | signature: schemas.graphSignature() 40 | } 41 | }; 42 | 43 | module.exports = function(extend) { 44 | if(extend) { 45 | return tools.extend(true, tools.clone(schema), extend); 46 | } 47 | return schema; 48 | }; 49 | -------------------------------------------------------------------------------- /schemas/resources.license.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var schema = { 6 | required: true, 7 | title: 'License', 8 | description: 'A License.', 9 | type: 'object', 10 | properties: { 11 | '@context': schemas.jsonldContext(), 12 | id: schemas.url(), 13 | type: schemas.jsonldType('License'), 14 | licenseTemplate: { 15 | required: true, 16 | type: 'string' 17 | } 18 | } 19 | }; 20 | 21 | module.exports = function(extend) { 22 | if(extend) { 23 | return tools.extend(true, tools.clone(schema), extend); 24 | } 25 | return schema; 26 | }; 27 | -------------------------------------------------------------------------------- /schemas/resources.listing.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var payee = require('./payee'); 6 | var payeeRule = require('./payeeRule'); 7 | var vendor = require('./vendor'); 8 | 9 | var schema = { 10 | required: true, 11 | title: 'Listing', 12 | description: 'A Listing.', 13 | type: 'object', 14 | properties: { 15 | '@context': schemas.jsonldContext(), 16 | id: schemas.url(), 17 | // allow up to 4 additional custom types 18 | type: schemas.jsonldType('Listing', 4), 19 | vendor: vendor(), 20 | payee: payee(), 21 | payeeRule: payeeRule({required: false}), 22 | asset: schemas.url(), 23 | assetHash: { 24 | required: true, 25 | type: 'string' 26 | }, 27 | license: schemas.url(), 28 | licenseHash: { 29 | required: true, 30 | type: 'string' 31 | }, 32 | validFrom: schemas.w3cDateTime(), 33 | validUntil: schemas.w3cDateTime(), 34 | signature: schemas.graphSignature() 35 | }, 36 | additionalProperties: false 37 | }; 38 | 39 | module.exports = function(extend) { 40 | if(extend) { 41 | return tools.extend(true, tools.clone(schema), extend); 42 | } 43 | return schema; 44 | }; 45 | -------------------------------------------------------------------------------- /schemas/services.address.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.module('validation').schemas; 3 | 4 | var address = require('./address'); 5 | var validatedAddress = require('./validatedAddress'); 6 | 7 | var postAddress = { 8 | type: 'object', 9 | properties: { 10 | '@context': schemas.jsonldContext(), 11 | id: schemas.identifier(), 12 | label: schemas.label({required: false}) 13 | }, 14 | additionalProperties: false 15 | }; 16 | 17 | var postAddressesQuery = { 18 | type: 'object', 19 | properties: { 20 | action: { 21 | required: false, 22 | type: 'string', 23 | enum: ['validate'] 24 | } 25 | }, 26 | additionalProperties: true 27 | }; 28 | 29 | var postAddresses = { 30 | type: [address(), validatedAddress()] 31 | }; 32 | 33 | var validateAddress = { 34 | type: [address(), validatedAddress()] 35 | }; 36 | 37 | module.exports.postAddress = function() { 38 | return postAddress; 39 | }; 40 | module.exports.postAddressesQuery = function() { 41 | return postAddressesQuery; 42 | }; 43 | module.exports.postAddresses = function() { 44 | return postAddresses; 45 | }; 46 | module.exports.validateAddress = function() { 47 | return validateAddress; 48 | }; 49 | -------------------------------------------------------------------------------- /schemas/services.identityPreferences.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | 4 | var postPreferences = { 5 | title: 'Post Preferences', 6 | type: 'object', 7 | properties: { 8 | '@context': schemas.jsonldContext(), 9 | type: schemas.jsonldType('IdentityPreferences'), 10 | destination: schemas.url({required: false}), 11 | source: schemas.url({required: false}), 12 | publicKey: { 13 | required: false, 14 | type: [{ 15 | // IRI only 16 | type: 'string' 17 | }, { 18 | // label+pem 19 | type: 'object', 20 | properties: { 21 | label: schemas.label(), 22 | publicKeyPem: schemas.publicKeyPem() 23 | } 24 | }] 25 | } 26 | }, 27 | additionalProperties: false 28 | }; 29 | 30 | module.exports.postPreferences = function() { 31 | return postPreferences; 32 | }; 33 | -------------------------------------------------------------------------------- /schemas/services.license.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | 4 | var cacheLicense = { 5 | title: 'Cache License', 6 | type: 'object', 7 | properties: { 8 | '@context': schemas.jsonldContext(), 9 | license: schemas.url(), 10 | licenseHash: { 11 | required: false, 12 | type: 'string' 13 | }, 14 | signature: schemas.graphSignature({required: false}) 15 | }, 16 | additionalProperties: false 17 | }; 18 | 19 | module.exports.cacheLicense = function() { 20 | return cacheLicense; 21 | }; 22 | -------------------------------------------------------------------------------- /schemas/services.payswarm.identifier.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | 4 | var postFinancialAccountIdentifier = { 5 | type: 'object', 6 | properties: { 7 | owner: schemas.url(), 8 | sysSlug: schemas.slug() 9 | }, 10 | additionalProperties: false 11 | }; 12 | 13 | module.exports.postFinancialAccountIdentifier = function() { 14 | return postFinancialAccountIdentifier; 15 | }; 16 | -------------------------------------------------------------------------------- /schemas/services.promo.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | 4 | var postPromosQuery = { 5 | title: 'Post Promotions Query', 6 | type: 'object', 7 | properties: { 8 | action: { 9 | required: false, 10 | type: 'string', 11 | enum: ['redeem'] 12 | } 13 | }, 14 | additionalProperties: false 15 | }; 16 | 17 | var redeemCode = { 18 | title: 'Redeem Promotional Code', 19 | type: 'object', 20 | properties: { 21 | promoCode: { 22 | required: true, 23 | type: 'string' 24 | }, 25 | account: schemas.url() 26 | }, 27 | additionalProperties: false 28 | }; 29 | 30 | module.exports.postPromosQuery = function() { 31 | return postPromosQuery; 32 | }; 33 | module.exports.redeemCode = function() { 34 | return redeemCode; 35 | }; 36 | -------------------------------------------------------------------------------- /schemas/services.test.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | 4 | var postProfileCreate = { 5 | title: 'Create test profile', 6 | description: 'Create a test profile.', 7 | type: 'object', 8 | properties: { 9 | '@context': schemas.jsonldContext(), 10 | sysSlug: schemas.slug({required: false}), 11 | email: schemas.email(), 12 | sysPassword: schemas.password(), 13 | label: schemas.label({required: false}), 14 | sysPublicKey: { 15 | required: false, 16 | type: 'object', 17 | properties: { 18 | label: schemas.label(), 19 | publicKeyPem: schemas.publicKeyPem() 20 | } 21 | }, 22 | sysIdentity: { 23 | required: true, 24 | type: 'object', 25 | properties: { 26 | type: { 27 | required: true, 28 | type: 'string', 29 | enum: ['PersonalIdentity', 'VendorIdentity'] 30 | }, 31 | sysSlug: schemas.slug(), 32 | label: schemas.label() 33 | } 34 | }, 35 | account: { 36 | required: true, 37 | type: 'object', 38 | properties: { 39 | sysSlug: schemas.slug(), 40 | label: schemas.label() 41 | } 42 | } 43 | }, 44 | additionalProperties: false 45 | }; 46 | 47 | var postIdsCreateQuery = { 48 | title: 'Create test ids', 49 | description: 'Create test ids.', 50 | type: 'object', 51 | properties: { 52 | generator: { 53 | required: false, 54 | type: 'string' 55 | }, 56 | count: { 57 | required: false, 58 | type: 'string' 59 | }, 60 | wait: { 61 | required: false, 62 | type: 'string' 63 | }, 64 | concurrency: { 65 | required: false, 66 | type: 'string' 67 | } 68 | }, 69 | additionalProperties: false 70 | }; 71 | 72 | module.exports.postProfileCreate = function() { 73 | return postProfileCreate; 74 | }; 75 | module.exports.postIdsCreateQuery = function() { 76 | return postIdsCreateQuery; 77 | }; 78 | -------------------------------------------------------------------------------- /schemas/services.vendor.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | 4 | var getRegisterQuery = { 5 | title: 'Get Vendor Register Query', 6 | type: 'object', 7 | properties: { 8 | 'public-key': schemas.publicKeyPem({required: false}), 9 | 'public-key-label': schemas.label({required: false}), 10 | 'registration-callback': schemas.url({required: false}), 11 | 'response-nonce': schemas.nonce({required: false}) 12 | }, 13 | additionalProperties: true 14 | }; 15 | 16 | module.exports.getRegisterQuery = function() { 17 | return getRegisterQuery; 18 | }; 19 | -------------------------------------------------------------------------------- /schemas/transaction.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var transfer = require('./transfer'); 6 | var depositAmount = require('./depositAmount'); 7 | 8 | var schema = { 9 | required: true, 10 | title: 'Transaction', 11 | description: 'A financial Transaction.', 12 | type: 'object', 13 | properties: { 14 | type: schemas.jsonldType('Transaction'), 15 | created: schemas.w3cDateTime(), 16 | // FIXME: seems incorrect to use deposit amount here 17 | amount: depositAmount(), 18 | transfer: { 19 | type: 'array', 20 | items: transfer() 21 | } 22 | }, 23 | additionalProperties: false 24 | }; 25 | 26 | module.exports.schema = function(extend) { 27 | if(extend) { 28 | return tools.extend(true, tools.clone(schema), extend); 29 | } 30 | return schema; 31 | }; 32 | -------------------------------------------------------------------------------- /schemas/transfer.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var currency = require('./currency'); 6 | var money = require('./money'); 7 | 8 | var schema = { 9 | required: true, 10 | title: 'Transfer', 11 | description: 'A financial Transfer.', 12 | type: 'object', 13 | properties: { 14 | type: schemas.jsonldType('Transfer'), 15 | source: schemas.url(), 16 | destination: schemas.url(), 17 | amount: money.precisePositive(), 18 | currency: currency(), 19 | comment: schemas.comment() 20 | }, 21 | additionalProperties: false 22 | }; 23 | 24 | module.exports = function(extend) { 25 | if(extend) { 26 | return tools.extend(true, tools.clone(schema), extend); 27 | } 28 | return schema; 29 | }; 30 | -------------------------------------------------------------------------------- /schemas/validatedAddress.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var tools = bedrock.tools; 3 | 4 | var address = require('./address'); 5 | 6 | var schema = address({ 7 | properties: { 8 | sysValidated: { 9 | required: false, 10 | type: 'boolean' 11 | }, 12 | sysAddressHash: { 13 | required: false, 14 | type: 'string' 15 | } 16 | } 17 | }); 18 | 19 | module.exports = function(extend) { 20 | if(extend) { 21 | return tools.extend(true, tools.clone(schema), extend); 22 | } 23 | return schema; 24 | }; 25 | -------------------------------------------------------------------------------- /schemas/validityInterval.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var tools = bedrock.tools; 3 | 4 | var schema = { 5 | required: true, 6 | title: 'Validity interval', 7 | description: 'The interval during which a budget is valid.', 8 | type: 'string', 9 | pattern: '^([2-9][0-9]{3}-(0[1-9]|1[0-2])-([0-2][0-9]|3[0-1])T([0-1][0-9]|2[0-3]):([0-5][0-9]):(([0-5][0-9])|60)(\\.[0-9]+)?(Z|((\\+|-)([0-1][0-9]|2[0-3]):([0-5][0-9])))?)|(R(\\d+)?\\/[2-9][0-9]{3}-(0[1-9]|1[0-2])-([0-2][0-9]|3[0-1])T([0-1][0-9]|2[0-3]):([0-5][0-9]):(([0-5][0-9])|60)(\\.[0-9]+)?(Z|((\\+|-)([0-1][0-9]|2[0-3]):([0-5][0-9])))?\\/P((\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?)?(T(\\d+H)?(\\d+M)?(\\d+S)?)?)$', 10 | errors: { 11 | invalid: 'Please enter a valid validity interval.', 12 | missing: 'Please enter a validity interval.' 13 | } 14 | }; 15 | 16 | module.exports = function(extend) { 17 | if(extend) { 18 | return tools.extend(true, tools.clone(schema), extend); 19 | } 20 | return schema; 21 | }; 22 | -------------------------------------------------------------------------------- /schemas/vendor.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var schemas = bedrock.validation.schemas; 3 | var tools = bedrock.tools; 4 | 5 | var schema = { 6 | required: true, 7 | title: 'Vendor', 8 | description: 'A vendor for a Listing or a permitted vendor for a particular Asset.', 9 | type: [ 10 | schemas.url(), 11 | { 12 | type: 'array', 13 | uniqueItems: true, 14 | items: schemas.url(), 15 | errors: { 16 | invalid: 'The vendor is invalid.', 17 | missing: 'The vendor is missing.' 18 | } 19 | } 20 | ] 21 | }; 22 | 23 | module.exports = function(extend) { 24 | if(extend) { 25 | return tools.extend(true, tools.clone(schema), extend); 26 | } 27 | return schema; 28 | }; 29 | -------------------------------------------------------------------------------- /schemas/withdrawalAmount.js: -------------------------------------------------------------------------------- 1 | var bedrock = require('bedrock'); 2 | var tools = bedrock.tools; 3 | 4 | var schema = { 5 | required: true, 6 | title: 'Withdrawal Amount', 7 | description: 'An amount to be withdrawn.', 8 | type: 'string', 9 | pattern: '^([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,10})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,10})?)$', 10 | errors: { 11 | invalid: 'The withdrawal amount is invalid.', 12 | missing: 'Please withdraw a minimum of USD $1.00.' 13 | } 14 | }; 15 | 16 | module.exports = function(extend) { 17 | if(extend) { 18 | return tools.extend(true, tools.clone(schema), extend); 19 | } 20 | return schema; 21 | }; 22 | -------------------------------------------------------------------------------- /site/img-src/cc-logos.xcf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/digitalbazaar/p3/8709631dc6eb9e2824e5ea8f0aa637cce4b39206/site/img-src/cc-logos.xcf -------------------------------------------------------------------------------- /site/static/app/bootstrap.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstraps the Main App module via custom code. 3 | * 4 | * Copyright (c) 2014 Digital Bazaar, Inc. All rights reserved. 5 | * 6 | * @author Dave Longley 7 | */ 8 | define([], function() { 9 | 10 | 'use strict'; 11 | 12 | require.config({ 13 | paths: { 14 | Blob: 'polyfill/Blob', 15 | FileSaver: 'filesaver/FileSaver', 16 | TypedArray: 'polyfill/typedarray', 17 | deflate: 'zip/deflate', 18 | zip: 'zip/zip' 19 | }, 20 | shim: { 21 | // export globals for non-requireJS libs 22 | 'FileSaver': {exports: 'saveAs'}, 23 | 'zip': {exports: 'zip'} 24 | } 25 | }); 26 | 27 | }); 28 | -------------------------------------------------------------------------------- /site/static/app/components/account/account-balance-summary-directive.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Account Balance Summary directive. To be paired w/Account Balance Details. 3 | * 4 | * @author Dave Longley 5 | */ 6 | define([], function() { 7 | 8 | 'use strict'; 9 | 10 | /* @ngInject */ 11 | function factory() { 12 | return { 13 | restrict: 'A', 14 | scope: { 15 | account: '=psAccountBalanceSummary', 16 | expand: '=psExpand' 17 | }, 18 | replace: true, 19 | templateUrl: '/app/components/account/account-balance-summary.html', 20 | link: Link 21 | }; 22 | 23 | function Link(scope) { 24 | var model = scope.model = {}; 25 | scope.$watch('account', function(account) { 26 | // get balance and credit limit 27 | model.balance = parseFloat(account ? account.balance : 0); 28 | model.creditLimit = parseFloat(account ? account.creditLimit || '0' : 0); 29 | 30 | // calculate remaining credit 31 | model.remainingCredit = model.creditLimit; 32 | if(model.balance < 0) { 33 | model.remainingCredit = model.creditLimit + model.balance; 34 | } 35 | 36 | // get total balance (includes remaining credit) 37 | model.totalBalance = model.remainingCredit; 38 | if(model.balance > 0) { 39 | model.totalBalance += model.balance; 40 | } 41 | }, true); 42 | } 43 | } 44 | 45 | return {psAccountBalanceSummary: factory}; 46 | 47 | }); 48 | -------------------------------------------------------------------------------- /site/static/app/components/account/account-balance-summary.html: -------------------------------------------------------------------------------- 1 |
2 | You have opened a credit line of 3 | USD {{account.creditLimit | currency:'$'}} 4 | for your "{{account.label}}" account. 5 |
6 | 7 |In order to enable your credit line, select a payment method that will be 8 | used to automatically pay back any credit you use on a periodic basis.
9 | 10 |For more information, see our 18 | pricing policy and rates.
19 | 20 |2 | You have deposited 3 | 4 | into your 5 | "{{accounts[account.id].label}}" 6 | account. 7 |
8 | 9 |19 | Including fees, your 20 | 21 | card 22 | bank account 23 | external account 24 | 25 | "{{input.source.label}}" 26 | was charged 27 | 28 | on 29 | {{deposit.created | date:'medium'}}. 30 | "Digital Bazaar" will appear on your billing statement. 31 |
32 | 33 |A copy of this receipt has been sent to your email address.
34 |22 | If these details are correct, click the "Deposit" button. 23 |
24 | -------------------------------------------------------------------------------- /site/static/app/components/account/edit-account-modal.html: -------------------------------------------------------------------------------- 1 |2 | You have withdrawn 3 | 4 | from your 5 | "{{account.label}}" 6 | account. 7 |
8 | 9 |19 | Your 20 | 21 | bank account 22 | external account 23 | 24 | "{{input.destination.label}}" 25 | was credited 26 | 27 | on 28 | {{withdrawal.created | date:'medium'}}. 29 | "Digital Bazaar" will appear on your bank statement. 30 |
31 | 32 |A copy of this receipt has been sent to your email address.
33 |22 | If these details are correct, click the "Withdraw" button. 23 |
24 | -------------------------------------------------------------------------------- /site/static/app/components/address/add-address-edit.html: -------------------------------------------------------------------------------- 1 | 42 | -------------------------------------------------------------------------------- /site/static/app/components/address/add-address-modal.html: -------------------------------------------------------------------------------- 1 |2 | We ran your address through an address validation service, but it could 3 | not be validated. You may still use the address you entered, but if you 4 | would like to make changes please click "Back" below. 5 |
6 |7 | We have run your address through an address validation service. If the 8 | validated address looks ok, please click "Add" to continue. If the 9 | validated address does not match the address you entered, then you may 10 | click on the one you entered to select it instead. 11 |
12 | 13 |FIXME: Causes description.
8 |FIXME
14 |FIXME: Tickets description.
8 |FIXME
14 |A number of tools are available to help you utilize our financial 8 | capabilities.
9 |A tool to help you easily setup selling digital content from your 18 | own website.
19 |Create invoices for your customers.
25 |Collect money for your causes.
31 |Sell tickets to your events.
37 |{{budget.label}} | 6 ||
---|---|
Balance | 11 |12 | 13 | | 14 |
2 | You have deposited 3 | 4 | into your 5 | "{{accounts[depositDestination].label}}" 6 | account. 7 |
8 | 9 |17 | Including fees, your 18 | 19 | credit card 20 | bank account 21 | external account 22 | 23 | was charged 24 | 25 | on 26 | {{deposit.created | date:'medium'}}. 27 | "Digital Bazaar" will appear on your billing statement. 28 |
29 | 30 |A copy of this receipt has been sent to your email address.
31 | -------------------------------------------------------------------------------- /site/static/app/components/payment-token/verify-bank-account-review.html: -------------------------------------------------------------------------------- 1 |22 | If these details are correct, click the "Verify and Deposit" button. 23 |
24 | -------------------------------------------------------------------------------- /site/static/app/components/promo/promo-service.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * PaySwarm Promo Service. 3 | * 4 | * @author Dave Longley 5 | */ 6 | define([], function() { 7 | 8 | 'use strict'; 9 | 10 | /* @ngInject */ 11 | function factory( 12 | $http, $rootScope, psAccountService, psTransactionService, config) { 13 | var service = {}; 14 | 15 | service.state = { 16 | loading: false 17 | }; 18 | 19 | // redeem a promo code 20 | service.redeemCode = function(code, accountId) { 21 | service.state.loading = true; 22 | return Promise.resolve($http.post('/promos?action=redeem', { 23 | promoCode: code, 24 | account: accountId 25 | })).then(function() { 26 | service.state.loading = false; 27 | // refresh related account 28 | psAccountService.collection.get(accountId, { 29 | delay: 500, 30 | force: true 31 | }).then(function() { 32 | // refresh latest transactions 33 | psTransactionService.getRecent({force: true}); 34 | }); 35 | }).catch(function(err) { 36 | service.state.loading = false; 37 | throw err; 38 | }); 39 | }; 40 | 41 | // expose service to scope 42 | $rootScope.app.services.promo = service; 43 | 44 | return service; 45 | } 46 | 47 | return {psPromoService: factory}; 48 | 49 | }); 50 | -------------------------------------------------------------------------------- /site/static/app/components/promo/promo.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Promo module. 3 | * 4 | * Copyright (c) 2012-2014 Digital Bazaar, Inc. All rights reserved. 5 | * 6 | * @author Dave Longley 7 | */ 8 | define([ 9 | 'angular', 10 | './promo-code-checker-directive', 11 | './promo-service', 12 | './redeem-promo-code-modal-directive' 13 | ], function( 14 | angular, 15 | promoCodeCheckerDirective, 16 | promoService, 17 | redeemPromoCodeModalDirective 18 | ) { 19 | 20 | 'use strict'; 21 | 22 | var module = angular.module('app.promo', []); 23 | 24 | module.directive(promoCodeCheckerDirective); 25 | module.service(promoService); 26 | module.directive(redeemPromoCodeModalDirective); 27 | 28 | return module.name; 29 | 30 | }); 31 | -------------------------------------------------------------------------------- /site/static/app/components/promo/redeem-promo-code-modal-directive.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Redeem Promo Code Modal. 3 | * 4 | * @author Dave Longley 5 | */ 6 | define([], function() { 7 | 8 | 'use strict'; 9 | 10 | /* @ngInject */ 11 | function factory(brAlertService, psPromoService) { 12 | return { 13 | restrict: 'A', 14 | scope: {account: '=psAccount'}, 15 | require: '^stackable', 16 | templateUrl: '/app/components/promo/redeem-promo-code-modal.html', 17 | link: Link 18 | }; 19 | 20 | function Link(scope) { 21 | scope.model = {}; 22 | scope.services = {promo: psPromoService}; 23 | 24 | scope.redeemPromoCode = function() { 25 | psPromoService.redeemCode(scope.model.promoCode, scope.account.id) 26 | .then(function(promo) { 27 | scope.model.success = true; 28 | scope.model.promo = promo; 29 | }) 30 | .catch(function(err) { 31 | brAlertService.add('error', err, {scope: scope}); 32 | }) 33 | .then(function() { 34 | scope.$apply(); 35 | }); 36 | }; 37 | } 38 | } 39 | 40 | return {psRedeemPromoCodeModal: factory}; 41 | 42 | }); 43 | -------------------------------------------------------------------------------- /site/static/app/components/purchase/purchase.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Purchase module. 3 | * 4 | * Copyright (c) 2012-2014 Digital Bazaar, Inc. All rights reserved. 5 | * 6 | * @author Dave Longley 7 | */ 8 | define([ 9 | 'angular', 10 | './purchase-controller' 11 | ], function(angular, purchaseController) { 12 | 13 | 'use strict'; 14 | 15 | var module = angular.module('app.purchase', []); 16 | 17 | module.controller(purchaseController); 18 | 19 | return module.name; 20 | 21 | }); 22 | -------------------------------------------------------------------------------- /site/static/app/components/system/system.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * System module. 3 | * 4 | * Copyright (c) 2012-2014 Digital Bazaar, Inc. All rights reserved. 5 | * 6 | * @author Dave Longley 7 | */ 8 | define([ 9 | 'angular', 10 | './dashboard.controller' 11 | ], function(angular, dashboard) { 12 | 13 | 'use strict'; 14 | 15 | var module = angular.module('app.system', []); 16 | 17 | module.controller(dashboard); 18 | 19 | return module.name; 20 | 21 | }); 22 | -------------------------------------------------------------------------------- /site/static/app/components/transaction/money.html: -------------------------------------------------------------------------------- 1 | 4 | {{money.currency}} 5 | {{symbol}}{{formattedAmount}} 6 | {{symbol}}{{formattedAmount}} 7 | 8 | -------------------------------------------------------------------------------- /site/static/app/components/transaction/transaction-controller.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Transaction Controller. 3 | * 4 | * @author Manu Sporny 5 | * @author David I. Lehn 6 | * @author Dave Longley 7 | */ 8 | define(['jsonld'], function(jsonld) { 9 | 10 | 'use strict'; 11 | 12 | /* @ngInject */ 13 | function factory( 14 | $scope, psTransactionService, brAlertService, brRefreshService, config) { 15 | var self = this; 16 | 17 | self.modals = {}; 18 | self.state = { 19 | txns: psTransactionService.state 20 | }; 21 | self.txn = undefined; 22 | 23 | brRefreshService.register($scope, function(force) { 24 | var opts = {force: !!force}; 25 | brAlertService.clear(); 26 | psTransactionService.collection.getCurrent(opts) 27 | .then(function(txn) { 28 | self.txn = txn; 29 | self.isContract = jsonld.hasValue(txn, 'type', 'Contract'); 30 | self.isDeposit = jsonld.hasValue(txn, 'type', 'Deposit'); 31 | self.isWithdrawal = jsonld.hasValue(txn, 'type', 'Withdrawal'); 32 | $scope.$apply(); 33 | }) 34 | .catch(function(err) { 35 | brAlertService.add('error', err); 36 | self.txn = null; 37 | $scope.$apply(); 38 | }); 39 | })(); 40 | } 41 | 42 | return {TransactionController: factory}; 43 | 44 | }); 45 | -------------------------------------------------------------------------------- /site/static/app/components/transaction/transaction-routes.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Transaction routes. 3 | * 4 | * Copyright (c) 2014 Digital Bazaar, Inc. All rights reserved. 5 | * 6 | * @author Manu Sporny 7 | * @author David I. Lehn 8 | * @author Dave Longley 9 | */ 10 | define([], function() { 11 | 12 | 'use strict'; 13 | 14 | return [{ 15 | path: '/transactions/:transaction', 16 | options: { 17 | title: 'Transaction', 18 | session: 'required', 19 | templateUrl: '/app/components/transaction/transaction.html' 20 | } 21 | }]; 22 | 23 | }); 24 | -------------------------------------------------------------------------------- /site/static/app/components/transaction/transaction.html: -------------------------------------------------------------------------------- 1 |PaySwarm enables people that create digital content such as blog posts, 10 | music, film, episodic content, photos, virtual goods, and documents to 11 | distribute their creations through their website and receive payment 12 | directly from their fans and customers. It is an open, patent and royalty 13 | free, universal payment standard for the Web. If you have a passion for 14 | creating things on the Web, or would like to support people doing great things - 15 | PaySwarm is for you. If you would like to learn more about PaySwarm, the 16 | official community website is a good 17 | place to start.
18 | 19 | {% include "credits.html" %} 20 | 21 | {% endblock %} 22 | -------------------------------------------------------------------------------- /site/views/assetora.html: -------------------------------------------------------------------------------- 1 | {% extends 'layout.html' %} 2 | 3 | {% set pageTitle = "Assetora" %} 4 | {% set inav = "assetora" %} 5 | 6 | {% block content %} 7 | 8 | {% raw %} 9 |11 | You may use any of the following methods to contact Digital Bazaar, the 12 | company that operates this PaySwarm developer sandbox. 13 |
14 |Topic | Budgets |
Rate Limit | {{freeLimit[0]}} |
Authentication | {{authentication[0]}} |
29 | {{shortDescription}} 30 |
31 |FIXME: need this to be included in the common bedrock template
9 | 10 |[INTRODUCTION]
19 |17 | The article content owner grants the buyer a non-exclusive perpetual 18 | personal-use license to view, download and copy the article, subject to the 19 | following restrictions: 20 |
21 | 22 |