fix: create payment entry against payment request
diff --git a/erpnext/accounts/doctype/payment_entry/payment_entry.py b/erpnext/accounts/doctype/payment_entry/payment_entry.py
index 11ab020..b7d80ae 100644
--- a/erpnext/accounts/doctype/payment_entry/payment_entry.py
+++ b/erpnext/accounts/doctype/payment_entry/payment_entry.py
@@ -950,12 +950,12 @@
 
 
 @frappe.whitelist()
-def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=None):
+def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=None, mode_of_payment=None):
 	doc = frappe.get_doc(dt, dn)
 	if dt in ("Sales Order", "Purchase Order") and flt(doc.per_billed, 2) > 0:
 		frappe.throw(_("Can only make payment against unbilled {0}").format(dt))
 
-	if dt in ("Sales Invoice", "Sales Order", "Dunning"):
+	if dt in ("Sales Invoice", "Sales Order", "Dunning", "POS Invoice"):
 		party_type = "Customer"
 	elif dt in ("Purchase Invoice", "Purchase Order"):
 		party_type = "Supplier"
@@ -965,7 +965,7 @@
 		party_type = "Student"
 
 	# party account
-	if dt == "Sales Invoice":
+	if dt in ["Sales Invoice", "POS Invoice"]:
 		party_account = get_party_account_based_on_invoice_discounting(dn) or doc.debit_to
 	elif dt == "Purchase Invoice":
 		party_account = doc.credit_to
@@ -984,7 +984,7 @@
 		party_account_currency = doc.get("party_account_currency") or get_account_currency(party_account)
 
 	# payment type
-	if (dt == "Sales Order" or (dt in ("Sales Invoice", "Fees", "Dunning") and doc.outstanding_amount > 0)) \
+	if (dt == "Sales Order" or (dt in ("Sales Invoice", "Fees", "Dunning", "POS Invoice") and doc.outstanding_amount > 0)) \
 		or (dt=="Purchase Invoice" and doc.outstanding_amount < 0):
 			payment_type = "Receive"
 	else:
@@ -994,7 +994,7 @@
 	grand_total = outstanding_amount = 0
 	if party_amount:
 		grand_total = outstanding_amount = party_amount
-	elif dt in ("Sales Invoice", "Purchase Invoice"):
+	elif dt in ("Sales Invoice", "Purchase Invoice", "POS Invoice"):
 		if party_account_currency == doc.company_currency:
 			grand_total = doc.base_rounded_total or doc.base_grand_total
 		else:
@@ -1021,11 +1021,11 @@
 		outstanding_amount = grand_total - flt(doc.advance_paid)
 
 	# bank or cash
