[Fixes] payment request url fixes

This commit is contained in:
Saurabh 2015-12-30 15:04:47 +05:30
parent 2ffea6ba94
commit c22e525a14
3 changed files with 6 additions and 62 deletions

View File

@ -177,55 +177,6 @@
"search_index": 0, "search_index": 0,
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "reminder_settings",
"fieldtype": "Section Break",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Reminder Settings",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"description": "In Days",
"fieldname": "reminder_after",
"fieldtype": "Int",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Reminder After",
"length": 0,
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"print_hide_if_no_value": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
} }
], ],
"hide_heading": 0, "hide_heading": 0,
@ -237,8 +188,8 @@
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"max_attachments": 0, "max_attachments": 0,
"modified": "2015-12-24 21:41:05.123141", "modified": "2015-12-30 15:08:47.042197",
"modified_by": "Administrator", "modified_by": "saurabh6790@gmail.com",
"module": "Accounts", "module": "Accounts",
"name": "Payment Gateway Account", "name": "Payment Gateway Account",
"name_case": "", "name_case": "",

View File

@ -5,7 +5,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe.model.document import Document from frappe.model.document import Document
from frappe.utils import flt, nowdate, get_url from frappe.utils import flt, nowdate, get_url, cstr
from frappe import _ from frappe import _
from erpnext.accounts.doctype.journal_entry.journal_entry import (get_payment_entry_against_invoice, from erpnext.accounts.doctype.journal_entry.journal_entry import (get_payment_entry_against_invoice,
get_payment_entry_against_order) get_payment_entry_against_order)
@ -46,7 +46,6 @@ class PaymentRequest(Document):
def send_payment_request(self): def send_payment_request(self):
self.payment_url = get_url("/api/method/erpnext.accounts.doctype.payment_request.payment_request.gererate_payemnt_request?name={0}".format(self.name)) self.payment_url = get_url("/api/method/erpnext.accounts.doctype.payment_request.payment_request.gererate_payemnt_request?name={0}".format(self.name))
if self.payment_url: if self.payment_url:
frappe.db.set_value(self.doctype, self.name, "status", "Initiated") frappe.db.set_value(self.doctype, self.name, "status", "Initiated")
@ -90,7 +89,7 @@ class PaymentRequest(Document):
def get_message(self): def get_message(self):
"""return message with payment gateway link""" """return message with payment gateway link"""
return self.message + self.payment_url if self.payment_url else "" return self.message + """ <a href="%s"> Click here to pay </a>"""%self.payment_url
def set_failed(self): def set_failed(self):
pass pass
@ -149,14 +148,8 @@ def get_reference_doc_details(dt, dn):
def get_amount(ref_doc, dt): def get_amount(ref_doc, dt):
"""get amount based on doctype""" """get amount based on doctype"""
if dt == "Sales Order": if dt == "Sales Order":
# party_account = get_party_account("Customer", ref_doc.get('customer'), ref_doc.company)
# party_account_currency = get_account_currency(party_account)
# if party_account_currency == ref_doc.company_currency:
amount = flt(ref_doc.base_grand_total) - flt(ref_doc.advance_paid) amount = flt(ref_doc.base_grand_total) - flt(ref_doc.advance_paid)
# else:
# amount = flt(ref_doc.grand_total) - flt(ref_doc.advance_paid)
#
if dt == "Sales Invoice": if dt == "Sales Invoice":
amount = abs(ref_doc.outstanding_amount) amount = abs(ref_doc.outstanding_amount)

View File

@ -1,4 +1,4 @@
Payment Request is mediator between payment gateway and erpnext. From Sales Order or Sales Invoice you can initiate Payment Request. Payment Request will act as mediator between Payment Gateway and ERPNext. You can create payment request via Sales Order or Sales Invoice.
- Create Payment Request via Sales Order - Create Payment Request via Sales Order
<img class="screenshot" alt="Payment Request" src="{{docs_base_url}}/assets/img/accounts/pr-from-so.png"> <img class="screenshot" alt="Payment Request" src="{{docs_base_url}}/assets/img/accounts/pr-from-so.png">