File payment.py
has 337 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import omise
import paypalrestsdk
import requests
- Create a ticketCreate a ticket
Function get_credentials
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_credentials(event=None):
"""
If the event parameter is None, It returns the secret and publishable key of the Admin's Stripe account.
Else, it returns the corresponding values for the event organizer's account.
:param event:
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this function. Open
return None
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return True, None
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return False, 'Payment Not Found'
- Create a ticketCreate a ticket
Avoid too many return
statements within this function. Open
return False, 'Payment already been verified'
- Create a ticketCreate a ticket
Function verify_payment
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def verify_payment(payment_id, order):
"""
Verify Paypal payment one more time for paying with Paypal in mobile client
"""
PayPalPaymentsManager.configure_paypal()
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function configure_paypal
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def configure_paypal():
"""
Configure the paypal sdk
:return: Credentials
"""
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function get_payment_intent_stripe
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_payment_intent_stripe(order_invoice, currency=None, credentials=None):
"""
Capture payments through stripe.
:param order_invoice: Order to be charged for
:param currency: Currency of the order amount.
- Read upRead up
- Create a ticketCreate a ticket
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"