feat: added membership settings doctype
This commit is contained in:
parent
f528aef49c
commit
1f20f6348d
@ -0,0 +1,12 @@
|
|||||||
|
// Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
// For license information, please see license.txt
|
||||||
|
|
||||||
|
frappe.ui.form.on('Membership Settings', {
|
||||||
|
refresh: function(frm) {
|
||||||
|
// if (frm.doc.enable_razorpay) {
|
||||||
|
// frm.add_custom_button(__("Fetch Plans from RazorPay"), () => {
|
||||||
|
// frm.trigger("fetch_razorpay_plans")
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
});
|
@ -0,0 +1,89 @@
|
|||||||
|
{
|
||||||
|
"actions": [],
|
||||||
|
"creation": "2020-03-29 12:57:03.005120",
|
||||||
|
"doctype": "DocType",
|
||||||
|
"editable_grid": 1,
|
||||||
|
"engine": "InnoDB",
|
||||||
|
"field_order": [
|
||||||
|
"enable_razorpay",
|
||||||
|
"razorpay_settings_section",
|
||||||
|
"billing_cycle",
|
||||||
|
"billing_frequency",
|
||||||
|
"column_break_2",
|
||||||
|
"auto_capture_payment",
|
||||||
|
"create_subscription",
|
||||||
|
"auto_create_invoice"
|
||||||
|
],
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldname": "billing_cycle",
|
||||||
|
"fieldtype": "Select",
|
||||||
|
"label": "Billing Cycle",
|
||||||
|
"options": "Monthly\nYearly"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldname": "column_break_2",
|
||||||
|
"fieldtype": "Column Break"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "enable_razorpay",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Enable RazorPay For Memberships"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "create_subscription",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Create Subscription"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"depends_on": "eval:doc.enable_razorpay",
|
||||||
|
"fieldname": "auto_capture_payment",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Auto Capture Payment"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"default": "0",
|
||||||
|
"fieldname": "auto_create_invoice",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Auto Create Invoice"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"depends_on": "eval:doc.enable_razorpay",
|
||||||
|
"fieldname": "razorpay_settings_section",
|
||||||
|
"fieldtype": "Section Break",
|
||||||
|
"label": "RazorPay Settings"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "The number of billing cycles for which the customer should be charged. For example, if a customer is buying a 1-year membership that should be billed on a monthly basis, this value should be 12.",
|
||||||
|
"fieldname": "billing_frequency",
|
||||||
|
"fieldtype": "Data",
|
||||||
|
"label": "Billing Frequency"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"issingle": 1,
|
||||||
|
"links": [],
|
||||||
|
"modified": "2020-03-30 16:02:00.060583",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"module": "Non Profit",
|
||||||
|
"name": "Membership Settings",
|
||||||
|
"owner": "Administrator",
|
||||||
|
"permissions": [
|
||||||
|
{
|
||||||
|
"create": 1,
|
||||||
|
"delete": 1,
|
||||||
|
"email": 1,
|
||||||
|
"print": 1,
|
||||||
|
"read": 1,
|
||||||
|
"role": "System Manager",
|
||||||
|
"share": 1,
|
||||||
|
"write": 1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"quick_entry": 1,
|
||||||
|
"sort_field": "modified",
|
||||||
|
"sort_order": "DESC",
|
||||||
|
"track_changes": 1
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and contributors
|
||||||
|
# For license information, please see license.txt
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import frappe
|
||||||
|
from frappe.integrations.utils import get_payment_gateway_controller
|
||||||
|
from frappe.model.document import Document
|
||||||
|
|
||||||
|
class MembershipSettings(Document):
|
||||||
|
pass
|
||||||
|
|
||||||
|
@frappe.whitelist()
|
||||||
|
def get_plans_for_membership(*args, **kwargs):
|
||||||
|
controller = get_payment_gateway_controller("Razorpay")
|
||||||
|
plans = controller.get_plans()
|
||||||
|
return [plan.get("item") for plan in plans.get("items")]
|
@ -0,0 +1,10 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (c) 2020, Frappe Technologies Pvt. Ltd. and Contributors
|
||||||
|
# See license.txt
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
# import frappe
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
class TestMembershipSettings(unittest.TestCase):
|
||||||
|
pass
|
Loading…
Reference in New Issue
Block a user