From 338a0a9e58c4e669e086439eb400cceb7835e0e1 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Tue, 22 Nov 2016 10:55:32 +0530 Subject: [PATCH] [docs] added some style and some fixes (#2352) --- .../paypal_settings/paypal_settings.py | 34 +++++++++---------- .../razorpay_settings/razorpay_settings.py | 14 ++++---- 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/payments/payment_gateways/doctype/paypal_settings/paypal_settings.py b/payments/payment_gateways/doctype/paypal_settings/paypal_settings.py index 344cb43..df6745a 100644 --- a/payments/payment_gateways/doctype/paypal_settings/paypal_settings.py +++ b/payments/payment_gateways/doctype/paypal_settings/paypal_settings.py @@ -2,15 +2,6 @@ # Copyright (c) 2015, Frappe Technologies and contributors # For license information, please see license.txt -from __future__ import unicode_literals -import frappe -import json -from frappe import _ -from frappe.utils import get_url, call_hook_method -from urllib import urlencode -from frappe.integration_broker.doctype.integration_service.integration_service import IntegrationService -import urllib - """ # Integrating PayPal @@ -63,9 +54,18 @@ More Details: """ +from __future__ import unicode_literals +import frappe +import json +from frappe import _ +from frappe.utils import get_url, call_hook_method +from urllib import urlencode +from frappe.integration_broker.doctype.integration_service.integration_service import IntegrationService +import urllib + class PayPalSettings(IntegrationService): service_name = "PayPal" - + supported_currencies = ["AUD", "BRL", "CAD", "CZK", "DKK", "EUR", "HKD", "HUF", "ILS", "JPY", "MYR", "MXN", "TWD", "NZD", "NOK", "PHP", "PLN", "GBP", "RUB", "SGD", "SEK", "CHF", "THB", "TRY", "USD"] @@ -79,19 +79,19 @@ class PayPalSettings(IntegrationService): def validate(self): if not self.flags.ignore_mandatory: self.validate_paypal_credentails() - + def on_update(self): pass - + def enable(self): call_hook_method('payment_gateway_enabled', gateway=self.service_name) if not self.flags.ignore_mandatory: self.validate_paypal_credentails() - + def validate_transaction_currency(self, currency): if currency not in self.supported_currencies: frappe.throw(_("Please select another payment method. {0} does not support transactions in currency '{1}'").format(self.service_name, currency)) - + def get_paypal_params_and_url(self): params = { "USER": self.api_username, @@ -124,7 +124,7 @@ class PayPalSettings(IntegrationService): except Exception: frappe.throw(_("Invalid payment gateway credentials")) - + def get_payment_url(self, **kwargs): setattr(self, "use_sandbox", kwargs.get("use_sandbox", 0)) @@ -169,13 +169,13 @@ def get_service_details():

Steps to configure Service

    -
  1. Get PayPal api credentials from link: +
  2. Get PayPal api credentials from link: https://developer.paypal.com/docs/classic/api/apiCredentials/

  3. -
  4. Setup credentials on PayPal settings doctype. +
  5. Setup credentials on PayPal settings doctype. Click on top right corner diff --git a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py index 51a843a..d44db1d 100644 --- a/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py +++ b/payments/payment_gateways/doctype/razorpay_settings/razorpay_settings.py @@ -2,13 +2,6 @@ # Copyright (c) 2015, Frappe Technologies and contributors # For license information, please see license.txt -from __future__ import unicode_literals -import frappe -from frappe.utils import get_url, call_hook_method -from frappe import _ -import urllib, json -from frappe.integration_broker.doctype.integration_service.integration_service import IntegrationService - """ # Integrating RazorPay @@ -58,6 +51,13 @@ For razorpay payment status is Authorized """ +from __future__ import unicode_literals +import frappe +from frappe.utils import get_url, call_hook_method +from frappe import _ +import urllib, json +from frappe.integration_broker.doctype.integration_service.integration_service import IntegrationService + class RazorpaySettings(IntegrationService): service_name = "Razorpay" supported_currencies = ["INR"]