├── .gitignore
├── MANIFEST.in
├── README.md
├── bank_api_integration
├── __init__.py
├── bank_api_integration
│ ├── __init__.py
│ ├── custom
│ │ └── js
│ │ │ ├── purchase_invoice.js
│ │ │ └── purchase_order.js
│ ├── doctype
│ │ ├── __init__.py
│ │ ├── bank_api_integration
│ │ │ ├── __init__.py
│ │ │ ├── bank_api_integration.js
│ │ │ ├── bank_api_integration.json
│ │ │ ├── bank_api_integration.py
│ │ │ └── test_bank_api_integration.py
│ │ ├── bank_api_request_log
│ │ │ ├── __init__.py
│ │ │ ├── bank_api_request_log.js
│ │ │ ├── bank_api_request_log.json
│ │ │ ├── bank_api_request_log.py
│ │ │ └── test_bank_api_request_log.py
│ │ ├── bulk_outward_bank_payment
│ │ │ ├── __init__.py
│ │ │ ├── bulk_outward_bank_payment.html
│ │ │ ├── bulk_outward_bank_payment.js
│ │ │ ├── bulk_outward_bank_payment.json
│ │ │ ├── bulk_outward_bank_payment.py
│ │ │ └── test_bulk_outward_bank_payment.py
│ │ ├── outward_bank_payment
│ │ │ ├── __init__.py
│ │ │ ├── outward_bank_payment.js
│ │ │ ├── outward_bank_payment.json
│ │ │ ├── outward_bank_payment.py
│ │ │ └── test_outward_bank_payment.py
│ │ ├── outward_bank_payment_details
│ │ │ ├── __init__.py
│ │ │ ├── outward_bank_payment_details.json
│ │ │ └── outward_bank_payment_details.py
│ │ └── payment_references
│ │ │ ├── __init__.py
│ │ │ ├── payment_references.json
│ │ │ └── payment_references.py
│ ├── patches
│ │ └── v1
│ │ │ └── defaults.py
│ └── utils
│ │ └── js
│ │ ├── bank_account.js
│ │ └── common_fields.js
├── config
│ ├── __init__.py
│ ├── desktop.py
│ └── docs.py
├── hooks.py
├── modules.txt
├── patches.txt
└── templates
│ ├── __init__.py
│ └── pages
│ └── __init__.py
├── license.txt
├── requirements.txt
└── setup.py
/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | *.pyc
3 | *.egg-info
4 | *.swp
5 | tags
6 | bank_api_integration/docs/current
--------------------------------------------------------------------------------
/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 bank_api_integration *.css
8 | recursive-include bank_api_integration *.csv
9 | recursive-include bank_api_integration *.html
10 | recursive-include bank_api_integration *.ico
11 | recursive-include bank_api_integration *.js
12 | recursive-include bank_api_integration *.json
13 | recursive-include bank_api_integration *.md
14 | recursive-include bank_api_integration *.png
15 | recursive-include bank_api_integration *.py
16 | recursive-include bank_api_integration *.svg
17 | recursive-include bank_api_integration *.txt
18 | recursive-exclude bank_api_integration *.pyc
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Banking API Integration
2 | Frappe application to achieve banking api integration.
3 |
4 | Reach us out at hello@aerele.in to connect with our team.
5 |
6 | #### License
7 |
8 | GNU/General Public License (v3) (see [license.txt](license.txt))
9 |
10 | The Banking API Integration code is licensed as GNU General Public License (v3) and the copyright is owned by Aerele Technologies Pvt Ltd (Aerele) and Contributors.
11 |
12 | Here, OBP means ```Outward bank payment``` and BOBP means ```Bulk outward bank payment```
13 |
14 | ## Installation
15 | Navigate to your bench folder
16 | ```
17 | cd frappe-bench
18 | ```
19 | Install Banking API Integration App
20 | ```
21 | bench get-app bank_api_integration https://github.com/aerele/bank_api_integration.git
22 | bench --site [site-name] install-app bank_api_integration
23 | ```
24 |
25 | ### Roles and it's permissions
26 |
27 | 1. Bank Maker - Able to create OBP and BOBP records.
28 | 2. Bank Checker - Able to approve or reject OBP and BOBP records.
29 |
30 | ### Securities Used
31 |
32 | 1. Password based security
33 | 2. OTP based transaction initiation
34 |
35 | ## Doctypes
36 |
37 | ### Bank API Integration
38 |
39 | 1. Each bank account should be linked to an bank api integration document in order to access various api's provided by the bank.
40 | 2. Enabling password security adds an extra layer of security before initiating a transaction via BOBP and OBP.
41 | 3. The ```Test``` API Provider can be used to test the entire flow. For the ```unique id``` values of various responses, please see the ```get_transaction_status``` function in the [Test API provider implementation](https://github.com/aerele/bankingapi/blob/master/banking_api/test.py)
42 |
43 | 
44 |
45 | ### Bulk Outward Bank Payment
46 |
47 | 1. Select appropriate options to use this doctype to process bulk payments.
48 | 2. In ```Outward Bank Payment Details```, upload the payment details as a CSV or Excel file.
49 | 3. Once you've saved, you'll see the total number of payments and total payment amount.
50 |
51 | 
52 |
53 | #### Bulk Outward Bank Payment Summary
54 |
55 | 
56 |
57 |
58 | ### Outward Bank Payment
59 |
60 | Select appropriate options to use this doctype to process single payment.
61 |
62 | 
63 |
64 | #### Reject Flow
65 |
66 | While rejecting payment, the user need to enter the reason for rejection
67 |
68 | 
69 |
70 | ####
71 |
72 | After approval of payment, the user needs to enter verification details before initiating the transaction.
73 |
74 | 
75 |
76 |
77 | ### Bank API Request Log
78 |
79 | For every API request, logs will be created automatically.
80 |
81 | 
82 |
83 | ### Site Config JSON Details
84 |
85 | Add the below details to the ```site_config.json``` of the site that has Bank API Integration.
86 | ```
87 | "bank_api_integration": {
88 | "disable_transaction": [],
89 | "enable_otp_based_transaction": "*",
90 | "proxies": {
91 | "ftp": "ftp://112.22.158.85:3001",
92 | "http": "http://112.22.158.85:3001",
93 | "https": "https://112.22.158.85:3001"
94 | }
95 | }
96 | ```
97 |
98 | 1. Disable Transaction - Add "*" if you want to disable transaction for all bank accounts otherwise just include the account number's in a list like ```[123243234324,324324324]```
99 |
100 | 2. Enable OTP Based Transaction - Add "*" if you want to enable otp based transaction for all bank accounts otherwise just include the account number's in a list like ```[123243234324,324324324]```
101 |
102 | 3. Adding proxies will allow making API requests from different IP's.
103 |
104 | ** Note: To reduce the attack surface it is recommended to disable the server script for the site that has Bank API Integration.
105 |
106 | ### Show some ❤️ by starring :star: :arrow_up: our repo!
107 |
--------------------------------------------------------------------------------
/bank_api_integration/__init__.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 |
4 | __version__ = '0.0.1'
5 |
6 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aerele/bank_api_integration/cd87ffb49618512f08c93d0dc297bb1edc220128/bank_api_integration/bank_api_integration/__init__.py
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/custom/js/purchase_invoice.js:
--------------------------------------------------------------------------------
1 | frappe.ui.form.on('Purchase Invoice', {
2 | refresh : function(frm){
3 | if(frm.doc.docstatus == 1 && frm.doc.outstanding_amount != 0
4 | && !(frm.doc.is_return && frm.doc.return_against)) {
5 | // Creating Make Bank Payment Button
6 | frm.add_custom_button(__('Make Bank Payment'), () =>{
7 | frm.trigger("make_bank_payment");
8 | },__('Create'));
9 | }
10 | },
11 | make_bank_payment : function(frm) {
12 | frappe.model.open_mapped_doc({
13 | method: "bank_api_integration.bank_api_integration.doctype.outward_bank_payment.outward_bank_payment.make_bank_payment",
14 | frm: frm
15 | })
16 | },
17 | });
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/custom/js/purchase_order.js:
--------------------------------------------------------------------------------
1 | frappe.ui.form.on('Purchase Order', {
2 | refresh : function(frm){
3 | if(frm.doc.docstatus == 1 && frm.doc.grand_total != 0) {
4 | // Creating Make Bank Payment Button
5 | frm.add_custom_button(__('Make Bank Payment'), () =>{
6 | frm.trigger("make_bank_payment");
7 | },__('Create'));
8 | }
9 | },
10 | make_bank_payment : function(frm) {
11 | frappe.model.open_mapped_doc({
12 | method: "bank_api_integration.bank_api_integration.doctype.outward_bank_payment.outward_bank_payment.bank_payment_for_purchase_order",
13 | frm: frm
14 | })
15 | },
16 | });
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aerele/bank_api_integration/cd87ffb49618512f08c93d0dc297bb1edc220128/bank_api_integration/bank_api_integration/doctype/__init__.py
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bank_api_integration/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aerele/bank_api_integration/cd87ffb49618512f08c93d0dc297bb1edc220128/bank_api_integration/bank_api_integration/doctype/bank_api_integration/__init__.py
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bank_api_integration/bank_api_integration.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021, Aerele and contributors
2 | // For license information, please see license.txt
3 |
4 | frappe.ui.form.on('Bank API Integration', {
5 | onload: function(frm) {
6 | frm.set_query("bank_account", function() {
7 | return {
8 | "filters":{
9 | "is_company_account": 1
10 | },
11 | };
12 | });}
13 | });
14 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bank_api_integration/bank_api_integration.json:
--------------------------------------------------------------------------------
1 | {
2 | "actions": [],
3 | "autoname": "format:{bank_api_provider} - {bank_account}",
4 | "creation": "2021-03-20 12:24:14.241054",
5 | "doctype": "DocType",
6 | "editable_grid": 1,
7 | "engine": "InnoDB",
8 | "field_order": [
9 | "enable",
10 | "bank_api_provider",
11 | "column_break_3",
12 | "use_sandbox",
13 | "unique_id",
14 | "bank_account",
15 | "credentials_section",
16 | "corp_id",
17 | "user_id",
18 | "aggr_id",
19 | "aggr_name",
20 | "urn",
21 | "column_break_4",
22 | "api_key",
23 | "private_key_path",
24 | "icici_public_key",
25 | "transaction_details_section",
26 | "enable_transaction",
27 | "column_break_20",
28 | "enable_password_security",
29 | "transaction_password"
30 | ],
31 | "fields": [
32 | {
33 | "fieldname": "bank_api_provider",
34 | "fieldtype": "Select",
35 | "label": "Bank API Provider",
36 | "mandatory_depends_on": "enable",
37 | "options": "\nTest\nICICI"
38 | },
39 | {
40 | "fieldname": "bank_account",
41 | "fieldtype": "Link",
42 | "in_list_view": 1,
43 | "label": "Bank Account",
44 | "mandatory_depends_on": "enable",
45 | "options": "Bank Account"
46 | },
47 | {
48 | "depends_on": "bank_api_provider",
49 | "fieldname": "credentials_section",
50 | "fieldtype": "Section Break",
51 | "label": "Credentials"
52 | },
53 | {
54 | "depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)",
55 | "fieldname": "api_key",
56 | "fieldtype": "Password",
57 | "label": "API Key",
58 | "mandatory_depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)",
59 | "no_copy": 1
60 | },
61 | {
62 | "fieldname": "column_break_4",
63 | "fieldtype": "Column Break"
64 | },
65 | {
66 | "depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)",
67 | "fieldname": "private_key_path",
68 | "fieldtype": "Password",
69 | "label": "Private Key Path",
70 | "mandatory_depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)",
71 | "no_copy": 1
72 | },
73 | {
74 | "fieldname": "corp_id",
75 | "fieldtype": "Data",
76 | "label": "Corp ID",
77 | "mandatory_depends_on": "bank_api_provider"
78 | },
79 | {
80 | "depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)",
81 | "fieldname": "user_id",
82 | "fieldtype": "Data",
83 | "label": "User ID",
84 | "mandatory_depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)"
85 | },
86 | {
87 | "depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)",
88 | "fieldname": "aggr_id",
89 | "fieldtype": "Data",
90 | "label": "Aggr ID",
91 | "mandatory_depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)"
92 | },
93 | {
94 | "depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)",
95 | "fieldname": "aggr_name",
96 | "fieldtype": "Data",
97 | "label": "Aggr Name",
98 | "mandatory_depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)"
99 | },
100 | {
101 | "depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)",
102 | "fieldname": "urn",
103 | "fieldtype": "Data",
104 | "label": "URN",
105 | "mandatory_depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)"
106 | },
107 | {
108 | "default": "0",
109 | "fieldname": "use_sandbox",
110 | "fieldtype": "Check",
111 | "label": "Use Sandbox",
112 | "mandatory_depends_on": "enable"
113 | },
114 | {
115 | "fieldname": "column_break_3",
116 | "fieldtype": "Column Break"
117 | },
118 | {
119 | "depends_on": "enable_password_security",
120 | "fieldname": "transaction_password",
121 | "fieldtype": "Password",
122 | "label": "Transaction Password",
123 | "mandatory_depends_on": "enable_password_security",
124 | "no_copy": 1
125 | },
126 | {
127 | "default": "1",
128 | "fieldname": "enable",
129 | "fieldtype": "Check",
130 | "label": "Enable"
131 | },
132 | {
133 | "fieldname": "transaction_details_section",
134 | "fieldtype": "Section Break",
135 | "label": "Transaction Details"
136 | },
137 | {
138 | "default": "0",
139 | "fieldname": "enable_transaction",
140 | "fieldtype": "Check",
141 | "label": "Enable Transaction"
142 | },
143 | {
144 | "fieldname": "column_break_20",
145 | "fieldtype": "Column Break"
146 | },
147 | {
148 | "default": "0",
149 | "fieldname": "enable_password_security",
150 | "fieldtype": "Check",
151 | "label": "Enable Password Security"
152 | },
153 | {
154 | "depends_on": "eval:doc.enable == 1 && doc.use_sandbox == 1 && doc.bank_api_provider == 'Test'",
155 | "description": "This id will be used to get a response of transaction status API",
156 | "fieldname": "unique_id",
157 | "fieldtype": "Data",
158 | "label": "Unique ID",
159 | "mandatory_depends_on": "eval: doc.enable == 1 &&doc.use_sandbox == 1 && doc.bank_api_provider == 'Test'"
160 | },
161 | {
162 | "depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)",
163 | "fieldname": "icici_public_key",
164 | "fieldtype": "Attach",
165 | "label": "ICICI Public Key",
166 | "mandatory_depends_on": "eval:in_list([\"ICICI\"], doc.bank_api_provider)"
167 | }
168 | ],
169 | "index_web_pages_for_search": 1,
170 | "links": [],
171 | "modified": "2021-06-16 14:43:02.234132",
172 | "modified_by": "Administrator",
173 | "module": "Bank Api Integration",
174 | "name": "Bank API Integration",
175 | "owner": "Administrator",
176 | "permissions": [
177 | {
178 | "create": 1,
179 | "delete": 1,
180 | "email": 1,
181 | "print": 1,
182 | "read": 1,
183 | "role": "Administrator",
184 | "share": 1,
185 | "write": 1
186 | }
187 | ],
188 | "sort_field": "modified",
189 | "sort_order": "DESC",
190 | "track_changes": 1
191 | }
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bank_api_integration/bank_api_integration.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright (c) 2021, Aerele and contributors
3 | # For license information, please see license.txt
4 |
5 | from __future__ import unicode_literals
6 | import frappe, json
7 | from six import string_types
8 | from frappe import _
9 | from frappe.model.document import Document
10 | from banking_api import CommonProvider
11 | from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
12 | from frappe.permissions import add_permission, update_permission_property
13 | from frappe.core.doctype.version.version import get_diff
14 | from frappe.utils import getdate, now_datetime, get_link_to_form, get_datetime
15 |
16 | class BankAPIIntegration(Document):
17 | pass
18 |
19 | def initiate_transaction_with_otp(docname, otp):
20 | doc = frappe.get_doc('Outward Bank Payment', docname)
21 | workflow_state = None
22 |
23 | res = None
24 | currency = frappe.db.get_value("Company", doc.company, "default_currency")
25 | prov, config = get_api_provider_class(doc.company_bank_account)
26 | filters = {
27 | "CUSTOMERINDUCED": "N",
28 | "REMARKS": doc.remarks,
29 | "OTP": otp,
30 | "UNIQUEID": doc.name,
31 | "IFSC": frappe.db.get_value('Bank Account',
32 | {'party_type': doc.party_type,
33 | 'party': doc.party,
34 | 'is_default': 1
35 | },'ifsc_code'),
36 | "AMOUNT": str(doc.amount),
37 | "CURRENCY": currency,
38 | "TXNTYPE": doc.transaction_type,
39 | "PAYEENAME": doc.party,
40 | "DEBITACC": frappe.db.get_value('Bank Account',
41 | {
42 | 'name': doc.company_bank_account
43 | },'bank_account_no'),
44 | "CREDITACC": frappe.db.get_value('Bank Account',
45 | {'party_type': doc.party_type,
46 | 'party': doc.party,
47 | 'is_default': 1
48 | },'bank_account_no')
49 | }
50 | try:
51 | res = prov.initiate_transaction_with_otp(filters)
52 | if res['status'] == 'SUCCESS' and 'utr_number' in res:
53 | frappe.db.set_value('Outward Bank Payment',{'name':doc.name},'utr_number',res['utr_number'])
54 | frappe.db.set_value(doc.doctype,{'name':doc.name},'is_verified',1)
55 | workflow_state = 'Initiated'
56 | elif res['status'] in ['FAILURE', 'DUPLICATE']:
57 | workflow_state = 'Initiation Failed'
58 | elif 'PENDING' in res['status']:
59 | workflow_state = 'Initiation Pending'
60 | elif res['status'] in ['OTP EXPIRED', 'INVALID OTP']:
61 | workflow_state = None
62 | else:
63 | workflow_state = 'Initiation Error'
64 | except:
65 | workflow_state = 'Initiation Error'
66 | res = frappe.get_traceback()
67 | log_name = log_request(doc.name, 'Initiate Transaction with OTP', filters, config, res)
68 | if not workflow_state:
69 | status = res['status']
70 | frappe.throw(_(f'{status}'))
71 | if workflow_state:
72 | frappe.db.set_value('Outward Bank Payment', {'name': doc.name}, 'workflow_state', workflow_state)
73 | frappe.db.commit()
74 | if workflow_state in ['Initiation Error', 'Initiation Failed']:
75 | if not doc.bobp:
76 | frappe.throw(_(f'An error occurred while making request. Kindly check request log for more info {get_link_to_form("Bank API Request Log", log_name)}'))
77 |
78 | def initiate_transaction_without_otp(docname):
79 | doc = frappe.get_doc('Outward Bank Payment', docname)
80 | workflow_state = None
81 |
82 | res = None
83 | currency = frappe.db.get_value("Company", doc.company, "default_currency")
84 | prov, config = get_api_provider_class(doc.company_bank_account)
85 | filters = {
86 | "REMARKS": doc.remarks,
87 | "UNIQUEID": doc.name,
88 | "IFSC": frappe.db.get_value('Bank Account',
89 | {'party_type': doc.party_type,
90 | 'party': doc.party,
91 | 'is_default': 1
92 | },'ifsc_code'),
93 | "AMOUNT": str(doc.amount),
94 | "CURRENCY": currency,
95 | "TXNTYPE": doc.transaction_type,
96 | "PAYEENAME": doc.party,
97 | "DEBITACC": frappe.db.get_value('Bank Account',
98 | {
99 | 'name': doc.company_bank_account
100 | },'bank_account_no'),
101 | "CREDITACC": frappe.db.get_value('Bank Account',
102 | {'party_type': doc.party_type,
103 | 'party': doc.party,
104 | 'is_default': 1
105 | },'bank_account_no')
106 | }
107 | try:
108 | res = prov.initiate_transaction_without_otp(filters)
109 | if res['status'] == 'SUCCESS' and 'utr_number' in res:
110 | frappe.db.set_value('Outward Bank Payment',{'name':doc.name},'utr_number',res['utr_number'])
111 | frappe.db.set_value(doc.doctype,{'name':doc.name},'is_verified',1)
112 | workflow_state = 'Initiated'
113 | elif res['status'] in ['FAILURE', 'DUPLICATE']:
114 | workflow_state = 'Initiation Failed'
115 | elif 'PENDING' in res['status']:
116 | workflow_state = 'Initiation Pending'
117 | else:
118 | workflow_state = 'Initiation Error'
119 | except:
120 | workflow_state = 'Initiation Error'
121 | res = frappe.get_traceback()
122 | log_name = log_request(doc.name, 'Initiate Transaction without OTP', filters, config, res)
123 | if workflow_state:
124 | frappe.db.set_value('Outward Bank Payment', {'name': doc.name}, 'workflow_state', workflow_state)
125 | frappe.db.commit()
126 | if workflow_state in ['Initiation Error', 'Initiation Failed']:
127 | if not doc.bobp:
128 | frappe.throw(_(f'An error occurred while making request. Kindly check request log for more info {get_link_to_form("Bank API Request Log", log_name)}'))
129 |
130 | @frappe.whitelist()
131 | def send_otp(doctype, docname):
132 | is_otp_sent = False
133 | res = None
134 | doc = frappe.get_doc(doctype, docname)
135 | prov, config = get_api_provider_class(doc.company_bank_account)
136 | if doc.doctype == 'Bulk Outward Bank Payment':
137 | row = vars(doc.outward_bank_payment_details[0])
138 | data = {
139 | 'party_type': row['party_type'],
140 | 'party': row['party'],
141 | 'amount': row['amount'],
142 | 'remarks': doc.remarks,
143 | 'transaction_type': doc.transaction_type,
144 | 'company_bank_account': doc.company_bank_account,
145 | 'reconcile_action': doc.reconcile_action,
146 | 'bobp':doc.name}
147 | if not frappe.db.exists('Outward Bank Payment', data):
148 | data['doctype'] = 'Outward Bank Payment'
149 | obp_doc = frappe.get_doc(data)
150 | obp_doc.save(ignore_permissions=True)
151 | obp_doc.submit()
152 | status = frappe.db.get_value('Outward Bank Payment', obp_doc.name, 'workflow_state')
153 | frappe.db.set_value('Outward Bank Payment Details',{'parent':doc.name,
154 | 'party_type': row['party_type'],
155 | 'party': row['party'],
156 | 'amount': row['amount']},'outward_bank_payment',obp_doc.name)
157 | frappe.db.set_value('Outward Bank Payment Details',{'parent':doc.name,
158 | 'party_type': row['party_type'],
159 | 'party': row['party'],
160 | 'amount': row['amount'],
161 | 'outward_bank_payment':obp_doc.name},'status', status)
162 | doc = obp_doc
163 | filters = {
164 | "UNIQUEID": doc.name,
165 | "AMOUNT": str(doc.amount)
166 | }
167 | try:
168 | res = prov.send_otp(filters)
169 | if res['status'] == 'SUCCESS':
170 | is_otp_sent = True
171 | except:
172 | res = frappe.get_traceback()
173 | log_name = log_request(doc.name,'Send OTP', filters, config, res)
174 | if not is_otp_sent:
175 | retry_count = frappe.db.get_value(doc.doctype, doc.name, 'retry_count')
176 | workflow_state = frappe.db.get_value(doc.doctype, doc.name, 'workflow_state')
177 | if workflow_state == 'Approved' and retry_count == 3:
178 | frappe.db.set_value(doc.doctype, doc.name, 'workflow_state', 'Verification Failed')
179 | return is_otp_sent
180 |
181 | @frappe.whitelist()
182 | def update_transaction_status(obp_name=None,bobp_name=None):
183 | bulk_update = True
184 | if obp_name or bobp_name:
185 | bulk_update = False
186 | if obp_name:
187 | obp_list = [{'name': obp_name}]
188 | if bobp_name:
189 | obp_list = frappe.db.get_all('Outward Bank Payment', {'workflow_state': ['in', ['Initiated','Initiation Pending','Transaction Pending']], 'bobp': ['=', bobp_name]})
190 | if bulk_update:
191 | obp_list = frappe.db.get_all('Outward Bank Payment', {'workflow_state': ['in', ['Initiated','Initiation Pending','Transaction Pending']]})
192 |
193 | failed_obp_list = []
194 | if not obp_list:
195 | frappe.throw(_("No transaction found in the initiated state."))
196 | for doc in obp_list:
197 | res = None
198 | workflow_state = None
199 | obp_doc = frappe.get_doc('Outward Bank Payment', doc['name'])
200 | prov, config = get_api_provider_class(obp_doc.company_bank_account)
201 | unique_id = frappe.db.get_value('Bank API Integration',
202 | {'bank_account': obp_doc.company_bank_account}, 'unique_id')
203 | filters = {"UNIQUEID": obp_doc.name if not unique_id else unique_id}
204 | try:
205 | res = prov.get_transaction_status(filters)
206 | if res['status'] == 'SUCCESS' and 'utr_number' in res:
207 | workflow_state = 'Transaction Completed'
208 | elif res['status'] in ['FAILURE', 'DUPLICATE']:
209 | workflow_state = 'Transaction Failed'
210 | elif 'PENDING' in res['status']:
211 | workflow_state = 'Transaction Pending'
212 | else:
213 | workflow_state = 'Transaction Error'
214 | except:
215 | workflow_state = 'Transaction Error'
216 | res = frappe.get_traceback()
217 |
218 | log_name = log_request(obp_doc.name,'Update Transaction Status', filters, config, res)
219 | obp_doc.workflow_state = workflow_state
220 | obp_doc.save()
221 | if workflow_state in ['Transaction Pending', 'Transaction Error', 'Transaction Failed'] and not bulk_update:
222 | if not obp_doc.bobp:
223 | frappe.throw(_(f'An error occurred while making request. Kindly check request log for more info {get_link_to_form("Bank API Request Log", log_name)}'))
224 | else:
225 | failed_obp_list.append(get_link_to_form("Outward Bank Payment", doc['name']))
226 | if failed_obp_list and not bulk_update:
227 | failed_obp = ','.join(failed_obp_list)
228 | frappe.throw(_(f"Transaction status update failed for the below obp(s) {failed_obp}"))
229 | if bobp_name and not bulk_update:
230 | frappe.msgprint(_("Transaction Status Updated"))
231 |
232 | def get_api_provider_class(company_bank_account):
233 | config = frappe.get_site_config()
234 | proxies = None
235 | if not frappe.db.get_value('Bank API Integration', {'bank_account': company_bank_account, 'enable':1}):
236 | frappe.throw(_(f'Kindly create and enable bank api integration for this bank account {get_link_to_form("Bank Account", company_bank_account)}'))
237 | integration_doc = frappe.get_doc('Bank API Integration', {'bank_account': company_bank_account, 'enable':1})
238 | if 'bank_api_integration' in config:
239 | proxies = config.bank_api_integration['proxies'] \
240 | if 'proxies' in config.bank_api_integration else None
241 | config = {"APIKEY": integration_doc.get_password(fieldname="api_key") if integration_doc.api_key else None,
242 | "CORPID": integration_doc.corp_id,
243 | "USERID": integration_doc.user_id,
244 | "AGGRID":integration_doc.aggr_id,
245 | "AGGRNAME":integration_doc.aggr_name,
246 | "URN": integration_doc.urn}
247 |
248 | file_paths = {'private_key': integration_doc.get_password(fieldname="private_key_path") if integration_doc.private_key_path else None,
249 | 'public_key': frappe.local.site_path + integration_doc.icici_public_key if integration_doc.icici_public_key else None}
250 |
251 | prov = CommonProvider(integration_doc.bank_api_provider, config, integration_doc.use_sandbox, proxies, file_paths, frappe.local.site_path)
252 | return prov, config
253 |
254 | def new_bank_transaction(transaction_list, bank_account):
255 | for transaction in transaction_list:
256 | if not frappe.db.exists("Bank Transaction", dict(transaction_id=transaction["txn_id"])):
257 | new_transaction = frappe.get_doc({
258 | 'doctype': 'Bank Transaction',
259 | 'date': getdate(transaction['txn_date'].split(' ')[0]),
260 | "transaction_id": transaction["txn_id"],
261 | 'withdrawal': abs(float(transaction['debit'].replace(',',''))) if transaction['debit'] else 0,
262 | 'deposit': abs(float(transaction['credit'].replace(',',''))) if transaction['credit'] else 0,
263 | 'description': transaction['remarks'],
264 | 'bank_account': bank_account
265 | })
266 | new_transaction.save()
267 | new_transaction.submit()
268 | return True
269 |
270 | @frappe.whitelist()
271 | def fetch_balance(bank_account = None):
272 | account_list = []
273 |
274 | if not bank_account:
275 | for acc in frappe.db.get_list('Bank Account', {'is_company_account': 1}):
276 | account_list.append(acc['name'])
277 | else:
278 | account_list.append(bank_account)
279 |
280 | for acc in account_list:
281 | prov, config = get_api_provider_class(acc)
282 | filters = {
283 | "ACCOUNTNO": frappe.db.get_value('Bank Account',{'name':acc},'bank_account_no')
284 | }
285 | try:
286 | res = prov.fetch_balance(filters)
287 | doc = frappe.get_doc('Bank Account', acc)
288 | if res['status'] == 'SUCCESS':
289 | doc.db_set('balance_amount',res['balance'])
290 | doc.db_set('balance_last_synced_on',get_datetime(res['date']))
291 | doc.reload()
292 | frappe.msgprint(_("""Balance Updated"""))
293 | except:
294 | res = frappe.get_traceback()
295 |
296 | log_name = log_request(bank_account, 'Fetch Balance', filters, config, res)
297 | if isinstance(res, dict):
298 | if 'status' in res and res['status']== 'FAILURE' and bank_account:
299 | frappe.throw(_(f'Unable to fetch balance.Please check log {get_link_to_form("Bank API Request Log", log_name)} for more info.'))
300 | else:
301 | if bank_account:
302 | frappe.throw(_(f'Unable to fetch balance.Please check log {get_link_to_form("Bank API Request Log", log_name)} for more info.'))
303 |
304 | @frappe.whitelist()
305 | def fetch_account_statement(bank_account = None):
306 | account_list = []
307 |
308 | if not bank_account:
309 | for acc in frappe.db.get_list('Bank Account', {'is_company_account': 1}):
310 | account_list.append(acc['name'])
311 | else:
312 | account_list.append(bank_account)
313 |
314 | for acc in account_list:
315 | prov, config = get_api_provider_class(acc)
316 | now_date = now_datetime().strftime("%d-%m-%Y")
317 | try:
318 | last_doc = frappe.get_last_doc("Bank Transaction", {'bank_account':acc})
319 | from_date = last_doc.date.strftime("%d-%m-%Y")
320 | if not from_date:
321 | from_date = now_date
322 | except:
323 | from_date = now_date
324 | filters = {
325 | "ACCOUNTNO": frappe.db.get_value('Bank Account',{'name':acc},'bank_account_no'),
326 | "FROMDATE": from_date,
327 | "TODATE": now_date
328 | }
329 | try:
330 | res = prov.fetch_statement_with_pagination(filters)
331 | doc = frappe.get_doc('Bank Account', acc)
332 | if res['status'] == 'SUCCESS':
333 | transaction_list = []
334 | for transaction in res['record']:
335 | credit = 0
336 | debit = 0
337 | if transaction['TYPE'] == 'DR':
338 | debit = transaction['AMOUNT']
339 | if transaction['TYPE'] == 'CR':
340 | credit = transaction['AMOUNT']
341 |
342 | transaction_list.append({
343 | 'txn_id': transaction['TRANSACTIONID'],
344 | 'txn_date':transaction['TXNDATE'],
345 | 'debit': debit,
346 | 'credit': credit,
347 | 'remarks':transaction['REMARKS']
348 | })
349 | if new_bank_transaction(transaction_list, acc):
350 | doc.db_set('statement_last_synced_on',now_datetime())
351 | doc.reload()
352 | frappe.msgprint(_("""Statements updated"""))
353 | except:
354 | res = frappe.get_traceback()
355 |
356 | log_name = log_request(bank_account, 'Fetch Account Statement', filters, config, res)
357 | if isinstance(res, dict):
358 | if 'status' in res and res['status']== 'FAILURE' and bank_account:
359 | frappe.throw(_(f'Unable to fetch statement.Please check log {get_link_to_form("Bank API Request Log", log_name)} for more info.'))
360 | else:
361 | frappe.throw(_(f'Unable to fetch statement.Please check log {get_link_to_form("Bank API Request Log", log_name)} for more info.'))
362 |
363 | def log_request(doc_name, api_method, filters, config, res):
364 | request_log = frappe.get_doc({
365 | "doctype": "Bank API Request Log",
366 | "user": frappe.session.user,
367 | "reference_document":doc_name,
368 | "api_method": api_method,
369 | "filters": json.dumps(filters, indent=4) if filters else None,
370 | "config_details": json.dumps(config, indent=4),
371 | "response": json.dumps(res, indent=4)
372 | })
373 | request_log.save(ignore_permissions=True)
374 | frappe.db.commit()
375 | return request_log.name
376 |
377 | def create_defaults():
378 | #Create default roles
379 | roles = ['Bank Maker','Bank Checker']
380 | for role in roles:
381 | if not frappe.db.exists('Role', role):
382 | role_doc = frappe.new_doc("Role")
383 | role_doc.role_name = role
384 | role_doc.save()
385 |
386 | #Create custom field
387 | custom_fields = {
388 | 'Bank Account': [
389 | {
390 | "fieldname": "ifsc_code",
391 | "fieldtype": "Data",
392 | "label": "IFSC Code",
393 | "insert_after" : "iban"
394 | },
395 | {
396 | "fieldname": "account_statemnt_and_balance_details",
397 | "fieldtype": "Section Break",
398 | "label": "Account Statement and Balance Details",
399 | "insert_after" : "mask",
400 | "depends_on": "eval: doc.is_company_account == 1 && !doc.__islocal"
401 | },
402 | {
403 | "fieldname": "fetch_balance",
404 | "fieldtype": "Button",
405 | "label": "Fetch Balance",
406 | "insert_after" : "account_statemnt_and_balance_details"
407 | },
408 | {
409 | "fieldname": "balance_amount",
410 | "fieldtype": "Float",
411 | "label": "Balance Amount",
412 | "insert_after" : "fetch_balance",
413 | "read_only": 1
414 | },
415 | {
416 | "fieldname": "balance_last_synced_on",
417 | "fieldtype": "Datetime",
418 | "label": "Balance Last Synced On",
419 | "insert_after" : "balance_amount",
420 | "read_only": 1
421 | },
422 | {
423 | "fieldname": "column_break_30",
424 | "fieldtype": "Column Break",
425 | "insert_after" : "balance_last_synced_on"
426 | },
427 | {
428 | "fieldname": "fetch_account_statement",
429 | "fieldtype": "Button",
430 | "label": "Fetch Account Statement",
431 | "insert_after" : "column_break_30"
432 | },
433 | {
434 | "fieldname": "statement_last_synced_on",
435 | "fieldtype": "Datetime",
436 | "label": "Statement Last Synced On",
437 | "insert_after" : "fetch_account_statement",
438 | "read_only": 1
439 | }
440 | ]}
441 | create_custom_fields(
442 | custom_fields, ignore_validate=frappe.flags.in_patch, update=True)
443 |
444 | #Create workflow state
445 | states_with_style = {'Success': ['Verified','Initiated', 'Transaction Completed', 'Completed'],
446 | 'Danger': ['Verification Failed', 'Initiation Error', 'Initiation Failed', 'Transaction Failed', 'Transaction Error', 'Failed'],
447 | 'Primary': ['Transaction Pending', 'Initiation Pending', 'Processing', 'Partially Completed']}
448 |
449 | for style in states_with_style.keys():
450 | for state in states_with_style[style]:
451 | if not frappe.db.exists('Workflow State', state):
452 | frappe.get_doc({"doctype" : "Workflow State",
453 | "workflow_state_name" : state,
454 | "style" : style}).save()
455 |
456 | create_workflow('Outward Bank Payment')
457 | create_workflow('Bulk Outward Bank Payment')
458 | set_permissions_to_core_doctypes()
459 |
460 | def create_workflow(document_name):
461 | #Create default workflow
462 | if not frappe.db.exists('Workflow', f'{document_name} Workflow'):
463 | workflow_doc = frappe.get_doc({'doctype': 'Workflow',
464 | 'workflow_name': f'{document_name} Workflow',
465 | 'document_type': document_name,
466 | 'workflow_state_field': 'workflow_state',
467 | 'is_active': 1,
468 | 'send_email_alert':0})
469 |
470 | workflow_doc.append('states',{'state': 'Pending',
471 | 'doc_status': 0,
472 | 'update_field': 'workflow_state',
473 | 'update_value': 'Pending',
474 | 'allow_edit': 'Bank Maker'})
475 |
476 | pending_next_states = [['Approve', 'Approved'], ['Reject', 'Rejected']]
477 | for state in pending_next_states:
478 | workflow_doc.append('states',{'state': state[1],
479 | 'doc_status': 1,
480 | 'update_field': 'workflow_state',
481 | 'update_value': state[1],
482 | 'allow_edit': 'Bank Checker'})
483 | transitions = { 'state': 'Pending',
484 | 'action': state[0],
485 | 'allow_self_approval': 0,
486 | 'next_state': state[1],
487 | 'allowed': 'Bank Checker'}
488 | workflow_doc.append('transitions',transitions)
489 | if document_name == 'Outward Bank Payment':
490 | optional_states = ['Verified','Verification Failed','Initiated',
491 | 'Initiation Error', 'Initiation Failed', 'Transaction Failed', 'Initiation Pending',
492 | 'Transaction Error', 'Transaction Pending', 'Transaction Completed']
493 | if document_name == 'Bulk Outward Bank Payment':
494 | optional_states = ['Verified','Verification Failed','Initiated', 'Processing', 'Partially Completed', 'Completed', 'Failed']
495 |
496 | for state in optional_states:
497 | workflow_doc.append('states',{'state': state,
498 | 'is_optional_state': 1,
499 | 'doc_status': 1,
500 | 'update_field': 'workflow_state',
501 | 'update_value': state,
502 | 'allow_edit': 'Bank Checker'})
503 |
504 | workflow_doc.save()
505 |
506 | def set_permissions_to_core_doctypes():
507 | roles = ['Bank Checker', 'Bank Maker']
508 | core_doc_list = ['Bank Account', 'Company', 'Supplier', 'Customer', 'Employee']
509 |
510 | # assign select permission
511 | for role in roles:
512 | for doc in core_doc_list:
513 | add_permission(doc, role, 0)
514 | update_permission_property(doc, role, 0, 'select', 1)
515 |
516 | def is_authorized(new_doc):
517 | old_doc = new_doc.get_doc_before_save()
518 | if old_doc:
519 | diff = get_diff(old_doc, new_doc)
520 | if diff:
521 | for changed in diff.changed:
522 | field, old, new = changed
523 | if field in ['is_verified', 'retry_count']:
524 | frappe.throw('Unauthorized Access')
525 | elif new_doc.is_verified or new_doc.retry_count:
526 | frappe.throw('Unauthorized Access')
527 | else:
528 | return
529 |
530 | @frappe.whitelist()
531 | def get_company_bank_account(doctype, txt, searchfield, start, page_len, filters):
532 | bank_accounts = []
533 | for acc in frappe.get_list("Bank Account", filters= filters,fields=["name"]):
534 | if not acc['name'] in bank_accounts:
535 | is_enabled = frappe.get_value('Bank API Integration',
536 | {'bank_account': acc['name']},
537 | 'enable_transaction')
538 | if is_enabled:
539 | bank_accounts.append([acc['name']])
540 | return bank_accounts
541 |
542 | @frappe.whitelist()
543 | def get_transaction_type(bank_account):
544 | common_transaction_types = ['RTGS', 'NEFT', 'IMPS']
545 | mappings = {
546 | 'ICICI': ['Internal Payments', 'External Payments', 'Virtual A/c Payments']
547 | }
548 | bank_api_provider = frappe.get_value('Bank API Integration', {'bank_account': bank_account}, 'bank_api_provider')
549 |
550 | if not bank_api_provider in mappings:
551 | return common_transaction_types
552 | return common_transaction_types + mappings[bank_api_provider]
553 |
554 | @frappe.whitelist()
555 | def get_field_status(bank_account):
556 | config = frappe.get_site_config()
557 | data = {}
558 | if 'bank_api_integration' in config:
559 | enable_otp_based_transaction = config.bank_api_integration['enable_otp_based_transaction'] \
560 | if 'enable_otp_based_transaction' in config.bank_api_integration else None
561 | acc_num = frappe.get_value('Bank Account', {'name': bank_account},'bank_account_no')
562 | is_pwd_security_enabled = frappe.get_value("Bank API Integration", {"bank_account": bank_account}, "enable_password_security")
563 | disabled_accounts = config.bank_api_integration['disable_transaction'] \
564 | if 'disable_transaction' in config.bank_api_integration else None
565 | if disabled_accounts and (disabled_accounts == '*' or acc_num in disabled_accounts):
566 | frappe.throw(_(f'Unable to process transaction for the selected bank account. Please contact Administrator.'))
567 | return
568 |
569 | if enable_otp_based_transaction and (enable_otp_based_transaction == '*' or acc_num in enable_otp_based_transaction):
570 | data['is_otp_enabled'] = 1
571 | if is_pwd_security_enabled:
572 | data['is_pwd_security_enabled'] = 1
573 | else:
574 | data['is_otp_enabled'] = 1
575 | return data
576 |
577 | @frappe.whitelist()
578 | def update_status(doctype_name,docname, status):
579 | frappe.db.set_value(doctype_name, {'name': docname}, 'docstatus', 1)
580 | frappe.db.set_value(doctype_name, {'name': docname}, 'workflow_state', status)
581 |
582 | @frappe.whitelist()
583 | def verify_and_initiate_transaction(doc, entered_password=None, otp=None):
584 | if isinstance(doc, string_types):
585 | doc = frappe._dict(json.loads(doc))
586 | obp_doc_name = doc['name']
587 | retry_count = doc['retry_count'] + 1
588 | frappe.db.set_value(doc['doctype'], doc['name'], 'retry_count', retry_count)
589 | if doc['doctype'] == 'Bulk Outward Bank Payment':
590 | row = doc['outward_bank_payment_details'][0]
591 | data = {
592 | 'party_type': row['party_type'],
593 | 'party': row['party'],
594 | 'amount': row['amount'],
595 | 'remarks': doc['remarks'],
596 | 'transaction_type': doc['transaction_type'],
597 | 'company_bank_account': doc['company_bank_account'],
598 | 'reconcile_action': doc['reconcile_action'],
599 | 'bobp': doc['name']}
600 | obp_doc_name = frappe.db.exists('Outward Bank Payment', data)
601 | if not obp_doc_name:
602 | data['doctype'] = 'Outward Bank Payment'
603 | obp_doc = frappe.get_doc(data)
604 | obp_doc.save(ignore_permissions=True)
605 | obp_doc.submit()
606 | status = frappe.db.get_value('Outward Bank Payment', obp_doc.name, 'workflow_state')
607 | frappe.db.set_value('Outward Bank Payment Details',{'parent':doc['name'],
608 | 'party_type': row['party_type'],
609 | 'party': row['party'],
610 | 'amount': row['amount']},'outward_bank_payment',get_link_to_form('Outward Bank Payment', obp_doc.name))
611 | frappe.db.set_value('Outward Bank Payment Details',{'parent':doc['name'],
612 | 'party_type': row['party_type'],
613 | 'party': row['party'],
614 | 'amount': row['amount'],
615 | 'outward_bank_payment':obp_doc.name},'status', status)
616 | obp_doc_name = obp_doc.name
617 |
618 | if entered_password and otp:
619 | integration_doc_name = frappe.get_value('Bank API Integration',{'bank_account': doc['company_bank_account']},'name')
620 | defined_password = frappe.utils.password.get_decrypted_password('Bank API Integration', integration_doc_name, fieldname='transaction_password')
621 | if not entered_password == defined_password:
622 | frappe.throw(_("Invalid Password"))
623 | initiate_transaction_with_otp(obp_doc_name, otp)
624 |
625 | if entered_password and not otp:
626 | integration_doc_name = frappe.get_value('Bank API Integration',{'bank_account': doc['company_bank_account']},'name')
627 | defined_password = frappe.utils.password.get_decrypted_password('Bank API Integration', integration_doc_name, fieldname='transaction_password')
628 | if not entered_password == defined_password:
629 | frappe.throw(_("Invalid Password"))
630 | initiate_transaction_without_otp(obp_doc_name)
631 |
632 | if otp and not entered_password:
633 | initiate_transaction_with_otp(obp_doc_name, otp)
634 |
635 | retry_count = frappe.db.get_value(doc['doctype'], doc['name'], 'retry_count')
636 | workflow_state = frappe.db.get_value('Outward Bank Payment', obp_doc_name, 'workflow_state')
637 | if workflow_state == 'Approved' and retry_count == 3:
638 | frappe.db.set_value(doc.doctype, doc.name, 'workflow_state', 'Verification Failed')
639 |
640 | if workflow_state in ['Initiated', 'Initiation Pending']:
641 | if doc['doctype'] == 'Bulk Outward Bank Payment':
642 | bobp = frappe.get_doc('Bulk Outward Bank Payment', doc['name'])
643 | bobp.bulk_create_obp_records()
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bank_api_integration/test_bank_api_integration.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright (c) 2021, Aerele and Contributors
3 | # See license.txt
4 | from __future__ import unicode_literals
5 |
6 | # import frappe
7 | import unittest
8 |
9 | class TestBankAPIIntegration(unittest.TestCase):
10 | pass
11 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bank_api_request_log/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aerele/bank_api_integration/cd87ffb49618512f08c93d0dc297bb1edc220128/bank_api_integration/bank_api_integration/doctype/bank_api_request_log/__init__.py
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bank_api_request_log/bank_api_request_log.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021, Aerele and contributors
2 | // For license information, please see license.txt
3 |
4 | frappe.ui.form.on('Bank API Request Log', {
5 | // refresh: function(frm) {
6 |
7 | // }
8 | });
9 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bank_api_request_log/bank_api_request_log.json:
--------------------------------------------------------------------------------
1 | {
2 | "actions": [],
3 | "autoname": "BANK API-REQ-.#####",
4 | "creation": "2021-03-23 23:03:05.045523",
5 | "doctype": "DocType",
6 | "editable_grid": 1,
7 | "engine": "InnoDB",
8 | "field_order": [
9 | "user",
10 | "api_method",
11 | "config_details",
12 | "response",
13 | "column_break_7",
14 | "timestamp",
15 | "reference_document",
16 | "filters"
17 | ],
18 | "fields": [
19 | {
20 | "fieldname": "user",
21 | "fieldtype": "Link",
22 | "label": "User",
23 | "options": "User"
24 | },
25 | {
26 | "fieldname": "response",
27 | "fieldtype": "Code",
28 | "label": "Response",
29 | "read_only": 1
30 | },
31 | {
32 | "fieldname": "column_break_7",
33 | "fieldtype": "Column Break"
34 | },
35 | {
36 | "default": "Now",
37 | "fieldname": "timestamp",
38 | "fieldtype": "Datetime",
39 | "label": "Timestamp"
40 | },
41 | {
42 | "fieldname": "reference_document",
43 | "fieldtype": "Data",
44 | "label": "Reference Document"
45 | },
46 | {
47 | "fieldname": "api_method",
48 | "fieldtype": "Data",
49 | "label": "API Method"
50 | },
51 | {
52 | "fieldname": "filters",
53 | "fieldtype": "Code",
54 | "label": "Filters",
55 | "read_only": 1
56 | },
57 | {
58 | "fieldname": "config_details",
59 | "fieldtype": "Code",
60 | "label": "Config Details",
61 | "read_only": 1
62 | }
63 | ],
64 | "index_web_pages_for_search": 1,
65 | "links": [],
66 | "modified": "2021-05-29 14:02:55.741754",
67 | "modified_by": "Administrator",
68 | "module": "Bank Api Integration",
69 | "name": "Bank API Request Log",
70 | "owner": "Administrator",
71 | "permissions": [
72 | {
73 | "email": 1,
74 | "export": 1,
75 | "print": 1,
76 | "read": 1,
77 | "report": 1,
78 | "role": "System Manager",
79 | "share": 1
80 | },
81 | {
82 | "read": 1,
83 | "role": "Bank Checker"
84 | }
85 | ],
86 | "sort_field": "modified",
87 | "sort_order": "DESC"
88 | }
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bank_api_request_log/bank_api_request_log.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright (c) 2021, Aerele 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 BankAPIRequestLog(Document):
10 | pass
11 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bank_api_request_log/test_bank_api_request_log.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright (c) 2021, Aerele and Contributors
3 | # See license.txt
4 | from __future__ import unicode_literals
5 |
6 | # import frappe
7 | import unittest
8 |
9 | class TestBankAPIRequestLog(unittest.TestCase):
10 | pass
11 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bulk_outward_bank_payment/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aerele/bank_api_integration/cd87ffb49618512f08c93d0dc297bb1edc220128/bank_api_integration/bank_api_integration/doctype/bulk_outward_bank_payment/__init__.py
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bulk_outward_bank_payment/bulk_outward_bank_payment.html:
--------------------------------------------------------------------------------
1 |
{{ __("Transaction Summary") }}
2 |
3 |
4 |
5 | {{ __("Status") }} |
6 | {{ __("No of Documents") }} |
7 |
8 |
9 |
10 | {% for row in data %}
11 |
12 |
13 | {{ row["status"] }}
14 | |
15 |
16 | {{ row["total_docs"] }}
17 | |
18 |
19 | {% endfor %}
20 |
21 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bulk_outward_bank_payment/bulk_outward_bank_payment.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021, Aerele and contributors
2 | // For license information, please see license.txt
3 | {% include 'bank_api_integration/bank_api_integration/utils/js/common_fields.js' %};
4 | frappe.ui.form.on("Bulk Outward Bank Payment", {
5 | refresh: function(frm) {
6 | frm.trigger('verify_and_initiate_payment');
7 | if(frappe.user.has_role('Bank Maker')){
8 | frm.set_df_property('retry_count', 'hidden', 1);
9 | }
10 | frm.trigger("show_summary");
11 | if (frm.doc.docstatus == 1 && frm.doc.workflow_state != 'Rejected'){
12 | if(frm.doc.__onload.initiated_txn_count ){
13 | frm.add_custom_button(__("Update Transaction Status"), function() {
14 | frm.trigger('update_txn_status');
15 | }).addClass("btn-primary");
16 | }
17 | if(frm.doc.__onload.failed_doc_count){
18 | frm.add_custom_button(__("Recreate Failed Transactions"), function() {
19 | frm.trigger('recreate_failed_txn');
20 | }).addClass("btn-primary");
21 | }
22 | }
23 | },
24 | before_workflow_action: function(frm){
25 | if(frm.selected_workflow_action == 'Reject'){
26 | return new Promise((resolve, reject) => {
27 | frappe.prompt({
28 | fieldtype: 'Data',
29 | label: __('Reason'),
30 | fieldname: 'reason'
31 | }, data => {
32 | frappe.call({
33 | method: "frappe.client.set_value",
34 | freeze: true,
35 | args: {
36 | doctype: 'Bulk Outward Bank Payment',
37 | name: frm.doc.name,
38 | fieldname: 'reason_for_rejection',
39 | value: data.reason,
40 | },
41 | callback: function(r) {
42 | if (r.message) {
43 | resolve(r.message);
44 | } else {
45 | reject();
46 | }
47 | }
48 | });
49 | }, __('Reason for Rejection'), __('Submit'));
50 | })
51 | }
52 | },
53 | after_workflow_action: function(frm){
54 | if(frm.doc.workflow_state == 'Approved'){
55 | frappe.call({
56 | method: 'bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.get_field_status',
57 | freeze: true,
58 | args: {
59 | 'bank_account': frm.doc.company_bank_account
60 | },
61 | callback: function(r) {
62 | let data = r.message;
63 | if (data) {
64 | if (!data.is_otp_enabled && !data.is_pwd_security_enabled){
65 | frappe.db.set_value('Bulk Outward Bank Payment', {'name': frm.doc.name},
66 | 'workflow_state', 'Verified')
67 | }
68 | }
69 | }
70 | })
71 | }
72 | frm.trigger('verify_and_initiate_payment');
73 | },
74 | verify_and_initiate_payment: function(frm){
75 | if(frappe.user.has_role('Bank Checker') && frm.doc.workflow_state == 'Approved' && frm.doc.retry_count < 3){
76 | frm.add_custom_button(__("Verify and Initiate Payment"), function(){
77 | let dialog_fields = [];
78 | let bank_account = frm.doc.company_bank_account;
79 | frappe.call({
80 | method: 'bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.get_field_status',
81 | freeze: true,
82 | args: {
83 | 'bank_account': bank_account
84 | },
85 | callback: function(r) {
86 | let data = r.message;
87 | if (data) {
88 | if (data.is_otp_enabled && !data.is_pwd_security_enabled){
89 | dialog_fields = [
90 | {
91 | fieldtype: "Int",
92 | label: __("OTP"),
93 | fieldname: "otp",
94 | reqd: 1
95 | }
96 | ]
97 | show_dialog(frm, dialog_fields)
98 | }
99 | if (!data.is_otp_enabled && data.is_pwd_security_enabled){
100 | dialog_fields = [
101 | {
102 | fieldtype: "Password",
103 | label: __("Transaction Password"),
104 | fieldname: "transaction_password",
105 | reqd: 1
106 | }
107 | ]
108 | show_dialog(frm, dialog_fields)
109 | }
110 | if (data.is_otp_enabled && data.is_pwd_security_enabled){
111 | frappe.call({
112 | method: 'bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.send_otp',
113 | freeze: true,
114 | args: {
115 | 'doctype': 'Bulk Outward Bank Payment',
116 | 'docname': frm.doc.name
117 | },
118 | callback: function(r) {
119 | if(r.message == true){
120 | frappe.show_alert({message:__('OTP Sent Successfully'), indicator:'green'});
121 | dialog_fields = [
122 | {
123 | fieldtype: "Password",
124 | label: __("Transaction Password"),
125 | fieldname: "transaction_password",
126 | reqd: 1
127 | },
128 | {
129 | fieldtype: "Int",
130 | label: __("OTP"),
131 | fieldname: "otp",
132 | reqd: 1
133 | }
134 | ]
135 | show_dialog(frm, dialog_fields)
136 | }
137 | else{
138 | frappe.show_alert({message:__('Unable to send OTP'), indicator:'red'});
139 | }
140 | }})}
141 | }
142 | }
143 | });
144 | }).addClass("btn-primary");
145 | }
146 | },
147 | company_bank_account: function(frm) {
148 | frappe.call({
149 | method: 'bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.get_transaction_type',
150 | args: {
151 | "bank_account":frm.doc.company_bank_account
152 | },
153 | freeze: true,
154 | callback: function(r) {
155 | if (r.message) {
156 | frm.set_df_property("transaction_type","options",r.message.join('\n'))
157 | }
158 | }
159 | });
160 | },
161 | recreate_failed_txn: function(){
162 | frappe.model.open_mapped_doc({
163 | method: "bank_api_integration.bank_api_integration.doctype.bulk_outward_bank_payment.bulk_outward_bank_payment.recreate_failed_transaction",
164 | frm: cur_frm,
165 | freeze_message: __("Fetching ...")
166 | })
167 | },
168 | update_txn_status: function(frm){
169 | frappe.call({
170 | method: "bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.update_transaction_status",
171 | freeze: true,
172 | freeze_message: __("Processing..."),
173 | args: {bobp_name:frm.doc.name}
174 | })
175 | },
176 | show_summary: function(frm) {
177 | let transaction_summary = frm.doc.__onload.transaction_summary;
178 | if(frm.doc.workflow_state != 'Pending' && frm.doc.workflow_state != 'Rejected') {
179 | let section = frm.dashboard.add_section(
180 | frappe.render_template('bulk_outward_bank_payment', {
181 | data: transaction_summary
182 | })
183 | );
184 | frm.dashboard.show();
185 | }
186 | }
187 | }
188 | );
189 | var show_dialog = function(frm, dialog_fields){
190 | let d = new frappe.ui.Dialog({
191 | title: __('Enter the Details'),
192 | fields: dialog_fields,
193 | primary_action: function() {
194 | let data = d.get_values();
195 | d.hide();
196 | frappe.call({
197 | method: 'bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.verify_and_initiate_transaction',
198 | args: {
199 | "doc":frm.doc,
200 | "entered_password": data.transaction_password,
201 | "otp": data.otp
202 | },
203 | freeze:true,
204 | callback: function(r) {
205 | frm.reload_doc();
206 | }
207 | });
208 | }
209 | });
210 | d.show();
211 | }
212 | cur_frm.fields_dict.outward_bank_payment_details.grid.get_field("party_type").get_query = function () {
213 | return {
214 | query: "erpnext.setup.doctype.party_type.party_type.get_party_type",
215 | };
216 | }
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bulk_outward_bank_payment/bulk_outward_bank_payment.json:
--------------------------------------------------------------------------------
1 | {
2 | "actions": [],
3 | "autoname": "format:BOBP{YYYY}{MM}{####}",
4 | "creation": "2021-03-11 15:59:34.364295",
5 | "doctype": "DocType",
6 | "editable_grid": 1,
7 | "engine": "InnoDB",
8 | "field_order": [
9 | "company",
10 | "reconcile_action",
11 | "column_break_7",
12 | "company_bank_account",
13 | "transaction_type",
14 | "retry_count",
15 | "section_break_4",
16 | "outward_bank_payment_details",
17 | "section_break_9",
18 | "no_of_payments",
19 | "total_payment_amount",
20 | "column_break_10",
21 | "remarks",
22 | "reason_for_rejection",
23 | "is_verified",
24 | "amended_from"
25 | ],
26 | "fields": [
27 | {
28 | "allow_bulk_edit": 1,
29 | "fieldname": "outward_bank_payment_details",
30 | "fieldtype": "Table",
31 | "label": "Outward Bank Payment Details",
32 | "options": "Outward Bank Payment Details",
33 | "reqd": 1
34 | },
35 | {
36 | "fieldname": "amended_from",
37 | "fieldtype": "Link",
38 | "label": "Amended From",
39 | "no_copy": 1,
40 | "options": "Bulk Outward Bank Payment",
41 | "print_hide": 1,
42 | "read_only": 1
43 | },
44 | {
45 | "default": "Auto Reconcile Oldest First Invoice",
46 | "fieldname": "reconcile_action",
47 | "fieldtype": "Select",
48 | "in_list_view": 1,
49 | "label": "Reconcile Action",
50 | "options": "\nAuto Reconcile Oldest First Invoice\nSkip Reconcile",
51 | "reqd": 1
52 | },
53 | {
54 | "fieldname": "no_of_payments",
55 | "fieldtype": "Int",
56 | "label": "No of Payments",
57 | "no_copy": 1,
58 | "read_only": 1
59 | },
60 | {
61 | "fieldname": "company",
62 | "fieldtype": "Link",
63 | "label": "Company",
64 | "options": "Company",
65 | "reqd": 1
66 | },
67 | {
68 | "fieldname": "total_payment_amount",
69 | "fieldtype": "Currency",
70 | "label": "Total Payment Amount",
71 | "no_copy": 1,
72 | "read_only": 1
73 | },
74 | {
75 | "fieldname": "column_break_7",
76 | "fieldtype": "Column Break"
77 | },
78 | {
79 | "fieldname": "section_break_4",
80 | "fieldtype": "Section Break"
81 | },
82 | {
83 | "fieldname": "company_bank_account",
84 | "fieldtype": "Link",
85 | "label": "Company Bank Account",
86 | "options": "Bank Account",
87 | "reqd": 1
88 | },
89 | {
90 | "fieldname": "transaction_type",
91 | "fieldtype": "Select",
92 | "label": "Transaction Type",
93 | "reqd": 1
94 | },
95 | {
96 | "fieldname": "remarks",
97 | "fieldtype": "Small Text",
98 | "label": "Remarks",
99 | "reqd": 1
100 | },
101 | {
102 | "default": "0",
103 | "fieldname": "retry_count",
104 | "fieldtype": "Int",
105 | "hidden": 1,
106 | "label": "Retry Count",
107 | "no_copy": 1,
108 | "read_only": 1
109 | },
110 | {
111 | "fieldname": "reason_for_rejection",
112 | "fieldtype": "Small Text",
113 | "label": "Reason for Rejection",
114 | "no_copy": 1,
115 | "read_only": 1
116 | },
117 | {
118 | "default": "0",
119 | "fieldname": "is_verified",
120 | "fieldtype": "Check",
121 | "hidden": 1,
122 | "label": "Is Verified",
123 | "no_copy": 1,
124 | "read_only": 1
125 | },
126 | {
127 | "fieldname": "column_break_10",
128 | "fieldtype": "Column Break"
129 | },
130 | {
131 | "fieldname": "section_break_9",
132 | "fieldtype": "Section Break"
133 | }
134 | ],
135 | "is_submittable": 1,
136 | "links": [],
137 | "modified": "2021-06-16 15:11:57.380394",
138 | "modified_by": "Administrator",
139 | "module": "Bank Api Integration",
140 | "name": "Bulk Outward Bank Payment",
141 | "owner": "Administrator",
142 | "permissions": [
143 | {
144 | "delete": 1,
145 | "email": 1,
146 | "export": 1,
147 | "print": 1,
148 | "read": 1,
149 | "report": 1,
150 | "role": "Bank Checker",
151 | "select": 1,
152 | "share": 1,
153 | "submit": 1,
154 | "write": 1
155 | },
156 | {
157 | "create": 1,
158 | "delete": 1,
159 | "email": 1,
160 | "export": 1,
161 | "print": 1,
162 | "read": 1,
163 | "report": 1,
164 | "role": "Bank Maker",
165 | "select": 1,
166 | "share": 1,
167 | "write": 1
168 | }
169 | ],
170 | "sort_field": "modified",
171 | "sort_order": "DESC",
172 | "track_changes": 1
173 | }
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bulk_outward_bank_payment/bulk_outward_bank_payment.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright (c) 2021, Aerele 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 frappe.utils import flt
10 | from frappe.model.mapper import get_mapped_doc
11 | from frappe.core.page.background_jobs.background_jobs import get_info
12 | from frappe.utils.background_jobs import enqueue
13 | from bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration import *
14 | class BulkOutwardBankPayment(Document):
15 | def on_update(self):
16 | is_authorized(self)
17 | def onload(self):
18 | self.set_onload('transaction_summary', self.get_transaction_summary())
19 |
20 | def get_transaction_summary(self):
21 | failed_doc_count = 0
22 | initiated_txn_count = 0
23 | transaction_summary = [
24 | {'status':'Initiated','total_docs':0},
25 | {'status':'Initiation Pending','total_docs':0},
26 | {'status':'Initiation Error','total_docs':0},
27 | {'status':'Initiation Failed','total_docs':0},
28 | {'status':'Transaction Error','total_docs':0},
29 | {'status':'Transaction Failed','total_docs':0},
30 | {'status':'Transaction Pending','total_docs':0},
31 | {'status':'Transaction Completed','total_docs':0}]
32 | for row in transaction_summary:
33 | row['total_docs'] = frappe.db.count('Outward Bank Payment', {'bobp': self.name, 'workflow_state': row['status']})
34 | if row['status'] in ['Initiation Error',
35 | 'Initiation Failed',
36 | 'Transaction Error',
37 | 'Transaction Failed'] and row['total_docs']:
38 | failed_doc_count += row['total_docs']
39 |
40 | if row['status'] in ['Initiated', 'Initiation Pending', 'Transaction Pending'] and row['total_docs']:
41 | initiated_txn_count += row['total_docs']
42 |
43 | self.set_onload('failed_doc_count', failed_doc_count)
44 | self.set_onload('initiated_txn_count', initiated_txn_count)
45 | return transaction_summary
46 | def validate(self):
47 | total_payment_amount = 0
48 | for row in self.outward_bank_payment_details:
49 | row.remarks = self.remarks
50 | total_payment_amount+=flt(row.amount)
51 | self.total_payment_amount = total_payment_amount
52 | self.no_of_payments = len(self.outward_bank_payment_details)
53 |
54 | def bulk_create_obp_records(self):
55 | enqueued_jobs = [d.get("job_name") for d in get_info()]
56 | if self.name in enqueued_jobs:
57 | frappe.throw(
58 | _("OBP record creation already in progress. Please wait for sometime.")
59 | )
60 | else:
61 | enqueue(
62 | create_obp_records,
63 | queue="default",
64 | timeout=6000,
65 | event="obp_record_creation",
66 | job_name=self.name,
67 | doc = self
68 | )
69 | frappe.throw(
70 | _("OBP record creation job added to queue. Please check after sometime.")
71 | )
72 |
73 | def create_obp_records(doc):
74 | for row in doc.outward_bank_payment_details:
75 | row = vars(row)
76 | if row['idx'] == 0:
77 | continue
78 | try:
79 | data = {
80 | 'party_type': row['party_type'],
81 | 'party': row['party'],
82 | 'amount': row['amount'],
83 | 'remarks': doc.remarks,
84 | 'transaction_type': doc.transaction_type,
85 | 'company_bank_account': doc.company_bank_account,
86 | 'reconcile_action': doc.reconcile_action,
87 | 'bobp': doc.name}
88 | if not frappe.db.exists('Outward Bank Payment', data):
89 | data['doctype'] = 'Outward Bank Payment'
90 | obp_doc = frappe.get_doc(data)
91 | obp_doc.save(ignore_permissions=True)
92 | obp_doc.submit()
93 | status = frappe.db.get_value('Outward Bank Payment', obp_doc.name, 'workflow_state')
94 | frappe.db.set_value('Outward Bank Payment Details',{'parent':doc.name,
95 | 'party_type': row['party_type'],
96 | 'party': row['party'],
97 | 'amount': row['amount']},'outward_bank_payment',obp_doc.name)
98 | initiate_transaction_without_otp(obp_doc.name)
99 | frappe.db.commit()
100 | except:
101 | error_message = frappe.get_traceback()+"\n\n BOBP Name: \n"+ doc.name
102 | frappe.log_error(error_message, "OBP Record Creation Error")
103 |
104 | @frappe.whitelist()
105 | def recreate_failed_transaction(source_name, target_doc=None):
106 | doc = get_mapped_doc("Bulk Outward Bank Payment", source_name, {
107 | "Bulk Outward Bank Payment": {
108 | "doctype": "Bulk Outward Bank Payment",
109 | "field_map": {
110 | "company": "company",
111 | "company_bank_account": "company_bank_account",
112 | "reconcile_action": "reconcile_action",
113 | "transaction_type": "transaction_type"
114 | }
115 | },
116 | "Outward Bank Payment Details":{
117 | "doctype": "Outward Bank Payment Details",
118 | "field_map": {
119 | "party_type": "party_type",
120 | "party": "party",
121 | "amount": "amount"
122 | },
123 | "condition": lambda doc: doc.status not in ['Initiated', 'Transaction Completed', 'Initiation Pending', 'Transaction Pending']
124 | },
125 | }, target_doc)
126 | return doc
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/bulk_outward_bank_payment/test_bulk_outward_bank_payment.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright (c) 2021, Aerele and Contributors
3 | # See license.txt
4 | from __future__ import unicode_literals
5 |
6 | # import frappe
7 | import unittest
8 |
9 | class TestBulkOutwardBankPayment(unittest.TestCase):
10 | pass
11 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/outward_bank_payment/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aerele/bank_api_integration/cd87ffb49618512f08c93d0dc297bb1edc220128/bank_api_integration/bank_api_integration/doctype/outward_bank_payment/__init__.py
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/outward_bank_payment/outward_bank_payment.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021, Aerele and contributors
2 | // For license information, please see license.txt
3 | {% include 'bank_api_integration/bank_api_integration/utils/js/common_fields.js' %};
4 | frappe.ui.form.on('Outward Bank Payment', {
5 | setup: function(frm) {
6 | frm.set_query("party_type", function() {
7 | return {
8 | query: "erpnext.setup.doctype.party_type.party_type.get_party_type",
9 | };
10 | });
11 | },
12 | refresh: function(frm) {
13 | frm.trigger('verify_and_initiate_payment');
14 | if(frappe.user.has_role('Bank Maker')){
15 | frm.set_df_property('retry_count', 'hidden', 1);
16 | }
17 | if (frm.doc.docstatus == 1 && ['Initiated', 'Initiation Pending', 'Transaction Pending'].includes(frm.doc.workflow_state)){
18 | frm.add_custom_button(__("Update Transaction Status"), function() {
19 | frm.trigger('update_txn_status');
20 | }).addClass("btn-primary");}
21 | },
22 | before_workflow_action: function(frm){
23 | if(frm.selected_workflow_action == 'Reject'){
24 | return new Promise((resolve, reject) => {
25 | frappe.prompt({
26 | fieldtype: 'Data',
27 | label: __('Reason'),
28 | fieldname: 'reason'
29 | }, data => {
30 | frappe.call({
31 | method: "frappe.client.set_value",
32 | freeze: true,
33 | args: {
34 | doctype: 'Outward Bank Payment',
35 | name: frm.doc.name,
36 | fieldname: 'reason_for_rejection',
37 | value: data.reason,
38 | },
39 | callback: function(r) {
40 | if (r.message) {
41 | resolve(r.message);
42 | } else {
43 | reject();
44 | }
45 | }
46 | });
47 | }, __('Reason for Rejection'), __('Submit'));
48 | })
49 | }
50 | },
51 | after_workflow_action: function(frm){
52 | if(frm.doc.workflow_state == 'Approved'){
53 | frappe.call({
54 | method: 'bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.get_field_status',
55 | freeze: true,
56 | args: {
57 | 'bank_account': frm.doc.company_bank_account
58 | },
59 | callback: function(r) {
60 | let data = r.message;
61 | if (data) {
62 | if (!data.is_otp_enabled && !data.is_pwd_security_enabled){
63 | frappe.db.set_value('Outward Bank Payment', {'name': frm.doc.name},
64 | 'workflow_state', 'Verified')
65 | }
66 | }
67 | }
68 | })
69 | }
70 | frm.trigger('verify_and_initiate_payment');
71 | },
72 | verify_and_initiate_payment: function(frm){
73 | if(frappe.user.has_role('Bank Checker') && frm.doc.workflow_state == 'Approved' && frm.doc.retry_count < 3){
74 | frm.add_custom_button(__("Verify and Initiate Payment"), function(){
75 | let dialog_fields = [];
76 | let bank_account = frm.doc.company_bank_account;
77 | frappe.call({
78 | method: 'bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.get_field_status',
79 | freeze: true,
80 | args: {
81 | 'bank_account': bank_account
82 | },
83 | callback: function(r) {
84 | let data = r.message;
85 | if (data) {
86 | if (data.is_otp_enabled && !data.is_pwd_security_enabled){
87 | dialog_fields = [
88 | {
89 | fieldtype: "Int",
90 | label: __("OTP"),
91 | fieldname: "otp",
92 | reqd: 1
93 | }
94 | ]
95 | show_dialog(frm, dialog_fields)
96 | }
97 | if (!data.is_otp_enabled && data.is_pwd_security_enabled){
98 | dialog_fields = [
99 | {
100 | fieldtype: "Password",
101 | label: __("Transaction Password"),
102 | fieldname: "transaction_password",
103 | reqd: 1
104 | }
105 | ]
106 | show_dialog(frm, dialog_fields)
107 | }
108 | if (data.is_otp_enabled && data.is_pwd_security_enabled){
109 | frappe.call({
110 | method: 'bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.send_otp',
111 | freeze: true,
112 | args: {
113 | 'doctype': 'Outward Bank Payment',
114 | 'docname': frm.doc.name
115 | },
116 | callback: function(r) {
117 | if(r.message == true){
118 | frappe.show_alert({message:__('OTP Sent Successfully'), indicator:'green'});
119 | dialog_fields = [
120 | {
121 | fieldtype: "Password",
122 | label: __("Transaction Password"),
123 | fieldname: "transaction_password",
124 | reqd: 1
125 | },
126 | {
127 | fieldtype: "Int",
128 | label: __("OTP"),
129 | fieldname: "otp",
130 | reqd: 1
131 | }
132 | ]
133 | show_dialog(frm, dialog_fields)
134 | }
135 | else{
136 | frappe.show_alert({message:__('Unable to send OTP'), indicator:'red'});
137 | }
138 | }})}
139 | }
140 | }
141 | });
142 | }).addClass("btn-primary");
143 | }
144 | },
145 | company_bank_account: function(frm) {
146 | frappe.call({
147 | method: 'bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.get_transaction_type',
148 | args: {
149 | "bank_account":frm.doc.company_bank_account
150 | },
151 | freeze: true,
152 | callback: function(r) {
153 | if (r.message) {
154 | frm.set_df_property("transaction_type","options",r.message.join('\n'))
155 | }
156 | }
157 | });
158 | },
159 | update_txn_status: function(frm){
160 | frappe.call({
161 | method: "bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.update_transaction_status",
162 | freeze: true,
163 | freeze_message: __("Processing..."),
164 | args: {obp_name:frm.doc.name},
165 | callback: function(r) {
166 | frm.reload_doc();
167 | }
168 | })
169 | },
170 | get_outstanding_invoice: function(frm) {
171 | const today = frappe.datetime.get_today();
172 | const fields = [
173 | {fieldtype:"Section Break", label: __("Posting Date")},
174 | {fieldtype:"Date", label: __("From Date"),
175 | fieldname:"from_posting_date", default:frappe.datetime.add_days(today, -30)},
176 | {fieldtype:"Column Break"},
177 | {fieldtype:"Date", label: __("To Date"), fieldname:"to_posting_date", default:today},
178 | {fieldtype:"Section Break", label: __("Due Date")},
179 | {fieldtype:"Date", label: __("From Date"), fieldname:"from_due_date"},
180 | {fieldtype:"Column Break"},
181 | {fieldtype:"Date", label: __("To Date"), fieldname:"to_due_date"},
182 | {fieldtype:"Section Break", label: __("Outstanding Amount")},
183 | {fieldtype:"Float", label: __("Greater Than Amount"),
184 | fieldname:"outstanding_amt_greater_than", default: 0},
185 | {fieldtype:"Column Break"},
186 | {fieldtype:"Float", label: __("Less Than Amount"), fieldname:"outstanding_amt_less_than"},
187 | {fieldtype:"Section Break"},
188 | {fieldtype:"Check", label: __("Allocate Payment Amount"), fieldname:"allocate_payment_amount", default:1},
189 | ];
190 |
191 | frappe.prompt(fields, function(filters){
192 | frappe.flags.allocate_payment_amount = true;
193 | frm.events.validate_filters_data(frm, filters);
194 | frm.events.get_outstanding_documents(frm, filters);
195 | }, __("Filters"), __("Get Outstanding Documents"));
196 | },
197 |
198 | validate_filters_data: function(frm, filters) {
199 | const fields = {
200 | 'Posting Date': ['from_posting_date', 'to_posting_date'],
201 | 'Due Date': ['from_posting_date', 'to_posting_date'],
202 | 'Advance Amount': ['from_posting_date', 'to_posting_date'],
203 | };
204 |
205 | for (let key in fields) {
206 | let from_field = fields[key][0];
207 | let to_field = fields[key][1];
208 |
209 | if (filters[from_field] && !filters[to_field]) {
210 | frappe.throw(__("Error: {0} is mandatory field",
211 | [to_field.replace(/_/g, " ")]
212 | ));
213 | } else if (filters[from_field] && filters[from_field] > filters[to_field]) {
214 | frappe.throw(__("{0}: {1} must be less than {2}",
215 | [key, from_field.replace(/_/g, " "), to_field.replace(/_/g, " ")]
216 | ));
217 | }
218 | }
219 | },
220 |
221 | get_outstanding_documents: function(frm, filters) {
222 | frm.clear_table("payment_references");
223 |
224 | if(!frm.doc.party) {
225 | return;
226 | }
227 | var args = {
228 | "posting_date": frappe.datetime.get_today(),
229 | "company": frm.doc.company,
230 | "party_type": frm.doc.party_type,
231 | "payment_type": 'Pay',
232 | "party": frm.doc.party
233 | }
234 |
235 | for (let key in filters) {
236 | args[key] = filters[key];
237 | }
238 |
239 | frappe.flags.allocate_payment_amount = filters['allocate_payment_amount'];
240 |
241 | return frappe.call({
242 | method: 'bank_api_integration.bank_api_integration.doctype.outward_bank_payment.outward_bank_payment.get_outstanding_reference_documents',
243 | args: {
244 | args:args
245 | },
246 | callback: function(r, rt) {
247 | if(r.message) {
248 | var total_positive_outstanding = 0;
249 | var total_negative_outstanding = 0;
250 |
251 | $.each(r.message, function(i, d) {
252 | var c = frm.add_child("payment_references");
253 | c.reference_doctype = d.voucher_type;
254 | c.reference_name = d.voucher_no;
255 | c.due_date = d.due_date
256 | c.total_amount = d.invoice_amount;
257 | c.outstanding_amount = d.outstanding_amount;
258 | c.bill_no = d.bill_no;
259 |
260 | if(!in_list(["Sales Order", "Purchase Order", "Expense Claim", "Fees"], d.voucher_type)) {
261 | if(flt(d.outstanding_amount) > 0)
262 | total_positive_outstanding += flt(d.outstanding_amount);
263 | else
264 | total_negative_outstanding += Math.abs(flt(d.outstanding_amount));
265 | }
266 | c.exchange_rate = 1;
267 | if (in_list(['Sales Invoice', 'Purchase Invoice', "Expense Claim", "Fees"], d.reference_doctype)){
268 | c.due_date = d.due_date;
269 | }
270 | });
271 | }
272 | frm.events.allocate_party_amount_against_ref_docs(frm,
273 | (frm.doc.amount));
274 | refresh_field('payment_references');
275 | }
276 | });
277 | },
278 | allocate_party_amount_against_ref_docs: function(frm, paid_amount) {
279 | var total_positive_outstanding_including_order = 0;
280 | var total_negative_outstanding = 0;
281 |
282 | $.each(frm.doc.references || [], function(i, row) {
283 | if(flt(row.outstanding_amount) > 0)
284 | total_positive_outstanding_including_order += flt(row.outstanding_amount);
285 | else
286 | total_negative_outstanding += Math.abs(flt(row.outstanding_amount));
287 | })
288 |
289 | var allocated_negative_outstanding = 0;
290 | if (
291 | (frm.doc.payment_type=="Pay" && frm.doc.party_type=="Supplier") ||
292 | (frm.doc.payment_type=="Pay" && frm.doc.party_type=="Employee")
293 | ) {
294 | if(total_positive_outstanding_including_order > paid_amount) {
295 | var remaining_outstanding = total_positive_outstanding_including_order - paid_amount;
296 | allocated_negative_outstanding = total_negative_outstanding < remaining_outstanding ?
297 | total_negative_outstanding : remaining_outstanding;
298 | }
299 |
300 | var allocated_positive_outstanding = paid_amount + allocated_negative_outstanding;
301 | } else if (in_list(["Customer", "Supplier"], frm.doc.party_type)) {
302 | if(paid_amount > total_negative_outstanding) {
303 | if(total_negative_outstanding == 0) {
304 | frappe.msgprint(__("Cannot {0} {1} {2} without any negative outstanding invoice",
305 | ['Pay',
306 | (frm.doc.party_type=="Customer" ? "to" : "from"), frm.doc.party_type]));
307 | return false
308 | } else {
309 | frappe.msgprint(__("Paid Amount cannot be greater than total negative outstanding amount {0}", [total_negative_outstanding]));
310 | return false;
311 | }
312 | } else {
313 | allocated_positive_outstanding = total_negative_outstanding - paid_amount;
314 | allocated_negative_outstanding = paid_amount +
315 | (total_positive_outstanding_including_order < allocated_positive_outstanding ?
316 | total_positive_outstanding_including_order : allocated_positive_outstanding)
317 | }
318 | }
319 |
320 | $.each(frm.doc.references || [], function(i, row) {
321 | row.allocated_amount = 0 //If allocate payment amount checkbox is unchecked, set zero to allocate amount
322 | if(frappe.flags.allocate_payment_amount != 0){
323 | if(row.outstanding_amount > 0 && allocated_positive_outstanding > 0) {
324 | if(row.outstanding_amount >= allocated_positive_outstanding) {
325 | row.allocated_amount = allocated_positive_outstanding;
326 | } else {
327 | row.allocated_amount = row.outstanding_amount;
328 | }
329 |
330 | allocated_positive_outstanding -= flt(row.allocated_amount);
331 | } else if (row.outstanding_amount < 0 && allocated_negative_outstanding) {
332 | if(Math.abs(row.outstanding_amount) >= allocated_negative_outstanding)
333 | row.allocated_amount = -1*allocated_negative_outstanding;
334 | else row.allocated_amount = row.outstanding_amount;
335 |
336 | allocated_negative_outstanding -= Math.abs(flt(row.allocated_amount));
337 | }
338 | }
339 | })
340 |
341 | frm.refresh_fields()
342 | frm.events.set_total_allocated_amount(frm);
343 | }
344 | })
345 | var show_dialog = function(frm, dialog_fields){
346 | let d = new frappe.ui.Dialog({
347 | title: __('Enter the Details'),
348 | fields: dialog_fields,
349 | primary_action: function() {
350 | let data = d.get_values();
351 | d.hide();
352 | frappe.call({
353 | method: 'bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.verify_and_initiate_transaction',
354 | args: {
355 | "doc":frm.doc,
356 | "entered_password": data.transaction_password,
357 | "otp": data.otp
358 | },
359 | freeze:true,
360 | callback: function(r) {
361 | frm.reload_doc();
362 | }
363 | });
364 | }
365 | });
366 | d.show();
367 | }
368 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/outward_bank_payment/outward_bank_payment.json:
--------------------------------------------------------------------------------
1 | {
2 | "actions": [],
3 | "allow_copy": 1,
4 | "autoname": "format:OBP{YYYY}{MM}{####}",
5 | "creation": "2021-03-11 13:09:41.879350",
6 | "doctype": "DocType",
7 | "editable_grid": 1,
8 | "engine": "InnoDB",
9 | "field_order": [
10 | "company",
11 | "reconcile_action",
12 | "column_break_3",
13 | "company_bank_account",
14 | "transaction_type",
15 | "retry_count",
16 | "section_break_4",
17 | "party_type",
18 | "party",
19 | "amount",
20 | "column_break_9",
21 | "remarks",
22 | "reason_for_rejection",
23 | "section_break_11",
24 | "bobp",
25 | "payment_entry",
26 | "column_break_15",
27 | "utr_number",
28 | "reconcile_section",
29 | "get_outstanding_invoice",
30 | "payment_references",
31 | "is_verified",
32 | "amended_from"
33 | ],
34 | "fields": [
35 | {
36 | "fieldname": "party_type",
37 | "fieldtype": "Link",
38 | "in_list_view": 1,
39 | "label": "Party Type",
40 | "options": "DocType",
41 | "reqd": 1
42 | },
43 | {
44 | "fieldname": "party",
45 | "fieldtype": "Dynamic Link",
46 | "in_list_view": 1,
47 | "label": "Party",
48 | "options": "party_type",
49 | "reqd": 1
50 | },
51 | {
52 | "fieldname": "amount",
53 | "fieldtype": "Currency",
54 | "in_list_view": 1,
55 | "label": "Amount",
56 | "reqd": 1
57 | },
58 | {
59 | "fieldname": "bobp",
60 | "fieldtype": "Link",
61 | "label": "Bulk Outward Bank Payment",
62 | "no_copy": 1,
63 | "options": "Bulk Outward Bank Payment",
64 | "read_only": 1
65 | },
66 | {
67 | "fieldname": "amended_from",
68 | "fieldtype": "Link",
69 | "label": "Amended From",
70 | "no_copy": 1,
71 | "options": "Outward Bank Payment",
72 | "print_hide": 1,
73 | "read_only": 1
74 | },
75 | {
76 | "default": "Auto Reconcile Oldest First Invoice",
77 | "fieldname": "reconcile_action",
78 | "fieldtype": "Select",
79 | "label": "Reconcile Action",
80 | "options": "\nAuto Reconcile Oldest First Invoice\nSkip Reconcile\nManual Reconcile",
81 | "reqd": 1
82 | },
83 | {
84 | "depends_on": "eval: doc.reconcile_action === 'Manual Reconcile'",
85 | "fieldname": "reconcile_section",
86 | "fieldtype": "Section Break",
87 | "label": "Reconcile"
88 | },
89 | {
90 | "fieldname": "get_outstanding_invoice",
91 | "fieldtype": "Button",
92 | "label": "Get Outstanding Invoice"
93 | },
94 | {
95 | "fieldname": "payment_references",
96 | "fieldtype": "Table",
97 | "label": "Payment References",
98 | "options": "Payment References"
99 | },
100 | {
101 | "fieldname": "company",
102 | "fieldtype": "Link",
103 | "label": "Company",
104 | "options": "Company",
105 | "reqd": 1
106 | },
107 | {
108 | "fieldname": "company_bank_account",
109 | "fieldtype": "Link",
110 | "in_list_view": 1,
111 | "label": "Company Bank Account",
112 | "options": "Bank Account",
113 | "reqd": 1
114 | },
115 | {
116 | "fieldname": "section_break_4",
117 | "fieldtype": "Section Break",
118 | "label": "Payment Details"
119 | },
120 | {
121 | "fieldname": "column_break_3",
122 | "fieldtype": "Column Break"
123 | },
124 | {
125 | "fieldname": "transaction_type",
126 | "fieldtype": "Select",
127 | "label": "Transaction Type",
128 | "reqd": 1
129 | },
130 | {
131 | "fieldname": "column_break_9",
132 | "fieldtype": "Column Break"
133 | },
134 | {
135 | "fieldname": "section_break_11",
136 | "fieldtype": "Section Break",
137 | "label": "More Information"
138 | },
139 | {
140 | "fieldname": "payment_entry",
141 | "fieldtype": "Link",
142 | "label": "Payment Entry",
143 | "options": "Payment Entry",
144 | "read_only": 1
145 | },
146 | {
147 | "fieldname": "column_break_15",
148 | "fieldtype": "Column Break"
149 | },
150 | {
151 | "fieldname": "utr_number",
152 | "fieldtype": "Data",
153 | "label": "UTR Number",
154 | "no_copy": 1,
155 | "read_only": 1
156 | },
157 | {
158 | "fieldname": "remarks",
159 | "fieldtype": "Small Text",
160 | "label": "Remarks",
161 | "reqd": 1
162 | },
163 | {
164 | "default": "0",
165 | "description": "Maximum of 3 retries only allowed.",
166 | "fieldname": "retry_count",
167 | "fieldtype": "Int",
168 | "label": "Retry Count",
169 | "no_copy": 1,
170 | "read_only": 1
171 | },
172 | {
173 | "fieldname": "reason_for_rejection",
174 | "fieldtype": "Small Text",
175 | "label": "Reason for Rejection",
176 | "no_copy": 1,
177 | "read_only": 1
178 | },
179 | {
180 | "default": "0",
181 | "fieldname": "is_verified",
182 | "fieldtype": "Check",
183 | "hidden": 1,
184 | "label": "Is Verified",
185 | "no_copy": 1,
186 | "read_only": 1
187 | }
188 | ],
189 | "index_web_pages_for_search": 1,
190 | "is_submittable": 1,
191 | "links": [],
192 | "modified": "2021-05-29 17:23:46.094297",
193 | "modified_by": "Administrator",
194 | "module": "Bank Api Integration",
195 | "name": "Outward Bank Payment",
196 | "owner": "Administrator",
197 | "permissions": [
198 | {
199 | "delete": 1,
200 | "email": 1,
201 | "export": 1,
202 | "print": 1,
203 | "read": 1,
204 | "report": 1,
205 | "role": "Bank Checker",
206 | "select": 1,
207 | "share": 1,
208 | "submit": 1,
209 | "write": 1
210 | },
211 | {
212 | "create": 1,
213 | "delete": 1,
214 | "email": 1,
215 | "export": 1,
216 | "print": 1,
217 | "read": 1,
218 | "report": 1,
219 | "role": "Bank Maker",
220 | "select": 1,
221 | "share": 1,
222 | "write": 1
223 | }
224 | ],
225 | "sort_field": "modified",
226 | "sort_order": "DESC",
227 | "track_changes": 1
228 | }
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/outward_bank_payment/outward_bank_payment.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright (c) 2021, Aerele and contributors
3 | # For license information, please see license.txt
4 |
5 | from __future__ import unicode_literals
6 | import frappe, json
7 | from frappe import _
8 | from frappe.model.document import Document
9 | from frappe.utils import today
10 | from six import string_types
11 | from erpnext.accounts.doctype.payment_entry.payment_entry import get_negative_outstanding_invoices, get_orders_to_be_billed
12 | from erpnext.controllers.accounts_controller import get_supplier_block_status
13 | from erpnext.accounts.utils import get_outstanding_invoices, get_account_currency
14 | from frappe.utils import add_months, nowdate
15 | from bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration import is_authorized
16 | class OutwardBankPayment(Document):
17 | def validate(self):
18 | final_remark=""
19 | symbols=[',','.','/','-']
20 | for i in self.remarks:
21 | if(i not in symbols):
22 | final_remark+=i
23 | if len(final_remark)>25:
24 | final_remark=final_remark[0:25]
25 | self.remarks=final_remark
26 | def on_update(self):
27 | is_authorized(self)
28 | def on_change(self):
29 | if self.bobp and not self.workflow_state == 'Pending':
30 | status = 'Processing'
31 | failed_doc_count = frappe.db.count('Outward Bank Payment', {'bobp': self.bobp, 'workflow_state': ['in', ['Initiation Failed','Initiation Error', 'Transaction Error', 'Transaction Failed']]})
32 | completed_doc_count = frappe.db.count('Outward Bank Payment', {'bobp': self.bobp, 'workflow_state': 'Transaction Completed'})
33 | initiated_doc_count = frappe.db.count('Outward Bank Payment', {'bobp': self.bobp, 'workflow_state': 'Initiated'})
34 | total_payments = frappe.db.get_value('Bulk Outward Bank Payment', {'name': self.bobp}, 'no_of_payments')
35 | if initiated_doc_count == total_payments:
36 | status = 'Initiated'
37 | if failed_doc_count and not completed_doc_count:
38 | status = 'Failed'
39 | if completed_doc_count>=1:
40 | status = 'Partially Completed'
41 | if completed_doc_count == total_payments:
42 | status = 'Completed'
43 | frappe.db.set_value('Bulk Outward Bank Payment', {'name': self.bobp}, 'workflow_state', status)
44 | frappe.db.set_value('Outward Bank Payment Details',{'parent':self.bobp,
45 | 'party_type': self.party_type,
46 | 'party': self.party,
47 | 'amount': self.amount,
48 | 'outward_bank_payment': self.name},'status', self.workflow_state)
49 | frappe.db.commit()
50 | if self.reconcile_action == 'Auto Reconcile Oldest First Invoice' and self.workflow_state == 'Transaction Completed':
51 | references = []
52 | amount = self.amount
53 | month_threshold = -6
54 | from_date = add_months(nowdate(), month_threshold)
55 | invoices = frappe.db.get_all('Purchase Invoice',{'supplier': self.party, 'posting_date': ['>=', from_date], 'posting_date': ['<=', nowdate()]}, ['grand_total', 'due_date', 'bill_no', 'name'])
56 | for inv in invoices:
57 | if inv['grand_total'] <= amount:
58 | references.append({
59 | 'reference_doctype': 'Purchase Invoice',
60 | 'reference_name': inv['name'],
61 | 'bill_no': inv['bill_no'],
62 | 'due_date': inv['due_date'],
63 | 'total_amount': inv['grand_total']
64 | })
65 | amount-= inv['grand_total']
66 | self.create_payment_entry(references)
67 | if self.reconcile_action == 'Manual Reconcile' and self.workflow_state == 'Transaction Completed':
68 | references = []
69 | for row in self.payment_references:
70 | references.append({
71 | 'reference_doctype': row.reference_doctype,
72 | 'reference_name': row.reference_name,
73 | 'bill_no': row.bill_no,
74 | 'due_date': row.due_date,
75 | 'total_amount': row.total_amount,
76 | 'outstanding_amount': row.outstanding_amount,
77 | 'allocated_amount': row.allocated_amount,
78 | 'exchange_rate': row.exchange_rate
79 | })
80 | self.create_payment_entry(references)
81 |
82 | def create_payment_entry(self, references):
83 | account_paid_from = frappe.db.get_value("Bank Account", self.company_bank_account, "account")
84 | account_currency = frappe.db.get_value("Account", account_paid_from, "account_currency")
85 | payment_entry_dict = {
86 | "company" : self.company,
87 | "payment_type" : 'Pay',
88 | "mode_of_payment": 'Wire Transfer',
89 | "party_type" : self.party_type,
90 | "party" : self.party,
91 | "posting_date" : today(),
92 | "paid_amount": self.amount,
93 | "received_amount":self.amount,
94 | "reference_no":self.utr_number,
95 | "reference_date":today(),
96 | "source_exchange_rate": 1,
97 | "target_exchange_rate": 1,
98 | "paid_from": account_paid_from,
99 | "paid_from_account_currency": account_currency,
100 | "references": references
101 | }
102 | payment_entry = frappe.new_doc("Payment Entry")
103 | payment_entry.update(payment_entry_dict)
104 |
105 | payment_entry.insert()
106 | payment_entry.submit()
107 |
108 | frappe.db.set_value(self.doctype, self.name, "payment_entry", payment_entry.name)
109 |
110 | @frappe.whitelist()
111 | def make_bank_payment(source_name, target_doc=None):
112 | supplier=frappe.db.get_value("Purchase Order",{"name":source_name},"supplier")
113 | if(frappe.db.get_value("Bank Account",{"party":supplier},"is_default")):
114 | #Assigning party type as supplier
115 | def set_supplier(source_doc,target_doc,source_parent):
116 | target_doc.party_type="Supplier"
117 | target_doc.reconcile_action="Manual Reconcile"
118 | target_doc.append('payment_references',{
119 | 'reference_name': source_doc.name,
120 | 'reference_doctype': 'Purchase Invoice',
121 | "total_amount": source_doc.rounded_total,
122 | "outstanding_amount":source_doc.outstanding_amount,
123 | "allocated_amount":source_doc.outstanding_amount
124 | })
125 | from frappe.model.mapper import get_mapped_doc
126 | doclist = get_mapped_doc("Purchase Invoice", source_name,{
127 | "Purchase Invoice": {
128 | "postprocess": set_supplier,
129 | "doctype": "Outward Bank Payment",
130 | "field_map": {
131 | "supplier": "party",
132 | "name" : "remarks",
133 | "outstanding_amount" : "amount"
134 | }
135 | }
136 |
137 | }, target_doc)
138 | return doclist
139 | else:
140 | frappe.throw(_(f'{supplier} ' "have no bank account"))
141 |
142 | @frappe.whitelist()
143 | def bank_payment_for_purchase_order(source_name, target_doc=None):
144 | supplier=frappe.db.get_value("Purchase Order",{"name":source_name},"supplier")
145 | if(frappe.db.get_value("Bank Account",{"party":supplier},"is_default")):
146 | #Assigning party type as supplier
147 | def set_supplier(source_doc,target_doc,source_parent):
148 | target_doc.party_type="Supplier"
149 | target_doc.reconcile_action="Manual Reconcile"
150 | target_doc.append('payment_references',{
151 | 'reference_name': source_doc.name,
152 |
153 | 'reference_doctype': 'Purchase Order',
154 | "total_amount": source_doc.rounded_total,
155 | "allocated_amount":source_doc.rounded_total
156 | })
157 |
158 | from frappe.model.mapper import get_mapped_doc
159 | doclist = get_mapped_doc("Purchase Order", source_name,{
160 | "Purchase Order": {
161 | "postprocess": set_supplier,
162 | "doctype": "Outward Bank Payment",
163 | "field_map": {
164 | "supplier": "party",
165 | "name" : "remarks",
166 | "grand_total" : "amount"
167 | }
168 | }
169 |
170 | }, target_doc)
171 | return doclist
172 | else:
173 | frappe.throw(_(f'{supplier} ' "have no bank account"))
174 |
175 | @frappe.whitelist()
176 | def get_outstanding_reference_documents(args):
177 |
178 | if isinstance(args, string_types):
179 | args = json.loads(args)
180 |
181 | if args.get('party_type') == 'Member':
182 | return
183 |
184 | args['party_account'] = frappe.db.get_value('Account', {'account_type': 'Payable','is_group': 0, 'company': args.get('company')})
185 |
186 | # confirm that Supplier is not blocked
187 | if args.get('party_type') == 'Supplier':
188 | supplier_status = get_supplier_block_status(args['party'])
189 | if supplier_status['on_hold']:
190 | if supplier_status['hold_type'] == 'All':
191 | return []
192 | elif supplier_status['hold_type'] == 'Payments':
193 | if not supplier_status['release_date'] or getdate(nowdate()) <= supplier_status['release_date']:
194 | return []
195 |
196 | party_account_currency = get_account_currency(args.get("party_account"))
197 | company_currency = frappe.get_cached_value('Company', args.get("company"), "default_currency")
198 |
199 | # Get negative outstanding sales /purchase invoices
200 | negative_outstanding_invoices = []
201 | if args.get("party_type") not in ["Student", "Employee"] and not args.get("voucher_no"):
202 | negative_outstanding_invoices = get_negative_outstanding_invoices(args.get("party_type"), args.get("party"),
203 | args.get("party_account"), args.get("company"), party_account_currency, company_currency)
204 |
205 | # Get positive outstanding sales /purchase invoices/ Fees
206 | condition = ""
207 | if args.get("voucher_type") and args.get("voucher_no"):
208 | condition = " and voucher_type={0} and voucher_no={1}"\
209 | .format(frappe.db.escape(args["voucher_type"]), frappe.db.escape(args["voucher_no"]))
210 |
211 | # Add cost center condition
212 | if args.get("cost_center"):
213 | condition += " and cost_center='%s'" % args.get("cost_center")
214 |
215 | date_fields_dict = {
216 | 'posting_date': ['from_posting_date', 'to_posting_date'],
217 | 'due_date': ['from_due_date', 'to_due_date']
218 | }
219 |
220 | for fieldname, date_fields in date_fields_dict.items():
221 | if args.get(date_fields[0]) and args.get(date_fields[1]):
222 | condition += " and {0} between '{1}' and '{2}'".format(fieldname,
223 | args.get(date_fields[0]), args.get(date_fields[1]))
224 |
225 | if args.get("company"):
226 | condition += " and company = {0}".format(frappe.db.escape(args.get("company")))
227 |
228 | outstanding_invoices = get_outstanding_invoices(args.get("party_type"), args.get("party"),
229 | args.get("party_account"), filters=args, condition=condition)
230 |
231 | for d in outstanding_invoices:
232 | d["exchange_rate"] = 1
233 | if party_account_currency != company_currency:
234 | if d.voucher_type in ("Sales Invoice", "Purchase Invoice", "Expense Claim"):
235 | d["exchange_rate"] = frappe.db.get_value(d.voucher_type, d.voucher_no, "conversion_rate")
236 | elif d.voucher_type == "Journal Entry":
237 | d["exchange_rate"] = get_exchange_rate(
238 | party_account_currency, company_currency, d.posting_date
239 | )
240 | if d.voucher_type in ("Purchase Invoice"):
241 | d["bill_no"] = frappe.db.get_value(d.voucher_type, d.voucher_no, "bill_no")
242 |
243 | # Get all SO / PO which are not fully billed or aginst which full advance not paid
244 | orders_to_be_billed = []
245 | if (args.get("party_type") != "Student"):
246 | orders_to_be_billed = get_orders_to_be_billed(args.get("posting_date"),args.get("party_type"),
247 | args.get("party"), args.get("company"), party_account_currency, company_currency, filters=args)
248 |
249 | data = negative_outstanding_invoices + outstanding_invoices + orders_to_be_billed
250 | if not data:
251 | frappe.msgprint(_("No outstanding invoices found for the {0} {1} which qualify the filters you have specified.")
252 | .format(args.get("party_type").lower(), frappe.bold(args.get("party"))))
253 |
254 | return data
255 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/outward_bank_payment/test_outward_bank_payment.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright (c) 2021, Aerele and Contributors
3 | # See license.txt
4 | from __future__ import unicode_literals
5 |
6 | # import frappe
7 | import unittest
8 |
9 | class TestOutwardBankPayment(unittest.TestCase):
10 | pass
11 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/outward_bank_payment_details/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aerele/bank_api_integration/cd87ffb49618512f08c93d0dc297bb1edc220128/bank_api_integration/bank_api_integration/doctype/outward_bank_payment_details/__init__.py
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/outward_bank_payment_details/outward_bank_payment_details.json:
--------------------------------------------------------------------------------
1 | {
2 | "actions": [],
3 | "creation": "2021-03-11 18:08:00.839710",
4 | "doctype": "DocType",
5 | "editable_grid": 1,
6 | "engine": "InnoDB",
7 | "field_order": [
8 | "party_type",
9 | "party",
10 | "amount",
11 | "remarks",
12 | "status",
13 | "outward_bank_payment"
14 | ],
15 | "fields": [
16 | {
17 | "columns": 2,
18 | "fieldname": "party_type",
19 | "fieldtype": "Link",
20 | "in_list_view": 1,
21 | "label": "Party Type",
22 | "options": "DocType"
23 | },
24 | {
25 | "columns": 2,
26 | "fieldname": "party",
27 | "fieldtype": "Dynamic Link",
28 | "in_list_view": 1,
29 | "label": "Party",
30 | "options": "party_type"
31 | },
32 | {
33 | "columns": 2,
34 | "fieldname": "amount",
35 | "fieldtype": "Currency",
36 | "in_list_view": 1,
37 | "label": "Amount"
38 | },
39 | {
40 | "columns": 2,
41 | "fieldname": "status",
42 | "fieldtype": "Data",
43 | "in_list_view": 1,
44 | "label": "Status",
45 | "no_copy": 1,
46 | "read_only": 1
47 | },
48 | {
49 | "columns": 2,
50 | "fieldname": "outward_bank_payment",
51 | "fieldtype": "Link",
52 | "in_list_view": 1,
53 | "label": "Outward Bank Payment",
54 | "no_copy": 1,
55 | "options": "Outward Bank Payment",
56 | "read_only": 1
57 | },
58 | {
59 | "columns": 2,
60 | "fieldname": "remarks",
61 | "fieldtype": "Small Text",
62 | "label": "Remarks"
63 | }
64 | ],
65 | "index_web_pages_for_search": 1,
66 | "istable": 1,
67 | "links": [],
68 | "modified": "2021-05-30 16:04:49.325738",
69 | "modified_by": "Administrator",
70 | "module": "Bank Api Integration",
71 | "name": "Outward Bank Payment Details",
72 | "owner": "Administrator",
73 | "permissions": [],
74 | "quick_entry": 1,
75 | "sort_field": "modified",
76 | "sort_order": "DESC",
77 | "track_changes": 1
78 | }
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/outward_bank_payment_details/outward_bank_payment_details.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright (c) 2021, Aerele 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 OutwardBankPaymentDetails(Document):
10 | pass
11 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/payment_references/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aerele/bank_api_integration/cd87ffb49618512f08c93d0dc297bb1edc220128/bank_api_integration/bank_api_integration/doctype/payment_references/__init__.py
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/payment_references/payment_references.json:
--------------------------------------------------------------------------------
1 | {
2 | "actions": [],
3 | "creation": "2021-03-15 07:04:32.035835",
4 | "doctype": "DocType",
5 | "editable_grid": 1,
6 | "engine": "InnoDB",
7 | "field_order": [
8 | "reference_doctype",
9 | "reference_name",
10 | "due_date",
11 | "bill_no",
12 | "payment_term",
13 | "column_break_4",
14 | "total_amount",
15 | "outstanding_amount",
16 | "allocated_amount",
17 | "exchange_rate"
18 | ],
19 | "fields": [
20 | {
21 | "columns": 2,
22 | "fieldname": "reference_doctype",
23 | "fieldtype": "Link",
24 | "in_list_view": 1,
25 | "label": "Type",
26 | "options": "DocType",
27 | "reqd": 1
28 | },
29 | {
30 | "columns": 2,
31 | "fieldname": "reference_name",
32 | "fieldtype": "Dynamic Link",
33 | "in_global_search": 1,
34 | "in_list_view": 1,
35 | "label": "Name",
36 | "options": "reference_doctype",
37 | "reqd": 1
38 | },
39 | {
40 | "fieldname": "due_date",
41 | "fieldtype": "Date",
42 | "label": "Due Date",
43 | "read_only": 1
44 | },
45 | {
46 | "fieldname": "bill_no",
47 | "fieldtype": "Data",
48 | "label": "Supplier Invoice No",
49 | "no_copy": 1,
50 | "read_only": 1
51 | },
52 | {
53 | "fieldname": "payment_term",
54 | "fieldtype": "Link",
55 | "label": "Payment Term",
56 | "options": "Payment Term"
57 | },
58 | {
59 | "fieldname": "column_break_4",
60 | "fieldtype": "Column Break"
61 | },
62 | {
63 | "columns": 2,
64 | "fieldname": "total_amount",
65 | "fieldtype": "Float",
66 | "in_list_view": 1,
67 | "label": "Total Amount",
68 | "print_hide": 1,
69 | "read_only": 1
70 | },
71 | {
72 | "columns": 2,
73 | "fieldname": "outstanding_amount",
74 | "fieldtype": "Float",
75 | "in_list_view": 1,
76 | "label": "Outstanding",
77 | "read_only": 1
78 | },
79 | {
80 | "columns": 2,
81 | "fieldname": "allocated_amount",
82 | "fieldtype": "Float",
83 | "in_list_view": 1,
84 | "label": "Allocated"
85 | },
86 | {
87 | "depends_on": "eval:(doc.reference_doctype=='Purchase Invoice')",
88 | "fieldname": "exchange_rate",
89 | "fieldtype": "Float",
90 | "label": "Exchange Rate",
91 | "print_hide": 1,
92 | "read_only": 1
93 | }
94 | ],
95 | "index_web_pages_for_search": 1,
96 | "istable": 1,
97 | "links": [],
98 | "modified": "2021-03-15 07:04:32.035835",
99 | "modified_by": "Administrator",
100 | "module": "Bank Api Integration",
101 | "name": "Payment References",
102 | "owner": "Administrator",
103 | "permissions": [],
104 | "quick_entry": 1,
105 | "sort_field": "modified",
106 | "sort_order": "DESC",
107 | "track_changes": 1
108 | }
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/doctype/payment_references/payment_references.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | # Copyright (c) 2021, Aerele 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 PaymentReferences(Document):
10 | pass
11 |
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/patches/v1/defaults.py:
--------------------------------------------------------------------------------
1 | from __future__ import unicode_literals
2 |
3 | def execute():
4 | from bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration import create_defaults
5 | create_defaults()
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/utils/js/bank_account.js:
--------------------------------------------------------------------------------
1 | frappe.ui.form.on("Bank Account", {
2 | fetch_balance: function(frm){
3 | frappe.call({
4 | method: "bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.fetch_balance",
5 | freeze: true,
6 | args: {bank_account: frm.doc.name},
7 | callback: function(r) {
8 | frm.reload_doc();
9 | }
10 | })
11 | },
12 | fetch_account_statement: function(frm){
13 | frappe.call({
14 | method: "bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.fetch_account_statement",
15 | freeze: true,
16 | args: {bank_account: frm.doc.name},
17 | callback: function(r) {
18 | frm.reload_doc();
19 | }
20 | })
21 | }
22 | })
--------------------------------------------------------------------------------
/bank_api_integration/bank_api_integration/utils/js/common_fields.js:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2019, Aerele Technologies Private Limited and contributors
2 | // For license information, please see license.txt
3 | frappe.ui.form.on(cur_frm.doctype,{
4 | onload: function(frm) {
5 | frm.set_query("company_bank_account", function() {
6 | return {
7 | query: "bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.get_company_bank_account",
8 | filters: {
9 | "company":frm.doc.company,
10 | "is_company_account": 1
11 | }
12 | };
13 | });
14 | }})
--------------------------------------------------------------------------------
/bank_api_integration/config/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aerele/bank_api_integration/cd87ffb49618512f08c93d0dc297bb1edc220128/bank_api_integration/config/__init__.py
--------------------------------------------------------------------------------
/bank_api_integration/config/desktop.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 | from frappe import _
4 |
5 | def get_data():
6 | return [
7 | {
8 | "module_name": "Bank Api Integration",
9 | "color": "grey",
10 | "icon": "octicon octicon-file-directory",
11 | "type": "module",
12 | "label": _("Bank Api Integration")
13 | }
14 | ]
15 |
--------------------------------------------------------------------------------
/bank_api_integration/config/docs.py:
--------------------------------------------------------------------------------
1 | """
2 | Configuration for docs
3 | """
4 |
5 | # source_link = "https://github.com/[org_name]/bank_api_integration"
6 | # docs_base_url = "https://[org_name].github.io/bank_api_integration"
7 | # headline = "App that does everything"
8 | # sub_heading = "Yes, you got that right the first time, everything"
9 |
10 | def get_context(context):
11 | context.brand_html = "Bank Api Integration"
12 |
--------------------------------------------------------------------------------
/bank_api_integration/hooks.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from __future__ import unicode_literals
3 | from . import __version__ as app_version
4 |
5 | app_name = "bank_api_integration"
6 | app_title = "Bank Api Integration"
7 | app_publisher = "Aerele"
8 | app_description = "Implementation of bank api integration"
9 | app_icon = "octicon octicon-file-directory"
10 | app_color = "grey"
11 | app_email = "admin@aerele.in"
12 | app_license = "MIT"
13 |
14 | # Includes in
15 | # ------------------
16 |
17 | # include js, css files in header of desk.html
18 | # app_include_css = "/assets/bank_api_integration/css/bank_api_integration.css"
19 | # app_include_js = "/assets/bank_api_integration/js/bank_api_integration.js"
20 |
21 | # include js, css files in header of web template
22 | # web_include_css = "/assets/bank_api_integration/css/bank_api_integration.css"
23 | # web_include_js = "/assets/bank_api_integration/js/bank_api_integration.js"
24 |
25 | # include custom scss in every website theme (without file extension ".scss")
26 | # website_theme_scss = "bank_api_integration/public/scss/website"
27 |
28 | # include js, css files in header of web form
29 | # webform_include_js = {"doctype": "public/js/doctype.js"}
30 | # webform_include_css = {"doctype": "public/css/doctype.css"}
31 |
32 | # include js in page
33 | # page_js = {"page" : "public/js/file.js"}
34 |
35 | # include js in doctype views
36 | # doctype_js = {"doctype" : "public/js/doctype.js"}
37 | # doctype_list_js = {"doctype" : "public/js/doctype_list.js"}
38 | # doctype_tree_js = {"doctype" : "public/js/doctype_tree.js"}
39 | # doctype_calendar_js = {"doctype" : "public/js/doctype_calendar.js"}
40 |
41 | # Home Pages
42 | # ----------
43 |
44 | # application home page (will override Website Settings)
45 | # home_page = "login"
46 |
47 | # website user home page (by Role)
48 | # role_home_page = {
49 | # "Role": "home_page"
50 | # }
51 |
52 | # Generators
53 | # ----------
54 |
55 | # automatically create page for each record of this doctype
56 | # website_generators = ["Web Page"]
57 |
58 | # Installation
59 | # ------------
60 |
61 | # before_install = "bank_api_integration.install.before_install"
62 | after_install = "bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.create_defaults"
63 |
64 | # Desk Notifications
65 | # ------------------
66 | # See frappe.core.notifications.get_notification_config
67 |
68 | # notification_config = "bank_api_integration.notifications.get_notification_config"
69 |
70 | # Permissions
71 | # -----------
72 | # Permissions evaluated in scripted ways
73 |
74 | # permission_query_conditions = {
75 | # "Event": "frappe.desk.doctype.event.event.get_permission_query_conditions",
76 | # }
77 | #
78 | # has_permission = {
79 | # "Event": "frappe.desk.doctype.event.event.has_permission",
80 | # }
81 |
82 | # DocType Class
83 | # ---------------
84 | # Override standard doctype classes
85 |
86 | # override_doctype_class = {
87 | # "ToDo": "custom_app.overrides.CustomToDo"
88 | # }
89 |
90 | # Document Events
91 | # ---------------
92 | # Hook on document methods and events
93 |
94 | # doc_events = {
95 | # "*": {
96 | # "on_update": "method",
97 | # "on_cancel": "method",
98 | # "on_trash": "method"
99 | # }
100 | # }
101 |
102 | # Scheduled Tasks
103 | # ---------------
104 |
105 | scheduler_events = {
106 | "cron": {
107 | "0/30 * * * *": [
108 | "bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.update_transaction_status",
109 | "bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.fetch_balance",
110 | "bank_api_integration.bank_api_integration.doctype.bank_api_integration.bank_api_integration.fetch_account_statement"
111 | ]
112 | }
113 | }
114 | # "all": [
115 | # "bank_api_integration.tasks.all"
116 | # ],
117 | # "daily": [
118 | # "bank_api_integration.tasks.daily"
119 | # ],
120 | # "hourly": [
121 | # "bank_api_integration.tasks.hourly"
122 | # ],
123 | # "weekly": [
124 | # "bank_api_integration.tasks.weekly"
125 | # ]
126 | # "monthly": [
127 | # "bank_api_integration.tasks.monthly"
128 | # ]
129 | # }
130 |
131 | # Testing
132 | # -------
133 |
134 | # before_tests = "bank_api_integration.install.before_tests"
135 |
136 | # Overriding Methods
137 | # ------------------------------
138 | #
139 | # override_whitelisted_methods = {
140 | # "frappe.desk.doctype.event.event.get_events": "bank_api_integration.event.get_events"
141 | # }
142 | #
143 | # each overriding function accepts a `data` argument;
144 | # generated from the base implementation of the doctype dashboard,
145 | # along with any modifications made in other Frappe apps
146 | # override_doctype_dashboards = {
147 | # "Task": "bank_api_integration.task.get_dashboard_data"
148 | # }
149 |
150 | # exempt linked doctypes from being automatically cancelled
151 | #
152 | # auto_cancel_exempted_doctypes = ["Auto Repeat"]
153 | doctype_js = {
154 | "Bank Account": "bank_api_integration/utils/js/bank_account.js",
155 | "Purchase Invoice" : "bank_api_integration/custom/js/purchase_invoice.js",
156 | "Purchase Order" : "bank_api_integration/custom/js/purchase_order.js"
157 | }
--------------------------------------------------------------------------------
/bank_api_integration/modules.txt:
--------------------------------------------------------------------------------
1 | Bank Api Integration
--------------------------------------------------------------------------------
/bank_api_integration/patches.txt:
--------------------------------------------------------------------------------
1 | bank_api_integration.bank_api_integration.patches.v1.defaults #10-06-2021
--------------------------------------------------------------------------------
/bank_api_integration/templates/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aerele/bank_api_integration/cd87ffb49618512f08c93d0dc297bb1edc220128/bank_api_integration/templates/__init__.py
--------------------------------------------------------------------------------
/bank_api_integration/templates/pages/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/aerele/bank_api_integration/cd87ffb49618512f08c93d0dc297bb1edc220128/bank_api_integration/templates/pages/__init__.py
--------------------------------------------------------------------------------
/license.txt:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 |
635 | Copyright (C)
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | Copyright (C)
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
675 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | frappe
2 | banking_api@git+https://github.com/aerele/bankingapi.git@master
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | # -*- coding: utf-8 -*-
2 | from setuptools import setup, find_packages
3 |
4 | with open('requirements.txt') as f:
5 | install_requires = f.read().strip().split('\n')
6 |
7 | # get version from __version__ variable in bank_api_integration/__init__.py
8 | from bank_api_integration import __version__ as version
9 |
10 | setup(
11 | name='bank_api_integration',
12 | version=version,
13 | description='Implementation of bank api integration',
14 | author='Aerele',
15 | author_email='admin@aerele.in',
16 | packages=find_packages(),
17 | zip_safe=False,
18 | include_package_data=True,
19 | install_requires=install_requires,
20 | python_requires='>=3.6'
21 | )
22 |
--------------------------------------------------------------------------------