-	bank = get_default_bank_cash_account(doc.company, "Bank", mode_of_payment=doc.get("mode_of_payment"),
+	bank = get_default_bank_cash_account(doc.company, "Bank", mode_of_payment=doc.get("mode_of_payment", mode_of_payment),
 		account=bank_account)
 
 	if not bank:
-		bank = get_default_bank_cash_account(doc.company, "Cash", mode_of_payment=doc.get("mode_of_payment"),
+		bank = get_default_bank_cash_account(doc.company, "Cash", mode_of_payment=doc.get("mode_of_payment", mode_of_payment),
 			account=bank_account)
 
 	paid_amount = received_amount = 0
@@ -1050,7 +1050,7 @@
 	pe.company = doc.company
 	pe.cost_center = doc.get("cost_center")
 	pe.posting_date = nowdate()
-	pe.mode_of_payment = doc.get("mode_of_payment")
+	pe.mode_of_payment = doc.get("mode_of_payment", mode_of_payment)
 	pe.party_type = party_type
 	pe.party = doc.get(scrub(party_type))
 	pe.contact_person = doc.get("contact_person")
diff --git a/erpnext/accounts/doctype/payment_request/payment_request.py b/erpnext/accounts/doctype/payment_request/payment_request.py
index 8eba647..d01f298 100644
--- a/erpnext/accounts/doctype/payment_request/payment_request.py
+++ b/erpnext/accounts/doctype/payment_request/payment_request.py
@@ -165,7 +165,7 @@
 
 		ref_doc = frappe.get_doc(self.reference_doctype, self.reference_name)
 
-		if self.reference_doctype == "Sales Invoice":
+		if self.reference_doctype in ["Sales Invoice", "POS Invoice"]:
 			party_account = ref_doc.debit_to
 		elif self.reference_doctype == "Purchase Invoice":
 			party_account = ref_doc.credit_to
@@ -180,8 +180,8 @@
 		else:
 			party_amount = self.grand_total
 
-		payment_entry = get_payment_entry(self.reference_doctype, self.reference_name,
-			party_amount=party_amount, bank_account=self.payment_account, bank_amount=bank_amount)
+		payment_entry = get_payment_entry(self.reference_doctype, self.reference_name, party_amount=party_amount,
+			bank_account=self.payment_account, bank_amount=bank_amount, mode_of_payment=self.mode_of_payment)
 
 		payment_entry.update({
 			"reference_no": self.name,
@@ -269,7 +269,7 @@
 
 			# if shopping cart enabled and in session
 			if (shopping_cart_settings.enabled and hasattr(frappe.local, "session")
-				and frappe.local.session.user != "Guest"):
+				and frappe.local.session.user != "Guest") and  self.payment_channel != "Phone":
 
 				success_url = shopping_cart_settings.payment_success_url
 				if success_url:
diff --git a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
index 155b95e..73cf118 100644
--- a/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
+++ b/erpnext/accounts/doctype/pos_invoice/pos_invoice.py
@@ -316,8 +316,13 @@
 
 	def create_payment_request(self):
 		for pay in self.payments:
-
 			if pay.type == "Phone":
+				if pay.amount <= 0:
+					frappe.throw(_("Payment amount cannot be less than or equal to 0"))
+
+				if not self.contact_mobile:
+					frappe.throw(_("Please enter the phone number first"))
+
 				payment_gateway = frappe.db.get_value("Payment Gateway Account", {
 					"payment_account": pay.account,
 				})
diff --git a/erpnext/erpnext_integrations/utils.py b/erpnext/erpnext_integrations/utils.py
index 78a5fce..e278fd7 100644
--- a/erpnext/erpnext_integrations/utils.py
+++ b/erpnext/erpnext_integrations/utils.py
@@ -43,7 +43,7 @@
 
 	return server_url
 
-def create_mode_of_payment(gateway):
+def create_mode_of_payment(gateway, payment_type="General"):
 	payment_gateway_account = frappe.db.get_value("Payment Gateway Account", {
 			"payment_gateway": gateway
 		}, ['payment_account'])
@@ -53,11 +53,11 @@
 			"doctype": "Mode of Payment",
 			"mode_of_payment": gateway,
 			"enabled": 1,
-			"type": "General",
-			"account": {
+			"type": payment_type,
+			"accounts": [{
 				"doctype": "Mode of Payment Account",
 				"company": get_default_company(),
 				"default_account": payment_gateway_account
-			}
+			}]
 		})
 		mode_of_payment.insert(ignore_permissions=True)
\ No newline at end of file
diff --git a/erpnext/selling/page/point_of_sale/pos_payment.js b/erpnext/selling/page/point_of_sale/pos_payment.js
index 35cd408..915564c 100644
--- a/erpnext/selling/page/point_of_sale/pos_payment.js
+++ b/erpnext/selling/page/point_of_sale/pos_payment.js
@@ -175,21 +175,21 @@
 		})
 
 		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();
+			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")
-			// }
+			if (data["ResultCode"] == 0) {
+				title = __("Payment Received");
+				$('[data-fieldname=request_for_payment]').text("Paid")
+				cur_pos.submit()
+			}
 
-			// frappe.msgprint({
-			// 	"message": message,
-			// 	"title": title
-			// });
+			frappe.msgprint({
+				"message": message,
+				"title": title
+			});
 		});
 
 		this.$payment_modes.on('click', '.shortcut', function(e) {