├── .gitignore ├── .travis.yml ├── .travis ├── mariadb.json └── postgres.json ├── MANIFEST.in ├── README.md ├── license.txt ├── paypal_integration ├── __init__.py ├── config │ ├── __init__.py │ ├── docs.py │ └── setup.py ├── docs │ ├── assets │ │ └── img │ │ │ ├── api-step-1.png │ │ │ ├── api-step-2.png │ │ │ ├── api-step-3.png │ │ │ ├── home.png │ │ │ ├── payment-account.png │ │ │ ├── paypal-erp.png │ │ │ ├── sanbox-credentials.png │ │ │ └── setup-sanbox-1.png │ ├── contents.html │ ├── contents.py │ ├── current │ │ ├── api │ │ │ ├── config │ │ │ │ ├── index.html │ │ │ │ ├── index.txt │ │ │ │ ├── paypal_integration.config.docs.html │ │ │ │ ├── paypal_integration.config.html │ │ │ │ └── paypal_integration.config.setup.html │ │ │ ├── index.html │ │ │ ├── index.txt │ │ │ ├── paypal_integration.__init__.html │ │ │ ├── paypal_integration.after_install.html │ │ │ ├── paypal_integration.express_checkout.html │ │ │ ├── paypal_integration.hooks.html │ │ │ ├── paypal_integration.tests.html │ │ │ ├── paypal_integration.utils.html │ │ │ └── paypal_integration │ │ │ │ ├── index.html │ │ │ │ ├── index.txt │ │ │ │ └── paypal_integration.paypal_integration.html │ │ ├── index.html │ │ └── models │ │ │ ├── index.html │ │ │ ├── index.txt │ │ │ └── paypal_integration │ │ │ ├── index.html │ │ │ ├── index.txt │ │ │ ├── paypal_express_payment.html │ │ │ └── paypal_settings.html │ ├── index.html │ ├── index.txt │ ├── install.md │ ├── license.html │ └── user │ │ ├── index.md │ │ ├── index.txt │ │ ├── paypal-setup.md │ │ └── signature-settings.md ├── express_checkout.py ├── hooks.py ├── modules.txt ├── patches.txt ├── patches │ ├── __init__.py │ └── redo_install.py ├── paypal_integration │ ├── __init__.py │ └── doctype │ │ ├── __init__.py │ │ ├── paypal_express_payment │ │ ├── __init__.py │ │ ├── paypal_express_payment.js │ │ ├── paypal_express_payment.json │ │ ├── paypal_express_payment.py │ │ └── test_paypal_express_payment.py │ │ ├── paypal_log │ │ ├── __init__.py │ │ ├── paypal_log.js │ │ ├── paypal_log.json │ │ ├── paypal_log.py │ │ └── test_paypal_log.py │ │ └── paypal_settings │ │ ├── __init__.py │ │ ├── paypal_settings.js │ │ ├── paypal_settings.json │ │ └── paypal_settings.py ├── templates │ ├── __init__.py │ ├── generators │ │ └── __init__.py │ └── pages │ │ ├── __init__.py │ │ ├── paypal-express-cancel.html │ │ ├── paypal-express-confirm.html │ │ ├── paypal-express-failed.html │ │ ├── paypal-express-success.html │ │ ├── paypal_express_cancel.py │ │ ├── paypal_express_confirm.py │ │ └── paypal_express_success.py ├── tests.py └── utils.py ├── requirements.txt ├── setup.py └── test_sites ├── apps.txt ├── languages.txt └── test_site └── site_config.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.pyc 3 | *.egg-info 4 | *.swp 5 | tags -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | dist: trusty 3 | sudo: required 4 | 5 | addons: 6 | hosts: 7 | - test_site 8 | mariadb: 10.3 9 | postgresql: 9.5 10 | 11 | git: 12 | depth: 1 13 | 14 | cache: 15 | - pip 16 | - npm 17 | - yarn 18 | 19 | matrix: 20 | include: 21 | - name: "Python 3.6 MariaDB" 22 | python: 3.6 23 | env: DB=mariadb TYPE=server 24 | script: bench --site test_site run-tests --coverage 25 | 26 | - name: "Python 3.6 PostgreSQL" 27 | python: 3.6 28 | env: DB=postgres TYPE=server 29 | script: bench --site test_site run-tests --coverage 30 | 31 | - name: "Python 2.7 MariaDB" 32 | python: 2.7 33 | env: DB=mariadb TYPE=server 34 | script: bench --site test_site run-tests --coverage 35 | 36 | install: 37 | - cd ~ 38 | - source ./.nvm/nvm.sh 39 | - nvm install v8.10.0 40 | 41 | - git clone https://github.com/frappe/bench --depth 1 42 | - pip install -e ./bench 43 | 44 | - bench init frappe-bench --skip-assets 45 | 46 | - mkdir ~/frappe-bench/sites/test_site 47 | - cp $TRAVIS_BUILD_DIR/.travis/$DB.json ~/frappe-bench/sites/test_site/site_config.json 48 | 49 | - mysql -u root -e "SET GLOBAL character_set_server = 'utf8mb4'" 50 | - mysql -u root -e "SET GLOBAL collation_server = 'utf8mb4_unicode_ci'" 51 | 52 | - mysql -u root -e "CREATE DATABASE test_frappe" 53 | - mysql -u root -e "CREATE USER 'test_frappe'@'localhost' IDENTIFIED BY 'test_frappe'" 54 | - mysql -u root -e "GRANT ALL PRIVILEGES ON \`test_frappe\`.* TO 'test_frappe'@'localhost'" 55 | 56 | - mysql -u root -e "UPDATE mysql.user SET Password=PASSWORD('travis') WHERE User='root'" 57 | - mysql -u root -e "FLUSH PRIVILEGES" 58 | 59 | - psql -c "CREATE DATABASE test_frappe" -U postgres 60 | - psql -c "CREATE USER test_frappe WITH PASSWORD 'test_frappe'" -U postgres 61 | 62 | - cd ./frappe-bench 63 | 64 | - sed -i 's/watch:/# watch:/g' Procfile 65 | - sed -i 's/schedule:/# schedule:/g' Procfile 66 | 67 | - if [ $TYPE == "server" ]; then sed -i 's/socketio:/# socketio:/g' Procfile; fi 68 | - if [ $TYPE == "server" ]; then sed -i 's/redis_socketio:/# redis_socketio:/g' Procfile; fi 69 | 70 | - bench start & 71 | - bench --site test_site reinstall --yes 72 | - bench get-app erpnext paypal_integration 73 | - bench --site test_site install-app erpnext paypal_integration 74 | - bench --site test_site --verbose run-tests --app paypal_integration -------------------------------------------------------------------------------- /.travis/mariadb.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_host": "localhost", 3 | "db_name": "test_frappe", 4 | "db_password": "test_frappe", 5 | "db_type": "mariadb", 6 | "auto_email_id": "test@example.com", 7 | "mail_server": "smtp.example.com", 8 | "mail_login": "test@example.com", 9 | "mail_password": "test", 10 | "admin_password": "admin", 11 | "root_login": "root", 12 | "root_password": "travis", 13 | "host_name": "http://test_site:8000" 14 | } 15 | -------------------------------------------------------------------------------- /.travis/postgres.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_host": "localhost", 3 | "db_name": "test_frappe", 4 | "db_password": "test_frappe", 5 | "db_type": "postgres", 6 | "auto_email_id": "test@example.com", 7 | "mail_server": "smtp.example.com", 8 | "mail_login": "test@example.com", 9 | "mail_password": "test", 10 | "admin_password": "admin", 11 | "root_login": "postgres", 12 | "root_password": "travis", 13 | "host_name": "http://test_site:8000" 14 | } 15 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include MANIFEST.in 2 | include requirements.txt 3 | include *.json 4 | include *.md 5 | include *.py 6 | include *.txt 7 | recursive-include paypal_integration *.css 8 | recursive-include paypal_integration *.csv 9 | recursive-include paypal_integration *.html 10 | recursive-include paypal_integration *.ico 11 | recursive-include paypal_integration *.js 12 | recursive-include paypal_integration *.json 13 | recursive-include paypal_integration *.md 14 | recursive-include paypal_integration *.png 15 | recursive-include paypal_integration *.py 16 | recursive-include paypal_integration *.svg 17 | recursive-include paypal_integration *.txt 18 | recursive-exclude paypal_integration *.pyc -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## Paypal Integration 2 | 3 | Paypal Payment Gateway Integration 4 | 5 | #### License 6 | 7 | MIT -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | License: MIT -------------------------------------------------------------------------------- /paypal_integration/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/__init__.py -------------------------------------------------------------------------------- /paypal_integration/config/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/config/__init__.py -------------------------------------------------------------------------------- /paypal_integration/config/docs.py: -------------------------------------------------------------------------------- 1 | source_link = "https://github.com/frappe/paypal_integration" 2 | docs_base_url = "https://frappe.github.io/paypal_integration" 3 | headline = "PayPal Integration" 4 | sub_heading = "Setup PayPal with ERPNext" 5 | long_description = """ A payment gateway is an e-commerce application service provider service that authorizes 6 | credit card payments for e-businesses, online retailers, bricks and clicks, 7 | or traditional brick and mortar. 8 | 9 | A payment gateway facilitates the transfer of information between a payment portal 10 | (such as a website, mobile phone or interactive voice response service) and 11 | the Front End Processor or acquiring bank.""" 12 | 13 | docs_version = "1.x.x" 14 | splash_light_background = True 15 | 16 | def get_context(context): 17 | context.app.splash_light_background = True 18 | -------------------------------------------------------------------------------- /paypal_integration/config/setup.py: -------------------------------------------------------------------------------- 1 | from __future__ import unicode_literals 2 | from frappe import _ 3 | 4 | def get_data(): 5 | return [ 6 | { 7 | "label": _("Integrations"), 8 | "icon": "icon-star", 9 | "items": [ 10 | { 11 | "type": "doctype", 12 | "name": "PayPal Settings", 13 | "description": _("Setup PayPal credentials"), 14 | "hide_count": True 15 | } 16 | ] 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /paypal_integration/docs/assets/img/api-step-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/docs/assets/img/api-step-1.png -------------------------------------------------------------------------------- /paypal_integration/docs/assets/img/api-step-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/docs/assets/img/api-step-2.png -------------------------------------------------------------------------------- /paypal_integration/docs/assets/img/api-step-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/docs/assets/img/api-step-3.png -------------------------------------------------------------------------------- /paypal_integration/docs/assets/img/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/docs/assets/img/home.png -------------------------------------------------------------------------------- /paypal_integration/docs/assets/img/payment-account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/docs/assets/img/payment-account.png -------------------------------------------------------------------------------- /paypal_integration/docs/assets/img/paypal-erp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/docs/assets/img/paypal-erp.png -------------------------------------------------------------------------------- /paypal_integration/docs/assets/img/sanbox-credentials.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/docs/assets/img/sanbox-credentials.png -------------------------------------------------------------------------------- /paypal_integration/docs/assets/img/setup-sanbox-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/docs/assets/img/setup-sanbox-1.png -------------------------------------------------------------------------------- /paypal_integration/docs/contents.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

