fix: bind callback callback for realtime event
This commit is contained in:
parent
97ab96c8bf
commit
4eb215badb
@ -84,11 +84,10 @@ class PaymentRequest(Document):
|
||||
elif self.payment_channel == "Phone":
|
||||
controller = get_payment_gateway_controller(self.payment_gateway)
|
||||
payment_record = dict(
|
||||
reference_doctype=self.reference_doctype,
|
||||
reference_docname=self.reference_name,
|
||||
reference_doctype="Payment Request",
|
||||
reference_docname=self.name,
|
||||
grand_total=self.grand_total,
|
||||
sender=self.email_to,
|
||||
payment_request_name=self.name,
|
||||
currency=self.currency,
|
||||
payment_gateway=self.payment_gateway
|
||||
)
|
||||
|
@ -142,6 +142,23 @@ erpnext.selling.POSInvoiceController = erpnext.selling.SellingController.extend(
|
||||
frm: cur_frm
|
||||
})
|
||||
},
|
||||
|
||||
request_for_payment: function (frm) {
|
||||
frm.save().then(() => {
|
||||
frappe.dom.freeze();
|
||||
frappe.call({
|
||||
method: 'create_payment_request',
|
||||
doc: frm.doc,
|
||||
})
|
||||
.fail(() => {
|
||||
frappe.dom.unfreeze();
|
||||
frappe.msgprint('Payment request failed');
|
||||
})
|
||||
.then(() => {
|
||||
frappe.msgprint('Payment request sent successfully');
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
|
||||
$.extend(cur_frm.cscript, new erpnext.selling.POSInvoiceController({ frm: cur_frm }))
|
||||
|
@ -174,6 +174,24 @@ erpnext.PointOfSale.Payment = class {
|
||||
}
|
||||
})
|
||||
|
||||
frappe.realtime.on("process_phone_payments", function(data) {
|
||||
frappe.msgprint({message: 'help', title:'now'})
|
||||
// frappe.dom.unfreeze();
|
||||
// let message = data["ResultDesc"];
|
||||
// let title = __("Payment Failed");
|
||||
// const frm = me.events.get_frm();
|
||||
|
||||
// if (data["ResultCode"] == 0) {
|
||||
// title = __("Payment Received");
|
||||
// $('[data-fieldname=request_for_payment]').text("Paid")
|
||||
// }
|
||||
|
||||
// frappe.msgprint({
|
||||
// "message": message,
|
||||
// "title": title
|
||||
// });
|
||||
});
|
||||
|
||||
this.$payment_modes.on('click', '.shortcut', function(e) {
|
||||
const value = $(this).attr('data-value');
|
||||
me.selected_mode.set_value(value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user