Skip to content

Commit

Permalink
Add account link api to SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
solancer committed Aug 11, 2020
1 parent 34720ba commit d46844d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 1 deletion.
1 change: 1 addition & 0 deletions paypayopa/constants/url.py
Expand Up @@ -3,3 +3,4 @@ class URL(object):
PRODUCTION_BASE_URL = 'https://api.paypay.ne.jp/v2'
CODE = "/codes"
PAYMENT = "/payments"
ACCOUNT_LINK = "/qr/sessions"
4 changes: 4 additions & 0 deletions paypayopa/resources/__init__.py
@@ -1,5 +1,9 @@
from .code import Code
from .payments import Payment
from .account import Account

__all__ = [
'Code',
'Payment',
'Account',
]
25 changes: 25 additions & 0 deletions paypayopa/resources/account.py
@@ -0,0 +1,25 @@
from .base import Resource
from ..constants.url import URL


class Account(Resource):
def __init__(self, client=None):
super(Account, self).__init__(client)
self.base_url = URL.ACCOUNT_LINK

def create_qr_session(self, data={}, **kwargs):
url = self.base_url
if "scopes" not in data:
raise ValueError("\x1b[31m MISSING REQUEST PARAMS "
"\x1b[0m for scopes")
if "nonce" not in data:
raise ValueError("\x1b[31m MISSING REQUEST PARAMS "
"\x1b[0m for nonce")
if "redirectUrl" not in data:
raise ValueError("\x1b[31m MISSING REQUEST PARAMS "
"\x1b[0m for redirectUrl")
if "referenceId" not in data:
raise ValueError("\x1b[31m MISSING REQUEST PARAMS "
"\x1b[0m for referenceId")
return self.post_url(url, data, **kwargs)

2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -7,7 +7,7 @@

setup(
name="paypayopa",
version="1.0",
version="0.2.1",
description="PayPay OPA SDK",
long_description=long_description,
long_description_content_type='text/markdown',
Expand Down

0 comments on commit d46844d

Please sign in to comment.