Table of Contents

4 |
5 | 6 | {% include "templates/includes/full_index.html" %} 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /paypal_integration/docs/contents.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | from __future__ import unicode_literals 5 | import frappe 6 | from frappe.website.utils import get_full_index 7 | 8 | def get_context(context): 9 | context.full_index = get_full_index(extn = True) 10 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/config/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | Version 1.x.x 8 | 9 | 10 | Source 12 | 13 |
14 | 15 |

Package Contents

16 | 17 | {index} 18 | 19 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/config/index.txt: -------------------------------------------------------------------------------- 1 | paypal_integration.config.docs 2 | paypal_integration.config 3 | paypal_integration.config.setup -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/config/paypal_integration.config.docs.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Version 1.x.x 5 | 6 | 7 | Source 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 | 23 | paypal_integration.config.docs.get_context 24 | (context) 25 |

26 |

No docs

27 |
28 |
29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/config/paypal_integration.config.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Version 1.x.x 5 | 6 | 7 | Source 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/config/paypal_integration.config.setup.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Version 1.x.x 5 | 6 | 7 | Source 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 | 23 | paypal_integration.config.setup.get_data 24 | () 25 |

26 |

No docs

27 |
28 |
29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | Version 1.x.x 9 | 10 | 11 | Source 13 | 14 |
15 | 16 |

Contents

17 | 18 | 19 | 20 | {index} -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/index.txt: -------------------------------------------------------------------------------- 1 | paypal_integration.__init__ 2 | paypal_integration.after_install 3 | paypal_integration.express_checkout 4 | paypal_integration.hooks 5 | paypal_integration.tests 6 | paypal_integration.utils -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/paypal_integration.__init__.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Version 1.x.x 5 | 6 | 7 | Source 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/paypal_integration.after_install.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Version 1.x.x 5 | 6 | 7 | Source 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 | 23 | paypal_integration.after_install.create_gateway_account 24 | () 25 |

26 |

No docs

27 |
28 |
29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 |

37 | 38 | 39 | paypal_integration.after_install.create_payment_gateway 40 | () 41 |

42 |

No docs

43 |
44 |
45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/paypal_integration.express_checkout.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Version 1.x.x 5 | 6 | 7 | Source 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

Class PaypalException

19 | 20 |

Inherits from exceptions.Exception 21 | 22 |

23 |
24 |
25 | 26 |
27 |
28 | 29 | 30 | 31 | 32 | 33 | 34 |

Public API 35 |
/api/method/paypal_integration.express_checkout.confirm_payment 36 |

37 |

38 | 39 | 40 | paypal_integration.express_checkout.confirm_payment 41 | (token) 42 |

43 |

No docs

44 |
45 |
46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 |

54 | 55 | 56 | paypal_integration.express_checkout.execute_set_express_checkout 57 | (amount, currency) 58 |

59 |

No docs

60 |
61 |
62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 |

70 | 71 | 72 | paypal_integration.express_checkout.get_api_response 73 | (params) 74 |

75 |

No docs

76 |
77 |
78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 |

86 | 87 | 88 | paypal_integration.express_checkout.get_api_url 89 | () 90 |

91 |

No docs

92 |
93 |
94 | 95 | 96 | 97 | 98 | 99 | 100 |

Public API 101 |
/api/method/paypal_integration.express_checkout.get_express_checkout_details 102 |

103 |

104 | 105 | 106 | paypal_integration.express_checkout.get_express_checkout_details 107 | (token) 108 |

109 |

No docs

110 |
111 |
112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 |

120 | 121 | 122 | paypal_integration.express_checkout.get_paypal_params 123 | () 124 |

125 |

No docs

126 |
127 |
128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 |

136 | 137 | 138 | paypal_integration.express_checkout.get_paypal_settings 139 | () 140 |

141 |

No docs

142 |
143 |
144 | 145 | 146 | 147 | 148 | 149 | 150 |

Public API 151 |
/api/method/paypal_integration.express_checkout.set_express_checkout 152 |

153 |

154 | 155 | 156 | paypal_integration.express_checkout.set_express_checkout 157 | (amount, currency=USD, data=None) 158 |

159 |

No docs

160 |
161 |
162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 |

170 | 171 | 172 | paypal_integration.express_checkout.trigger_ref_doc 173 | (paypal_express_payment, method) 174 |

175 |

No docs

176 |
177 |
178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 |

186 | 187 | 188 | paypal_integration.express_checkout.validate_transaction_currency 189 | (currency) 190 |

191 |

No docs

192 |
193 |
194 | 195 | 196 | 197 | 198 | 199 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/paypal_integration.hooks.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Version 1.x.x 5 | 6 | 7 | Source 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/paypal_integration.tests.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Version 1.x.x 5 | 6 | 7 | Source 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |

Class TestExpressCheckout

19 | 20 |

Inherits from unittest.case.TestCase 21 | 22 |

23 |
24 |
25 | 26 | 27 | 28 | 29 |

30 | 31 | 32 | test_set_express_checkout 33 | (self) 34 |

35 |

No docs

36 |
37 |
38 | 39 | 40 |
41 |
42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/paypal_integration.utils.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Version 1.x.x 5 | 6 | 7 | Source 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |

21 | 22 | 23 | paypal_integration.utils.get_payment_url 24 | (doc, method) 25 |

26 |

No docs

27 |
28 |
29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/paypal_integration/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | Version 1.x.x 8 | 9 | 10 | Source 12 | 13 |
14 | 15 |

Package Contents

16 | 17 | {index} 18 | 19 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/paypal_integration/index.txt: -------------------------------------------------------------------------------- 1 | paypal_integration.paypal_integration -------------------------------------------------------------------------------- /paypal_integration/docs/current/api/paypal_integration/paypal_integration.paypal_integration.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | Version 1.x.x 5 | 6 | 7 | Source 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
6 | 7 | 8 | Version 1.x.x 9 | 10 | 11 | Source 13 | 14 |
15 | 16 | 17 | 18 | 21 | 24 | 25 | 26 | 29 | 32 | 33 | 34 | 37 | 40 | 41 |
19 | App Name 20 | 22 | paypal_integration 23 |
27 | Publisher 28 | 30 | Frappe 31 |
35 | Version 36 | 38 | 0.0.1 39 |
42 | 43 |

Contents

44 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/models/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | Version 1.x.x 8 | 9 | 10 | Source 12 | 13 |
14 | 15 |

Browse DocTypes by Module

16 | 17 |

Contents

18 | 19 | {index} 20 | 21 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/models/index.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/docs/current/models/index.txt -------------------------------------------------------------------------------- /paypal_integration/docs/current/models/paypal_integration/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |
5 | 6 | 7 | Version 1.x.x 8 | 9 | 10 | Source 12 | 13 |
14 | 15 |

DocTypes for paypal_integration

16 | 17 | {index} 18 | 19 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/models/paypal_integration/index.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/docs/current/models/paypal_integration/index.txt -------------------------------------------------------------------------------- /paypal_integration/docs/current/models/paypal_integration/paypal_express_payment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | Version 1.x.x 11 | 12 | 13 | Source 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 |

Table Name: tabPaypal Express Payment

23 | 24 | 25 | 26 | 27 |

Fields

28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 58 | 62 | 69 | 70 | 71 | 72 | 73 | 74 | 76 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 88 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 100 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 112 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 124 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 136 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 148 | 152 | 162 | 163 | 164 | 165 | 166 | 167 | 169 | 173 | 176 | 177 | 178 | 179 |
SrFieldnameTypeLabelOptions
1token 45 | Data 47 | Token 48 | 49 |
2status 57 | Select 59 | Status 60 | 61 | 63 |
Started
 64 | Verified
 65 | Cancelled
 66 | Confirmed
 67 | Completed
68 |
3amount 75 | Data 77 | Amount 78 | 79 |
4currency 87 | Data 89 | Currency 90 | 91 |
5data 99 | Text 101 | Data 102 | 103 |
6transaction_id 111 | Data 113 | Transaction Id 114 | 115 |
7payer_email 123 | Data 125 | Payer Email 126 | 127 |
8payerid 135 | Data 137 | PayerID 138 | 139 |
9reference_doctype 147 | Link 149 | Reference Doctype 150 | 151 | 153 | 154 | 155 | 156 | 157 | DocType 158 | 159 | 160 | 161 |
10reference_docname 168 | Dynamic Link 170 | Reference Docname 171 | 172 | 174 |
reference_doctype
175 |
180 | 181 | 182 |
183 |

Controller

184 |

paypal_integration.paypal_integration.doctype.paypal_express_payment.paypal_express_payment

185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 |

Class PaypalExpressPayment

193 | 194 |

Inherits from frappe.model.document.Document 195 | 196 |

197 |
198 |
199 | 200 |
201 |
202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | -------------------------------------------------------------------------------- /paypal_integration/docs/current/models/paypal_integration/paypal_settings.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | Version 1.x.x 11 | 12 | 13 | Source 15 | 16 |
17 | 18 | Single 19 | 20 | 21 | 22 | 23 | 24 | 25 |

Fields

26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 44 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 56 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 68 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 80 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 93 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 105 | 109 | 110 | 111 | 112 | 113 |
SrFieldnameTypeLabelOptions
1api_username 43 | Data 45 | API Username 46 | 47 |
2api_password 55 | Data 57 | API Password 58 | 59 |
3signature 67 | Data 69 | Signature 70 | 71 |
4paypal_sandbox 79 | Check 81 | Use Sandbox 82 |

83 | Check this if you are testing your payment using the Sandbox API

84 |
5column_break_5 92 | Column Break 94 | 95 | 96 |
6html_6 104 | HTML 106 | 107 | 108 |
114 | 115 | 116 |
117 |

Controller

118 |

paypal_integration.paypal_integration.doctype.paypal_settings.paypal_settings

119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 |

Class PayPalSettings

127 | 128 |

Inherits from frappe.model.document.Document 129 | 130 |

131 |
132 |
133 | 134 | 135 | 136 | 137 |

138 | 139 | 140 | on_update 141 | (self) 142 |

143 |

No docs

144 |
145 |
146 | 147 | 148 |
149 |
150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | -------------------------------------------------------------------------------- /paypal_integration/docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 |
10 |
11 |
12 |
13 |

PayPal Integration

14 |

Setup PayPal with ERPNext

15 |
16 |
17 |
18 | 20 |
21 |
22 |
23 |
24 |
25 | 26 | 27 | 28 |
29 |
30 |
31 |

A payment gateway is an e-commerce application service provider service that authorizes 32 | credit card payments for e-businesses, online retailers, bricks and clicks, 33 | or traditional brick and mortar.

34 | 35 |

A payment gateway facilitates the transfer of information between a payment portal 36 | (such as a website, mobile phone or interactive voice response service) and 37 | the Front End Processor or acquiring bank.

38 | 39 |
40 |
41 |
42 | 43 | 44 | 45 |
46 |
47 |
48 |

Install

49 |

From your site

50 |

To install this app, login to your site and click on "Installer". Search for Paypal Integration and click on "Install"

51 |

Using Bench

52 |

Go to your bench folder and setup the new app

53 |
$ bench get-app paypal_integration https://github.com/frappe/paypal_integration
54 | $ bench new-site testsite
55 | $ bench --site testsite install-app paypal_integration
56 |

Login to your site to configure the app.

57 |

Detailed Installation Steps

58 |
59 |
60 |

Author

61 | 62 |

Frappe (info@frappe.io)

63 |
64 |
65 |
66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /paypal_integration/docs/index.txt: -------------------------------------------------------------------------------- 1 | assets 2 | contents 3 | current 4 | install 5 | license 6 | user -------------------------------------------------------------------------------- /paypal_integration/docs/install.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Installation 4 | 5 | Paypal Integration is based on the Frappe Framework, a full stack web framework based on Python, MariaDB, Redis, Node. 6 | 7 | To intall Paypal Integration, you will have to install the Frappe Bench, the command-line, package manager and site manager for Frappe Framework. For more details, read the Bench README. 8 | 9 | After you have installed Frappe Bench, go to you bench folder, which is `frappe.bench` by default and setup **paypal_integration**. 10 | 11 | bench get-app paypal_integration {{ source_link }} 12 | 13 | Then create a new site to install the app. 14 | 15 | bench new-site mysite 16 | 17 | This will create a new folder in your `/sites` directory and create a new database for this site. 18 | 19 | Next, install paypal_integration in this site 20 | 21 | bench --site mysite install-app paypal_integration 22 | 23 | To run this locally, run 24 | 25 | bench start 26 | 27 | Fire up your browser and go to http://localhost:8000 and you should see the login screen. Login as **Administrator** and **admin** (or the password you set at the time of `new-site`) and you are set. 28 | 29 | 30 | -------------------------------------------------------------------------------- /paypal_integration/docs/license.html: -------------------------------------------------------------------------------- 1 | 2 | 3 |

MIT

4 | 5 |

License: MIT

6 | 7 | 8 | -------------------------------------------------------------------------------- /paypal_integration/docs/user/index.md: -------------------------------------------------------------------------------- 1 | {index} 2 | -------------------------------------------------------------------------------- /paypal_integration/docs/user/index.txt: -------------------------------------------------------------------------------- 1 | signature-settings 2 | paypal-setup -------------------------------------------------------------------------------- /paypal_integration/docs/user/paypal-setup.md: -------------------------------------------------------------------------------- 1 | #### Setup PayPal on ERPNext 2 | 3 | - Setup PayPal signature under PayPal Settings 4 | Payment Request 5 | 6 | --- 7 | #### Setup Payment Gateway Account 8 | - Setup Payment account as per currency 9 | Payment Request 10 | 11 | --- 12 | -------------------------------------------------------------------------------- /paypal_integration/docs/user/signature-settings.md: -------------------------------------------------------------------------------- 1 | To Integrate Paypal with ERPNext, you need PayPal api signature credentials. 2 | 3 | #### Paypal Sanbox API Signature 4 | - Login to paypal developer account, PayPal Developer Account 5 | - From **Accounts** tab. create a new business account. 6 | Payment Request 7 | 8 | - From this account profile you will get your sandbox api credentials 9 | Payment Request 10 | 11 | 12 | --- 13 | 14 | #### PayPal Account API Signature 15 | - Login to PayPal Account and go to profile 16 | Payment Request 17 | 18 | - From **My Selling Tools** go to **api Access** 19 | Payment Request 20 | 21 | - On API Access Page, choose option 2 to generate API credentials 22 | Payment Request 23 | -------------------------------------------------------------------------------- /paypal_integration/express_checkout.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | from __future__ import unicode_literals 5 | 6 | import json 7 | 8 | try: 9 | from urlparse import parse_qs 10 | except ImportError: 11 | from urllib.parse import parse_qs 12 | 13 | from six import string_types 14 | 15 | import frappe 16 | from frappe.utils import get_url 17 | from frappe import _ 18 | from frappe.utils import get_request_session 19 | 20 | """ 21 | Paypal Express Checkout using classic API 22 | 23 | For full workflow: 24 | 25 | https://developer.paypal.com/docs/classic/express-checkout/ht_ec-singleItemPayment-curl-etc/ 26 | """ 27 | 28 | class PaypalException(Exception): pass 29 | 30 | def validate_paypal_credentials(doc, method): 31 | from six.moves.urllib.parse import urlencode 32 | if hasattr(doc, "api_username"): 33 | params = { 34 | "USER": doc.api_username, 35 | "PWD": doc.api_password, 36 | "SIGNATURE": doc.signature, 37 | "VERSION": "98", 38 | "paypal_sandbox": doc.paypal_sandbox 39 | } 40 | else: 41 | params = get_paypal_params() 42 | 43 | if params.get("USER"): 44 | api_url = None 45 | 46 | if "paypal_sandbox" in params: 47 | api_url = get_api_url(frappe._dict(params)) 48 | del params["paypal_sandbox"] 49 | 50 | params.update({ 51 | "METHOD": "GetPalDetails" 52 | }) 53 | 54 | params = urlencode(params) 55 | 56 | try: 57 | return get_api_response(params.encode("utf-8"), api_url) 58 | except Exception: 59 | frappe.throw(_("Invalid payment gateway credentials")) 60 | 61 | @frappe.whitelist(allow_guest=True, xss_safe=True) 62 | def set_express_checkout(amount, currency="USD", data=None): 63 | validate_transaction_currency(currency) 64 | 65 | if not isinstance(data, string_types): 66 | data = frappe.as_json(data or "{}") 67 | 68 | response = execute_set_express_checkout(amount, currency) 69 | 70 | if not response["success"]: 71 | paypal_log(response) 72 | frappe.db.commit() 73 | 74 | frappe.respond_as_web_page(_("Something went wrong"), 75 | _("Looks like something is wrong with this site's Paypal configuration. Don't worry! No payment has been made from your Paypal account."), 76 | success=False, 77 | http_status_code=frappe.ValidationError.http_status_code) 78 | 79 | return 80 | 81 | paypal_settings = get_paypal_settings() 82 | if paypal_settings.paypal_sandbox: 83 | return_url = "https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token={0}" 84 | else: 85 | return_url = "https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token={0}" 86 | 87 | token = response.get("TOKEN")[0] 88 | paypal_express_payment = frappe.get_doc({ 89 | "doctype": "Paypal Express Payment", 90 | "status": "Started", 91 | "amount": amount, 92 | "currency": currency, 93 | "token": token, 94 | "data": data, 95 | "correlation_id": response.get("CORRELATIONID")[0] 96 | }) 97 | if data: 98 | if isinstance(data, string_types): 99 | data = json.loads(data) 100 | 101 | if data.get("doctype") and data.get("docname"): 102 | paypal_express_payment.reference_doctype = data.get("doctype") 103 | paypal_express_payment.reference_docname = data.get("docname") 104 | 105 | paypal_express_payment.insert(ignore_permissions = True) 106 | frappe.db.commit() 107 | 108 | frappe.local.response["type"] = "redirect" 109 | frappe.local.response["location"] = return_url.format(token) 110 | 111 | def execute_set_express_checkout(amount, currency): 112 | from six.moves.urllib.parse import urlencode 113 | params = get_paypal_params() 114 | params.update({ 115 | "METHOD": "SetExpressCheckout", 116 | "PAYMENTREQUEST_0_PAYMENTACTION": "SALE", 117 | "PAYMENTREQUEST_0_AMT": amount, 118 | "PAYMENTREQUEST_0_CURRENCYCODE": currency 119 | }) 120 | 121 | return_url = get_url("/api/method/paypal_integration.express_checkout.get_express_checkout_details") 122 | 123 | params = urlencode(params) + \ 124 | "&returnUrl={0}&cancelUrl={1}".format(return_url, get_url("/paypal-express-cancel")) 125 | 126 | return get_api_response(params.encode("utf-8")) 127 | 128 | @frappe.whitelist(allow_guest=True, xss_safe=True) 129 | def get_express_checkout_details(token): 130 | params = get_paypal_params() 131 | params.update({ 132 | "METHOD": "GetExpressCheckoutDetails", 133 | "TOKEN": token 134 | }) 135 | 136 | response = get_api_response(params) 137 | 138 | if not response["success"]: 139 | paypal_log(response, params) 140 | frappe.db.commit() 141 | 142 | frappe.respond_as_web_page(_("Something went wrong"), 143 | _("Looks like something went wrong during the transaction. Since we haven't confirmed the payment, Paypal will automatically refund you this amount. If it doesn't, please send us an email and mention the Correlation ID: {0}.").format(response.get("CORRELATIONID", [None])[0]), 144 | success=False, 145 | http_status_code=frappe.ValidationError.http_status_code) 146 | 147 | return 148 | 149 | paypal_express_payment = frappe.get_doc("Paypal Express Payment", token) 150 | paypal_express_payment.payerid = response.get("PAYERID")[0] 151 | paypal_express_payment.payer_email = response.get("EMAIL")[0] 152 | paypal_express_payment.status = "Verified" 153 | paypal_express_payment.save(ignore_permissions=True) 154 | frappe.db.commit() 155 | 156 | frappe.local.response["type"] = "redirect" 157 | frappe.local.response["location"] = get_url( \ 158 | "/api/method/paypal_integration.express_checkout.confirm_payment?token="+paypal_express_payment.token) 159 | 160 | @frappe.whitelist(allow_guest=True, xss_safe=True) 161 | def confirm_payment(token): 162 | paypal_express_payment = frappe.get_doc("Paypal Express Payment", token) 163 | 164 | params = get_paypal_params() 165 | params.update({ 166 | "METHOD": "DoExpressCheckoutPayment", 167 | "PAYERID": paypal_express_payment.payerid, 168 | "TOKEN": paypal_express_payment.token, 169 | "PAYMENTREQUEST_0_PAYMENTACTION": "SALE", 170 | "PAYMENTREQUEST_0_AMT": paypal_express_payment.amount, 171 | "PAYMENTREQUEST_0_CURRENCYCODE": paypal_express_payment.currency 172 | }) 173 | 174 | response = get_api_response(params) 175 | 176 | if response["success"]: 177 | paypal_express_payment.status = "Completed" 178 | paypal_express_payment.transaction_id = response.get("PAYMENTINFO_0_TRANSACTIONID")[0] 179 | paypal_express_payment.correlation_id = response.get("CORRELATIONID")[0] 180 | paypal_express_payment.flags.redirect = True 181 | paypal_express_payment.flags.redirect_to = get_url("/paypal-express-success") 182 | paypal_express_payment.flags.status_changed_to = "Completed" 183 | paypal_express_payment.save(ignore_permissions=True) 184 | 185 | else: 186 | paypal_express_payment.status = "Failed" 187 | paypal_express_payment.flags.redirect = True 188 | paypal_express_payment.flags.redirect_to = get_url("/paypal-express-failed") 189 | paypal_express_payment.save(ignore_permissions=True) 190 | 191 | paypal_log(response, params) 192 | 193 | frappe.db.commit() 194 | 195 | # this is done so that functions called via hooks can update flags.redirect_to 196 | if paypal_express_payment.flags.redirect: 197 | frappe.local.response["type"] = "redirect" 198 | frappe.local.response["location"] = paypal_express_payment.flags.redirect_to 199 | 200 | def get_paypal_params(): 201 | paypal_settings = get_paypal_settings() 202 | if paypal_settings.api_username: 203 | return { 204 | "USER": paypal_settings.api_username, 205 | "PWD": paypal_settings.api_password, 206 | "SIGNATURE": paypal_settings.signature, 207 | "VERSION": "98" 208 | } 209 | 210 | else : 211 | return { 212 | "USER": frappe.conf.paypal_username, 213 | "PWD": frappe.conf.paypal_password, 214 | "SIGNATURE": frappe.conf.paypal_signature, 215 | "VERSION": "98" 216 | } 217 | 218 | def get_api_url(paypal_settings=None): 219 | if not paypal_settings: 220 | paypal_settings = get_paypal_settings() 221 | 222 | if paypal_settings.paypal_sandbox: 223 | return "https://api-3t.sandbox.paypal.com/nvp" 224 | else: 225 | return "https://api-3t.paypal.com/nvp" 226 | 227 | def get_api_response(params, api_url=None): 228 | s = get_request_session() 229 | response = s.post(api_url or get_api_url(), data=params) 230 | response = parse_qs(response.text) 231 | response["success"] = response.get("ACK")[0]=="Success" 232 | return response 233 | 234 | def get_paypal_settings(): 235 | paypal_settings = frappe.get_doc("PayPal Settings") 236 | 237 | # update from site_config.json 238 | for key in ("paypal_sandbox", "paypal_username", "paypal_password", "paypal_signature"): 239 | if key in frappe.local.conf: 240 | paypal_settings.set(key, frappe.local.conf[key]) 241 | 242 | return paypal_settings 243 | 244 | def validate_transaction_currency(currency): 245 | if currency not in ["AUD", "BRL", "CAD", "CZK", "DKK", "EUR", "HKD", "HUF", "ILS", "JPY", "MYR", "MXN", 246 | "TWD", "NZD", "NOK", "PHP", "PLN", "GBP", "RUB", "SGD", "SEK", "CHF", "THB", "TRY", "USD"]: 247 | frappe.throw(_("Please select another payment method. PayPal does not support transactions in currency '{0}'").format(currency)) 248 | 249 | def paypal_log(response, params=None): 250 | frappe.get_doc({ 251 | "doctype": "Paypal Log", 252 | "error": frappe.as_json(response), 253 | "params": frappe.as_json(params or "") 254 | }).insert(ignore_permissions=True) 255 | 256 | def set_redirect(paypal_express_payment): 257 | """ERPNext related redirects. 258 | You need to set Paypal Express Payment.flags.redirect_to on status change. 259 | Called via PaypalExpressPayment.on_update""" 260 | 261 | reference_doctype = paypal_express_payment.reference_doctype 262 | reference_docname = paypal_express_payment.reference_docname 263 | 264 | if reference_doctype and reference_docname: 265 | reference_doc = frappe.get_doc(reference_doctype, reference_docname) 266 | reference_doc.run_method('on_payment_authorized') 267 | 268 | if "erpnext" not in frappe.get_installed_apps(): 269 | return 270 | 271 | if not paypal_express_payment.flags.status_changed_to: 272 | return 273 | 274 | 275 | if not reference_doc: 276 | return 277 | 278 | shopping_cart_settings = frappe.get_doc("Shopping Cart Settings") 279 | 280 | if paypal_express_payment.flags.status_changed_to == "Completed": 281 | reference_doc.run_method("set_as_paid") 282 | 283 | # if shopping cart enabled and in session 284 | if (shopping_cart_settings.enabled 285 | and hasattr(frappe.local, "session") 286 | and frappe.local.session.user != "Guest"): 287 | 288 | success_url = shopping_cart_settings.payment_success_url 289 | if success_url: 290 | paypal_express_payment.flags.redirect_to = ({ 291 | "Orders": "orders", 292 | "Invoices": "invoices", 293 | "My Account": "me" 294 | }).get(success_url, "me") 295 | else: 296 | paypal_express_payment.flags.redirect_to = get_url("/orders/{0}".format(reference_doc.reference_name)) 297 | 298 | elif paypal_express_payment.flags.status_changed_to == "Cancelled": 299 | reference_doc.run_method("set_as_cancelled") 300 | -------------------------------------------------------------------------------- /paypal_integration/hooks.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from __future__ import unicode_literals 3 | 4 | app_name = "paypal_integration" 5 | app_title = "Paypal Integration" 6 | app_publisher = "Frappe" 7 | app_description = "Paypal Payment Gateway Integration" 8 | app_icon = "octicon octicon-credit-card" 9 | app_color = "#179bd7" 10 | app_email = "info@frappe.io" 11 | app_version = "0.0.1" 12 | hide_in_installer = True 13 | app_license = "MIT" 14 | 15 | # Includes in 16 | # ------------------ 17 | 18 | # include js, css files in header of desk.html 19 | # app_include_css = "/assets/paypal_integration/css/paypal_integration.css" 20 | # app_include_js = "/assets/paypal_integration/js/paypal_integration.js" 21 | 22 | # include js, css files in header of web template 23 | # web_include_css = "/assets/paypal_integration/css/paypal_integration.css" 24 | # web_include_js = "/assets/paypal_integration/js/paypal_integration.js" 25 | 26 | # Home Pages 27 | # ---------- 28 | 29 | # application home page (will override Website Settings) 30 | # home_page = "login" 31 | 32 | # website user home page (by Role) 33 | # role_home_page = { 34 | # "Role": "home_page" 35 | # } 36 | 37 | # Generators 38 | # ---------- 39 | 40 | # automatically create page for each record of this doctype 41 | # website_generators = ["Web Page"] 42 | 43 | # Installation 44 | # ------------ 45 | 46 | # before_install = "paypal_integration.install.before_install" 47 | # after_install = "paypal_integration.install.after_install" 48 | 49 | # Desk Notifications 50 | # ------------------ 51 | # See frappe.core.notifications.get_notification_config 52 | 53 | # notification_config = "paypal_integration.notifications.get_notification_config" 54 | 55 | # Permissions 56 | # ----------- 57 | # Permissions evaluated in scripted ways 58 | 59 | # permission_query_conditions = { 60 | # "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions", 61 | # } 62 | # 63 | # has_permission = { 64 | # "Event": "frappe.desk.doctype.event.event.has_permission", 65 | # } 66 | 67 | # Document Events 68 | # --------------- 69 | # Hook on document methods and events 70 | 71 | doc_events = { 72 | "Payment Request": { 73 | "validate": "paypal_integration.express_checkout.validate_paypal_credentials", 74 | "get_payment_url": "paypal_integration.utils.get_payment_url" 75 | }, 76 | "Shopping Cart Settings": { 77 | "validate": "paypal_integration.utils.validate_price_list_currency" 78 | } 79 | } 80 | 81 | # Scheduled Tasks 82 | # --------------- 83 | 84 | # scheduler_events = { 85 | # "all": [ 86 | # "paypal_integration.tasks.all" 87 | # ], 88 | # "daily": [ 89 | # "paypal_integration.tasks.daily" 90 | # ], 91 | # "hourly": [ 92 | # "paypal_integration.tasks.hourly" 93 | # ], 94 | # "weekly": [ 95 | # "paypal_integration.tasks.weekly" 96 | # ] 97 | # "monthly": [ 98 | # "paypal_integration.tasks.monthly" 99 | # ] 100 | # } 101 | 102 | # Testing 103 | # ------- 104 | 105 | # before_tests = "paypal_integration.install.before_tests" 106 | 107 | # Overriding Whitelisted Methods 108 | # ------------------------------ 109 | # 110 | # override_whitelisted_methods = { 111 | # "frappe.desk.doctype.event.event.get_events": "paypal_integration.event.get_events" 112 | # } 113 | 114 | -------------------------------------------------------------------------------- /paypal_integration/modules.txt: -------------------------------------------------------------------------------- 1 | Paypal Integration -------------------------------------------------------------------------------- /paypal_integration/patches.txt: -------------------------------------------------------------------------------- 1 | paypal_integration.patches.redo_install 2 | -------------------------------------------------------------------------------- /paypal_integration/patches/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/patches/__init__.py -------------------------------------------------------------------------------- /paypal_integration/patches/redo_install.py: -------------------------------------------------------------------------------- 1 | import frappe 2 | 3 | def execute(): 4 | # should create payment gateway and payment gateway account 5 | try: 6 | frappe.get_doc("PayPal Settings").save() 7 | except frappe.MandatoryError: 8 | pass 9 | -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/paypal_integration/__init__.py -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/paypal_integration/doctype/__init__.py -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_express_payment/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/paypal_integration/doctype/paypal_express_payment/__init__.py -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_express_payment/paypal_express_payment.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016, Frappe and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Paypal Express Payment', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_express_payment/paypal_express_payment.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_import": 0, 4 | "allow_rename": 0, 5 | "autoname": "field:token", 6 | "creation": "2015-04-22 06:42:23.470610", 7 | "custom": 0, 8 | "docstatus": 0, 9 | "doctype": "DocType", 10 | "document_type": "Document", 11 | "fields": [ 12 | { 13 | "allow_on_submit": 0, 14 | "bold": 0, 15 | "collapsible": 0, 16 | "fieldname": "token", 17 | "fieldtype": "Data", 18 | "hidden": 0, 19 | "ignore_user_permissions": 0, 20 | "ignore_xss_filter": 0, 21 | "in_filter": 0, 22 | "in_list_view": 0, 23 | "label": "Token", 24 | "length": 0, 25 | "no_copy": 0, 26 | "permlevel": 0, 27 | "precision": "", 28 | "print_hide": 0, 29 | "print_hide_if_no_value": 0, 30 | "read_only": 0, 31 | "report_hide": 0, 32 | "reqd": 1, 33 | "search_index": 0, 34 | "set_only_once": 0, 35 | "unique": 0 36 | }, 37 | { 38 | "allow_on_submit": 0, 39 | "bold": 0, 40 | "collapsible": 0, 41 | "fieldname": "status", 42 | "fieldtype": "Select", 43 | "hidden": 0, 44 | "ignore_user_permissions": 0, 45 | "ignore_xss_filter": 0, 46 | "in_filter": 0, 47 | "in_list_view": 0, 48 | "label": "Status", 49 | "length": 0, 50 | "no_copy": 0, 51 | "options": "Started\nVerified\nCancelled\nConfirmed\nCompleted\nFailed", 52 | "permlevel": 0, 53 | "precision": "", 54 | "print_hide": 0, 55 | "print_hide_if_no_value": 0, 56 | "read_only": 1, 57 | "report_hide": 0, 58 | "reqd": 0, 59 | "search_index": 0, 60 | "set_only_once": 0, 61 | "unique": 0 62 | }, 63 | { 64 | "allow_on_submit": 0, 65 | "bold": 0, 66 | "collapsible": 0, 67 | "fieldname": "currency", 68 | "fieldtype": "Link", 69 | "hidden": 0, 70 | "ignore_user_permissions": 0, 71 | "ignore_xss_filter": 0, 72 | "in_filter": 0, 73 | "in_list_view": 0, 74 | "label": "Currency", 75 | "length": 0, 76 | "no_copy": 0, 77 | "options": "Currency", 78 | "permlevel": 0, 79 | "precision": "", 80 | "print_hide": 0, 81 | "print_hide_if_no_value": 0, 82 | "read_only": 1, 83 | "report_hide": 0, 84 | "reqd": 0, 85 | "search_index": 0, 86 | "set_only_once": 0, 87 | "unique": 0 88 | }, 89 | { 90 | "allow_on_submit": 0, 91 | "bold": 0, 92 | "collapsible": 0, 93 | "fieldname": "amount", 94 | "fieldtype": "Currency", 95 | "hidden": 0, 96 | "ignore_user_permissions": 0, 97 | "ignore_xss_filter": 0, 98 | "in_filter": 0, 99 | "in_list_view": 0, 100 | "label": "Amount", 101 | "length": 0, 102 | "no_copy": 0, 103 | "options": "currency", 104 | "permlevel": 0, 105 | "precision": "", 106 | "print_hide": 0, 107 | "print_hide_if_no_value": 0, 108 | "read_only": 1, 109 | "report_hide": 0, 110 | "reqd": 0, 111 | "search_index": 0, 112 | "set_only_once": 0, 113 | "unique": 0 114 | }, 115 | { 116 | "allow_on_submit": 0, 117 | "bold": 0, 118 | "collapsible": 0, 119 | "fieldname": "data", 120 | "fieldtype": "Code", 121 | "hidden": 0, 122 | "ignore_user_permissions": 0, 123 | "ignore_xss_filter": 0, 124 | "in_filter": 0, 125 | "in_list_view": 0, 126 | "label": "Data", 127 | "length": 0, 128 | "no_copy": 0, 129 | "permlevel": 0, 130 | "precision": "", 131 | "print_hide": 0, 132 | "print_hide_if_no_value": 0, 133 | "read_only": 1, 134 | "report_hide": 0, 135 | "reqd": 0, 136 | "search_index": 0, 137 | "set_only_once": 0, 138 | "unique": 0 139 | }, 140 | { 141 | "allow_on_submit": 0, 142 | "bold": 0, 143 | "collapsible": 0, 144 | "fieldname": "transaction_id", 145 | "fieldtype": "Data", 146 | "hidden": 0, 147 | "ignore_user_permissions": 0, 148 | "ignore_xss_filter": 0, 149 | "in_filter": 0, 150 | "in_list_view": 0, 151 | "label": "Transaction Id", 152 | "length": 0, 153 | "no_copy": 0, 154 | "permlevel": 0, 155 | "precision": "", 156 | "print_hide": 0, 157 | "print_hide_if_no_value": 0, 158 | "read_only": 1, 159 | "report_hide": 0, 160 | "reqd": 0, 161 | "search_index": 0, 162 | "set_only_once": 0, 163 | "unique": 0 164 | }, 165 | { 166 | "allow_on_submit": 0, 167 | "bold": 0, 168 | "collapsible": 0, 169 | "fieldname": "correlation_id", 170 | "fieldtype": "Data", 171 | "hidden": 0, 172 | "ignore_user_permissions": 0, 173 | "ignore_xss_filter": 0, 174 | "in_filter": 0, 175 | "in_list_view": 0, 176 | "label": "Correlation Id", 177 | "length": 0, 178 | "no_copy": 0, 179 | "permlevel": 0, 180 | "precision": "", 181 | "print_hide": 0, 182 | "print_hide_if_no_value": 0, 183 | "read_only": 1, 184 | "report_hide": 0, 185 | "reqd": 0, 186 | "search_index": 0, 187 | "set_only_once": 0, 188 | "unique": 0 189 | }, 190 | { 191 | "allow_on_submit": 0, 192 | "bold": 0, 193 | "collapsible": 0, 194 | "fieldname": "payer_email", 195 | "fieldtype": "Data", 196 | "hidden": 0, 197 | "ignore_user_permissions": 0, 198 | "ignore_xss_filter": 0, 199 | "in_filter": 0, 200 | "in_list_view": 0, 201 | "label": "Payer Email", 202 | "length": 0, 203 | "no_copy": 0, 204 | "options": "Email", 205 | "permlevel": 0, 206 | "precision": "", 207 | "print_hide": 0, 208 | "print_hide_if_no_value": 0, 209 | "read_only": 1, 210 | "report_hide": 0, 211 | "reqd": 0, 212 | "search_index": 0, 213 | "set_only_once": 0, 214 | "unique": 0 215 | }, 216 | { 217 | "allow_on_submit": 0, 218 | "bold": 0, 219 | "collapsible": 0, 220 | "fieldname": "payerid", 221 | "fieldtype": "Data", 222 | "hidden": 0, 223 | "ignore_user_permissions": 0, 224 | "ignore_xss_filter": 0, 225 | "in_filter": 0, 226 | "in_list_view": 0, 227 | "label": "PayerID", 228 | "length": 0, 229 | "no_copy": 0, 230 | "permlevel": 0, 231 | "precision": "", 232 | "print_hide": 0, 233 | "print_hide_if_no_value": 0, 234 | "read_only": 1, 235 | "report_hide": 0, 236 | "reqd": 0, 237 | "search_index": 0, 238 | "set_only_once": 0, 239 | "unique": 0 240 | }, 241 | { 242 | "allow_on_submit": 0, 243 | "bold": 0, 244 | "collapsible": 0, 245 | "fieldname": "reference_doctype", 246 | "fieldtype": "Link", 247 | "hidden": 0, 248 | "ignore_user_permissions": 0, 249 | "ignore_xss_filter": 0, 250 | "in_filter": 0, 251 | "in_list_view": 0, 252 | "label": "Reference Doctype", 253 | "length": 0, 254 | "no_copy": 0, 255 | "options": "DocType", 256 | "permlevel": 0, 257 | "precision": "", 258 | "print_hide": 0, 259 | "print_hide_if_no_value": 0, 260 | "read_only": 1, 261 | "report_hide": 0, 262 | "reqd": 0, 263 | "search_index": 0, 264 | "set_only_once": 0, 265 | "unique": 0 266 | }, 267 | { 268 | "allow_on_submit": 0, 269 | "bold": 0, 270 | "collapsible": 0, 271 | "fieldname": "reference_docname", 272 | "fieldtype": "Dynamic Link", 273 | "hidden": 0, 274 | "ignore_user_permissions": 0, 275 | "ignore_xss_filter": 0, 276 | "in_filter": 0, 277 | "in_list_view": 0, 278 | "label": "Reference Docname", 279 | "length": 0, 280 | "no_copy": 0, 281 | "options": "reference_doctype", 282 | "permlevel": 0, 283 | "precision": "", 284 | "print_hide": 0, 285 | "print_hide_if_no_value": 0, 286 | "read_only": 1, 287 | "report_hide": 0, 288 | "reqd": 0, 289 | "search_index": 0, 290 | "set_only_once": 0, 291 | "unique": 0 292 | } 293 | ], 294 | "hide_heading": 0, 295 | "hide_toolbar": 0, 296 | "idx": 0, 297 | "in_create": 0, 298 | "in_dialog": 0, 299 | "is_submittable": 0, 300 | "issingle": 0, 301 | "istable": 0, 302 | "max_attachments": 0, 303 | "modified": "2016-03-18 03:06:22.191998", 304 | "modified_by": "Administrator", 305 | "module": "Paypal Integration", 306 | "name": "Paypal Express Payment", 307 | "name_case": "", 308 | "owner": "Administrator", 309 | "permissions": [ 310 | { 311 | "amend": 0, 312 | "apply_user_permissions": 0, 313 | "cancel": 0, 314 | "create": 1, 315 | "delete": 1, 316 | "email": 1, 317 | "export": 1, 318 | "if_owner": 0, 319 | "import": 0, 320 | "permlevel": 0, 321 | "print": 1, 322 | "read": 1, 323 | "report": 1, 324 | "role": "System Manager", 325 | "set_user_permissions": 0, 326 | "share": 1, 327 | "submit": 0, 328 | "write": 1 329 | } 330 | ], 331 | "read_only": 0, 332 | "read_only_onload": 0, 333 | "sort_field": "modified", 334 | "sort_order": "DESC" 335 | } 336 | -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_express_payment/paypal_express_payment.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) 2015, Frappe and contributors 3 | # For license information, please see license.txt 4 | 5 | from __future__ import unicode_literals 6 | import frappe 7 | from frappe.model.document import Document 8 | from paypal_integration.express_checkout import set_redirect 9 | 10 | class PaypalExpressPayment(Document): 11 | def on_update(self): 12 | set_redirect(self) 13 | -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_express_payment/test_paypal_express_payment.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) 2015, Frappe and Contributors 3 | # See license.txt 4 | from __future__ import unicode_literals 5 | 6 | import frappe 7 | import unittest 8 | 9 | # test_records = frappe.get_test_records('Paypal Express Payment') 10 | 11 | class TestPaypalExpressPayment(unittest.TestCase): 12 | pass 13 | -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_log/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/paypal_integration/doctype/paypal_log/__init__.py -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_log/paypal_log.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016, Frappe and contributors 2 | // For license information, please see license.txt 3 | 4 | frappe.ui.form.on('Paypal Log', { 5 | refresh: function(frm) { 6 | 7 | } 8 | }); 9 | -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_log/paypal_log.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_import": 0, 4 | "allow_rename": 0, 5 | "creation": "2016-03-18 03:30:53.377572", 6 | "custom": 0, 7 | "docstatus": 0, 8 | "doctype": "DocType", 9 | "document_type": "", 10 | "fields": [ 11 | { 12 | "allow_on_submit": 0, 13 | "bold": 0, 14 | "collapsible": 0, 15 | "fieldname": "error", 16 | "fieldtype": "Code", 17 | "hidden": 0, 18 | "ignore_user_permissions": 0, 19 | "ignore_xss_filter": 0, 20 | "in_filter": 0, 21 | "in_list_view": 0, 22 | "label": "Error", 23 | "length": 0, 24 | "no_copy": 0, 25 | "permlevel": 0, 26 | "precision": "", 27 | "print_hide": 0, 28 | "print_hide_if_no_value": 0, 29 | "read_only": 1, 30 | "report_hide": 0, 31 | "reqd": 0, 32 | "search_index": 0, 33 | "set_only_once": 0, 34 | "unique": 0 35 | }, 36 | { 37 | "allow_on_submit": 0, 38 | "bold": 0, 39 | "collapsible": 0, 40 | "fieldname": "params", 41 | "fieldtype": "Code", 42 | "hidden": 0, 43 | "ignore_user_permissions": 0, 44 | "ignore_xss_filter": 0, 45 | "in_filter": 0, 46 | "in_list_view": 0, 47 | "label": "Params", 48 | "length": 0, 49 | "no_copy": 0, 50 | "permlevel": 0, 51 | "precision": "", 52 | "print_hide": 0, 53 | "print_hide_if_no_value": 0, 54 | "read_only": 1, 55 | "report_hide": 0, 56 | "reqd": 0, 57 | "search_index": 0, 58 | "set_only_once": 0, 59 | "unique": 0 60 | } 61 | ], 62 | "hide_heading": 0, 63 | "hide_toolbar": 0, 64 | "idx": 0, 65 | "in_create": 1, 66 | "in_dialog": 0, 67 | "is_submittable": 0, 68 | "issingle": 0, 69 | "istable": 0, 70 | "max_attachments": 0, 71 | "modified": "2016-03-18 06:20:21.067946", 72 | "modified_by": "Administrator", 73 | "module": "Paypal Integration", 74 | "name": "Paypal Log", 75 | "name_case": "", 76 | "owner": "Administrator", 77 | "permissions": [ 78 | { 79 | "amend": 0, 80 | "apply_user_permissions": 0, 81 | "cancel": 0, 82 | "create": 1, 83 | "delete": 1, 84 | "email": 1, 85 | "export": 1, 86 | "if_owner": 0, 87 | "import": 0, 88 | "permlevel": 0, 89 | "print": 1, 90 | "read": 1, 91 | "report": 1, 92 | "role": "System Manager", 93 | "set_user_permissions": 0, 94 | "share": 1, 95 | "submit": 0, 96 | "write": 1 97 | } 98 | ], 99 | "read_only": 0, 100 | "read_only_onload": 0, 101 | "sort_field": "modified", 102 | "sort_order": "DESC" 103 | } -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_log/paypal_log.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) 2015, Frappe and contributors 3 | # For license information, please see license.txt 4 | 5 | from __future__ import unicode_literals 6 | import frappe 7 | from frappe.model.document import Document 8 | 9 | class PaypalLog(Document): 10 | pass 11 | -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_log/test_paypal_log.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) 2015, Frappe and Contributors 3 | # See license.txt 4 | from __future__ import unicode_literals 5 | 6 | import frappe 7 | import unittest 8 | 9 | # test_records = frappe.get_test_records('PayPal Log') 10 | 11 | class TestPayPalLog(unittest.TestCase): 12 | pass 13 | -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_settings/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/paypal_integration/doctype/paypal_settings/__init__.py -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_settings/paypal_settings.js: -------------------------------------------------------------------------------- 1 | frappe.ui.form.on("PayPal Settings", { 2 | refresh: function(frm) { 3 | frm.add_custom_button(__("Paypal Logs"), function() { 4 | frappe.set_route("List", "PayPal Log"); 5 | }) 6 | frm.add_custom_button(__("Payment Logs"), function() { 7 | frappe.set_route("List", "Paypal Express Payment"); 8 | }); 9 | frm.add_custom_button(__("Payment Gateway Accounts"), function() { 10 | frappe.route_options = {"payment_gateway": "PayPal"}; 11 | frappe.set_route("List", "Payment Gateway Account"); 12 | }); 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_settings/paypal_settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "allow_copy": 0, 3 | "allow_import": 0, 4 | "allow_rename": 0, 5 | "creation": "2015-12-17 19:41:03.751137", 6 | "custom": 0, 7 | "docstatus": 0, 8 | "doctype": "DocType", 9 | "document_type": "Setup", 10 | "fields": [ 11 | { 12 | "allow_on_submit": 0, 13 | "bold": 0, 14 | "collapsible": 0, 15 | "fieldname": "api_username", 16 | "fieldtype": "Data", 17 | "hidden": 0, 18 | "ignore_user_permissions": 0, 19 | "ignore_xss_filter": 0, 20 | "in_filter": 0, 21 | "in_list_view": 0, 22 | "label": "API Username", 23 | "length": 0, 24 | "no_copy": 0, 25 | "permlevel": 0, 26 | "precision": "", 27 | "print_hide": 0, 28 | "print_hide_if_no_value": 0, 29 | "read_only": 0, 30 | "report_hide": 0, 31 | "reqd": 1, 32 | "search_index": 0, 33 | "set_only_once": 0, 34 | "unique": 0 35 | }, 36 | { 37 | "allow_on_submit": 0, 38 | "bold": 0, 39 | "collapsible": 0, 40 | "fieldname": "api_password", 41 | "fieldtype": "Data", 42 | "hidden": 0, 43 | "ignore_user_permissions": 0, 44 | "ignore_xss_filter": 0, 45 | "in_filter": 0, 46 | "in_list_view": 0, 47 | "label": "API Password", 48 | "length": 0, 49 | "no_copy": 0, 50 | "permlevel": 0, 51 | "precision": "", 52 | "print_hide": 0, 53 | "print_hide_if_no_value": 0, 54 | "read_only": 0, 55 | "report_hide": 0, 56 | "reqd": 1, 57 | "search_index": 0, 58 | "set_only_once": 0, 59 | "unique": 0 60 | }, 61 | { 62 | "allow_on_submit": 0, 63 | "bold": 0, 64 | "collapsible": 0, 65 | "fieldname": "signature", 66 | "fieldtype": "Data", 67 | "hidden": 0, 68 | "ignore_user_permissions": 0, 69 | "ignore_xss_filter": 0, 70 | "in_filter": 0, 71 | "in_list_view": 0, 72 | "label": "Signature", 73 | "length": 0, 74 | "no_copy": 0, 75 | "permlevel": 0, 76 | "precision": "", 77 | "print_hide": 0, 78 | "print_hide_if_no_value": 0, 79 | "read_only": 0, 80 | "report_hide": 0, 81 | "reqd": 1, 82 | "search_index": 0, 83 | "set_only_once": 0, 84 | "unique": 0 85 | }, 86 | { 87 | "allow_on_submit": 0, 88 | "bold": 0, 89 | "collapsible": 0, 90 | "description": "Check this if you are testing your payment using the Sandbox API", 91 | "fieldname": "paypal_sandbox", 92 | "fieldtype": "Check", 93 | "hidden": 0, 94 | "ignore_user_permissions": 0, 95 | "ignore_xss_filter": 0, 96 | "in_filter": 0, 97 | "in_list_view": 0, 98 | "label": "Use Sandbox", 99 | "length": 0, 100 | "no_copy": 0, 101 | "permlevel": 0, 102 | "precision": "", 103 | "print_hide": 0, 104 | "print_hide_if_no_value": 0, 105 | "read_only": 0, 106 | "report_hide": 0, 107 | "reqd": 0, 108 | "search_index": 0, 109 | "set_only_once": 0, 110 | "unique": 0 111 | }, 112 | { 113 | "allow_on_submit": 0, 114 | "bold": 0, 115 | "collapsible": 0, 116 | "fieldname": "column_break_5", 117 | "fieldtype": "Column Break", 118 | "hidden": 0, 119 | "ignore_user_permissions": 0, 120 | "ignore_xss_filter": 0, 121 | "in_filter": 0, 122 | "in_list_view": 0, 123 | "length": 0, 124 | "no_copy": 0, 125 | "permlevel": 0, 126 | "precision": "", 127 | "print_hide": 0, 128 | "print_hide_if_no_value": 0, 129 | "read_only": 0, 130 | "report_hide": 0, 131 | "reqd": 0, 132 | "search_index": 0, 133 | "set_only_once": 0, 134 | "unique": 0 135 | }, 136 | { 137 | "allow_on_submit": 0, 138 | "bold": 0, 139 | "collapsible": 0, 140 | "fieldname": "html_6", 141 | "fieldtype": "HTML", 142 | "hidden": 0, 143 | "ignore_user_permissions": 0, 144 | "ignore_xss_filter": 0, 145 | "in_filter": 0, 146 | "in_list_view": 0, 147 | "length": 0, 148 | "no_copy": 0, 149 | "options": "
\nFor details on how to get your API credentials, follow this link: https://developer.paypal.com/docs/classic/api/apiCredentials/\n
", 150 | "permlevel": 0, 151 | "precision": "", 152 | "print_hide": 0, 153 | "print_hide_if_no_value": 0, 154 | "read_only": 0, 155 | "report_hide": 0, 156 | "reqd": 0, 157 | "search_index": 0, 158 | "set_only_once": 0, 159 | "unique": 0 160 | } 161 | ], 162 | "hide_heading": 0, 163 | "hide_toolbar": 0, 164 | "idx": 0, 165 | "in_create": 0, 166 | "in_dialog": 0, 167 | "is_submittable": 0, 168 | "issingle": 1, 169 | "istable": 0, 170 | "max_attachments": 0, 171 | "modified": "2016-03-23 12:28:28.760242", 172 | "modified_by": "anand@erpnext.com", 173 | "module": "Paypal Integration", 174 | "name": "PayPal Settings", 175 | "name_case": "", 176 | "owner": "Administrator", 177 | "permissions": [ 178 | { 179 | "amend": 0, 180 | "apply_user_permissions": 0, 181 | "cancel": 0, 182 | "create": 1, 183 | "delete": 1, 184 | "email": 1, 185 | "export": 0, 186 | "if_owner": 0, 187 | "import": 0, 188 | "permlevel": 0, 189 | "print": 1, 190 | "read": 1, 191 | "report": 0, 192 | "role": "System Manager", 193 | "set_user_permissions": 0, 194 | "share": 1, 195 | "submit": 0, 196 | "write": 1 197 | } 198 | ], 199 | "read_only": 0, 200 | "read_only_onload": 0, 201 | "sort_field": "modified", 202 | "sort_order": "DESC" 203 | } -------------------------------------------------------------------------------- /paypal_integration/paypal_integration/doctype/paypal_settings/paypal_settings.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | # Copyright (c) 2015, Frappe and contributors 3 | # For license information, please see license.txt 4 | 5 | from __future__ import unicode_literals 6 | import frappe 7 | from frappe import _ 8 | from frappe.model.document import Document 9 | from paypal_integration.express_checkout import validate_paypal_credentials 10 | 11 | class PayPalSettings(Document): 12 | def validate(self): 13 | if self.get("__islocal"): 14 | self.validate_paypal_credentials() 15 | 16 | def validate_paypal_credentials(self): 17 | validate_paypal_credentials(self, "validate_paypal_credentials") 18 | 19 | def on_update(self): 20 | create_payment_gateway_and_account() 21 | 22 | 23 | def create_payment_gateway_and_account(): 24 | """If ERPNext is installed, create Payment Gateway and Payment Gateway Account""" 25 | if "erpnext" not in frappe.get_installed_apps(): 26 | return 27 | 28 | create_payment_gateway() 29 | create_payment_gateway_account() 30 | 31 | def create_payment_gateway(): 32 | # NOTE: we don't translate Payment Gateway name because it is an internal doctype 33 | if not frappe.db.exists("Payment Gateway", "PayPal"): 34 | payment_gateway = frappe.get_doc({ 35 | "doctype": "Payment Gateway", 36 | "gateway": "PayPal" 37 | }) 38 | payment_gateway.insert(ignore_permissions=True) 39 | 40 | def create_payment_gateway_account(): 41 | from erpnext.setup.setup_wizard.setup_wizard import create_bank_account 42 | 43 | company = frappe.db.get_value("Global Defaults", None, "default_company") 44 | if not company: 45 | return 46 | 47 | # NOTE: we translate Payment Gateway account name because that is going to be used by the end user 48 | bank_account = frappe.db.get_value("Account", {"account_name": _("PayPal"), "company": company}, 49 | ["name", 'account_currency'], as_dict=1) 50 | 51 | if not bank_account: 52 | # check for untranslated one 53 | bank_account = frappe.db.get_value("Account", {"account_name": "PayPal", "company": company}, 54 | ["name", 'account_currency'], as_dict=1) 55 | 56 | if not bank_account: 57 | # try creating one 58 | bank_account = create_bank_account({"company_name": company, "bank_account": _("PayPal")}) 59 | 60 | if not bank_account: 61 | frappe.msgprint(_("Payment Gateway Account not created, please create one manually.")) 62 | return 63 | 64 | # if payment gateway account exists, return 65 | if frappe.db.exists("Payment Gateway Account", 66 | {"payment_gateway": "PayPal", "currency": bank_account.account_currency}): 67 | return 68 | 69 | try: 70 | frappe.get_doc({ 71 | "doctype": "Payment Gateway Account", 72 | "is_default": 1, 73 | "payment_gateway": "PayPal", 74 | "payment_account": bank_account.name, 75 | "currency": bank_account.account_currency 76 | }).insert(ignore_permissions=True) 77 | 78 | except frappe.DuplicateEntryError: 79 | # already exists, due to a reinstall? 80 | pass 81 | -------------------------------------------------------------------------------- /paypal_integration/templates/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/templates/__init__.py -------------------------------------------------------------------------------- /paypal_integration/templates/generators/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/templates/generators/__init__.py -------------------------------------------------------------------------------- /paypal_integration/templates/pages/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frappe/paypal_integration/eea29c109ee74c63b576cb5951c642e76f8409a9/paypal_integration/templates/pages/__init__.py -------------------------------------------------------------------------------- /paypal_integration/templates/pages/paypal-express-cancel.html: -------------------------------------------------------------------------------- 1 | {% extends "templates/web.html" %} 2 | 3 | {% block title %}Make Payment{% endblock %} 4 | 5 | {%- block header -%} 6 |

Payment Cancelled

7 | {% endblock %} 8 | 9 | {%- block page_content -%} 10 |

You have cancelled your payment.

11 |


Back to home page

12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /paypal_integration/templates/pages/paypal-express-confirm.html: -------------------------------------------------------------------------------- 1 | {% extends "templates/web.html" %} 2 | 3 | {% block title %}Confirm Payment{% endblock %} 4 | 5 | {%- block header -%} 6 |

Confirm Payment

7 | {% endblock %} 8 | 9 | {%- block page_content -%} 10 |

Click on confirm to complete your payment.

11 |

12 | Confirm 14 |

15 |
16 |

Account Details

17 |
18 | {% if data.confirm_values %} 19 | 20 | 21 | {% for item in data.confirm_values %} 22 | 23 | 26 | 29 | 30 | {% endfor %} 31 | 32 |
24 | {{ item.label }} 25 | 27 | {{ item.value }} 28 |
33 | {% endif %} 34 |
35 | 36 | {% endblock %} 37 | -------------------------------------------------------------------------------- /paypal_integration/templates/pages/paypal-express-failed.html: -------------------------------------------------------------------------------- 1 | {% extends "templates/web.html" %} 2 | 3 | {% block title %}Payment Failed{% endblock %} 4 | 5 | {%- block header -%} 6 |

Payment Failed

7 | {% endblock %} 8 | 9 | {%- block page_content -%} 10 |

Your payment has failed. Do you mind trying again?

11 |

Back to Home

12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /paypal_integration/templates/pages/paypal-express-success.html: -------------------------------------------------------------------------------- 1 | {% extends "templates/web.html" %} 2 | 3 | {% block title %}Payment Success{% endblock %} 4 | 5 | {%- block header -%} 6 |

Payment Success

7 | {% endblock %} 8 | 9 | {%- block page_content -%} 10 |

Your payment has succeeded.

11 |

Back to Home

12 | {% endblock %} 13 | -------------------------------------------------------------------------------- /paypal_integration/templates/pages/paypal_express_cancel.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | from __future__ import unicode_literals 5 | import frappe 6 | 7 | def get_context(context): 8 | token = frappe.local.form_dict.token 9 | 10 | if token: 11 | paypal_express_payment = frappe.get_doc("Paypal Express Payment", token) 12 | paypal_express_payment.status = "Cancelled" 13 | paypal_express_payment.flags.status_changed_to = "Cancelled" 14 | paypal_express_payment.save(ignore_permissions=True) 15 | frappe.db.commit() 16 | -------------------------------------------------------------------------------- /paypal_integration/templates/pages/paypal_express_confirm.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | from __future__ import unicode_literals 5 | 6 | import frappe, json 7 | 8 | no_cache = True 9 | 10 | def get_context(context): 11 | token = frappe.local.form_dict.token 12 | 13 | if token: 14 | paypal_express_payment = frappe.get_doc("Paypal Express Payment", token) 15 | paypal_express_payment.status = "Verified" 16 | paypal_express_payment.save(ignore_permissions=True) 17 | frappe.db.commit() 18 | 19 | context.token = token 20 | context.data = json.loads(paypal_express_payment.data or "{}") 21 | -------------------------------------------------------------------------------- /paypal_integration/templates/pages/paypal_express_success.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors 2 | # See license.txt 3 | 4 | from __future__ import unicode_literals 5 | 6 | import frappe 7 | 8 | def get_context(context): 9 | token = frappe.local.form_dict.token 10 | -------------------------------------------------------------------------------- /paypal_integration/tests.py: -------------------------------------------------------------------------------- 1 | from unittest import TestCase 2 | 3 | from . import express_checkout 4 | import frappe 5 | 6 | class TestExpressCheckout(TestCase): 7 | def test_set_express_checkout(self): 8 | express_checkout.set_express_checkout(100, "USD") 9 | self.assertEqual(frappe.local.response["type"], "redirect") 10 | -------------------------------------------------------------------------------- /paypal_integration/utils.py: -------------------------------------------------------------------------------- 1 | import frappe 2 | from frappe import _ 3 | from .express_checkout import set_express_checkout, validate_transaction_currency 4 | 5 | def get_payment_url(doc, method): 6 | if doc.docstatus == 1: 7 | if doc.payment_gateway == "PayPal": 8 | set_express_checkout(doc.grand_total, doc.currency, {"doctype": doc.doctype, "docname": doc.name}) 9 | else: 10 | frappe.respond_as_web_page(_("Invalid Payment Request"), 11 | _("Payment Request has been canceled by vendor"), success=False, 12 | http_status_code=frappe.ValidationError.http_status_code) 13 | 14 | def validate_price_list_currency(doc, method): 15 | '''Called from Shopping Cart Settings hook''' 16 | if doc.enabled and doc.enable_checkout: 17 | if not doc.payment_gateway_account: 18 | doc.enable_checkout = 0 19 | return 20 | 21 | payment_gateway_account = frappe.get_doc("Payment Gateway Account", doc.payment_gateway_account) 22 | 23 | if payment_gateway_account.payment_gateway=="PayPal": 24 | price_list_currency = frappe.db.get_value("Price List", doc.price_list, "currency") 25 | 26 | validate_transaction_currency(price_list_currency) 27 | 28 | if price_list_currency != payment_gateway_account.currency: 29 | frappe.throw(_("Currency '{0}' of Price List '{1}' should be same as the Currency '{2}' of Payment Gateway Account '{3}'").format(price_list_currency, doc.price_list, payment_gateway_account.currency, payment_gateway_account.name)) 30 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | frappe -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | from setuptools import setup, find_packages 3 | import os 4 | 5 | version = '0.0.1' 6 | 7 | setup( 8 | name='paypal_integration', 9 | version=version, 10 | description='Paypal Payment Gateway Integration', 11 | author='Frappe', 12 | author_email='info@frappe.io', 13 | packages=find_packages(), 14 | zip_safe=False, 15 | include_package_data=True, 16 | install_requires=("frappe",), 17 | ) 18 | -------------------------------------------------------------------------------- /test_sites/apps.txt: -------------------------------------------------------------------------------- 1 | erpnext 2 | paypal_integration 3 | -------------------------------------------------------------------------------- /test_sites/languages.txt: -------------------------------------------------------------------------------- 1 | en english -------------------------------------------------------------------------------- /test_sites/test_site/site_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "db_name": "test_frappe", 3 | "db_password": "test_frappe", 4 | "auto_email_id": "test@example.com", 5 | "mail_server": "smtp.example.com", 6 | "mail_login": "test@example.com", 7 | "mail_password": "test", 8 | "admin_password": "admin", 9 | "run_selenium_tests": 1, 10 | "host_name": "http://localhost:8000", 11 | "install_apps": ["erpnext", "paypal_integration"] 12 | } 13 | --------------------------------------------------------------------------------