GithubHelp home page GithubHelp logo

mangopay / mangopay2-python-sdk Goto Github PK

View Code? Open in Web Editor NEW
32.0 20.0 42.0 1.15 MB

SDK Python for MANGOPAY

Home Page: https://pypi.org/project/mangopaysdk/

License: MIT License

Makefile 0.03% Python 99.97%
payments wallets fintech mangopay sdk-python mangopay-api python

mangopay2-python-sdk's Introduction

MANGOPAY API Known Issues

You can use the issues tab of this repo to follow known issues in our production and sandbox environments.

Feel free to subscribe to an issue to be updated of any changes.

MANGOPAY API Status

For the current status of the API and scheduled maintenance announcements, please see status.mangopay.com

mangopay2-python-sdk's People

Contributors

alexei avatar alexisrobert avatar andrianmoroi avatar andrzej-rojek avatar catacraciun avatar changaco avatar cosmin-margarit avatar dulacp avatar ebewe avatar gabriellupu avatar geelweb avatar hobailey avatar iulian03 avatar lukasz-drzewiecki avatar mangomaxoasis avatar mickaelpois avatar mihaimoiseanu avatar msolovastru-ro avatar namexripple avatar octa-george avatar r0ro avatar raoulsullivan avatar rbarrois avatar saniokonta avatar sbillion avatar silvianagh avatar solojr avatar stefanghivi avatar stephane-klein avatar viviencormier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mangopay2-python-sdk's Issues

Money tranformation

Hello,

If there is a special class for Money objects and it has Decimal amount inside, why don't you do the following transformation automatically?

An amount of money in the smallest sub-division of the currency, e.g. 12.60 EUR would be represented as 1260 whereas 12 JPY would be represented as just 12)

Even this SDK example says:

debited_funds=Money(amount=10, currency='EUR'), # Create a EUR 10.00 transfer

But this is not true, this will create a 0.10 EUR Transaction.

Thanks.

Error when running pip install

When running pip install, I get the following message so it is impossible to install the SDK:

IOError: [Errno 2] No such file or directory: '/tmp/pip-build-0zvymc/python-mangopay/DESCRIPTION.rst'

example in doc Document.all(user_id='an id') doesn't work

Hi,

Your documentation says :

Once you have done with these steps, you will be able to get a list of all the uploaded documents for this particular user
documents = Document.all(user_id=legal_user.get_pk())

But this doesn't work properly because Document's resources url doesn't contain a parameter user_id :

url = { InsertQuery.identifier: '/users/%(user_id)s/KYC/documents', UpdateQuery.identifier: '/users/%(user_id)s/KYC/documents', SelectQuery.identifier: '/KYC/documents' }

resources.py ligne 670

Am I wrong ? If not how could we correct this ?

Thanks,

User.all raises exception (v3)

When:
User.all()

Then:
[Traceback (most recent call last):
File "", line 1, in
File ".../venv/local/lib/python2.7/site-packages/mangopay/base.py", line 157, in repr
u = six.text_type(self)
TypeError: coercing to Unicode: need string or buffer, NoneType found

Looking for SecureModeNeeded inside the PayInExecutionDetailsDirect object

Hi!

I would like to implement 3DS for the direct card.

When I check the mangopay php sdk, there is a SecureModeNeeded inside the PayInExecutionDetailsDirect object :
https://github.com/Mangopay/mangopay2-php-sdk/blob/5b33c99e207a66bf2936eaf113853dce7312dd6f/MangoPay/PayInExecutionDetailsDirect.php#L31

/**
* SecureModeNeeded
* @var string
*/
public $SecureModeNeeded;

We can use this property to know when the 3DS is enabled, like in your php example :
https://github.com/Mangopay/mangopay2-php-sdk/blob/5b33c99e207a66bf2936eaf113853dce7312dd6f/demos/workflow/scripts/preauth.php#L16

if ($result->SecureModeNeeded && $result->Status!=\MangoPay\CardPreAuthorizationStatus::Failed) {

With the python sdk the SecureModeNeeded property is available only for the CardPreAuthorization object but not for the PayInExecutionDetailsDirect.

I would like to know if we can have access to this property from the PayInExecutionDetailsDirect?
Or if it's not possible how can I know when the transaction is using 3DS?

Thanks.

Model does not allow transfer refund process even if it is successful

I am facing error while making transfer refund process though i am getting a successful refund on server console terminal

DATA[OUT -> https://api.sandbox.mangopay.com/v2.01/mysquare/transfers/20981790/refunds][4.527 seconds]
- status_code: 200
- headers: {'pragma': 'no-cache', 'cache-control': 'no-cache', 'date': 'Wed, 15 Feb 2017 08:15:09 GMT', 'content-type': 'application/json; charset=utf-8', 'content-length': '562', 'x-ratelimit-reset': '1487147400, 1487148300, 1487150100, 1487232840', 'x-ratelimit-remaining': '2251, 4450, 8742, 105534', 'x-ratelimit': '49, 50, 58, 66', 'expires': '-1', 'server': 'Leetchi'}
- content: {"Id":"20981813","Tag":null,"CreationDate":1487146508,"AuthorId":"20440919","CreditedUserId":null,"DebitedFunds":{"Currency":"GBP","Amount":100},"CreditedFunds":{"Currency":"GBP","Amount":100},"Fees":{"Currency":"GBP","Amount":0},"Status":"SUCCEEDED","ResultCode":"000000","ResultMessage":"Success","ExecutionDate":1487146509,"Type":"TRANSFER","Nature":"REFUND","InitialTransactionId":"20981790","InitialTransactionType":"TRANSFER","DebitedWalletId":"19646537","CreditedWalletId":"20440920","RefundReason":{"RefundReasonMessage":null,"RefundReasonType":"OTHER"}}

Following is the Error Stack i am getting:

Traceback (most recent call last):
File "/home/test/RatedApp/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1536, in call
rv = self.handle_exception(request, response, e)
File "/home/test/RatedApp/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1530, in call
rv = self.router.dispatch(request, response)
File "/home/test/RatedApp/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/home/test/RatedApp/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 1102, in call
return handler.dispatch()
File "/home/test/RatedApp/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 572, in dispatch
return self.handle_exception(e, self.app.debug)
File "/home/test/RatedApp/google_appengine/lib/webapp2-2.5.1/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/home/test/RatedApp/mysquare/server/mysquare/lib/auth.py", line 86, in wrapper
return func(self, *args, **kwargs)
File "/home/test/RatedApp/mysquare/server/mysquare/lib/auth.py", line 130, in wrapper
return func(self, *args, **kwargs)
File "/home/test/RatedApp/mysquare/server/mysquare_admin/handlers/admin.py", line 2090, in handle
transfer_refund.save()
File "/home/test/RatedApp/mysquare/server/mysquare/../lib/mangopay/base.py", line 204, in save
result = insert.execute(handler)
File "/home/test/RatedApp/mysquare/server/mysquare/../lib/mangopay/query.py", line 130, in execute
return dict(self.parse_result(data))
File "/home/test/RatedApp/mysquare/server/mysquare/../lib/mangopay/query.py", line 27, in parse_result
pairs[field_name] = field.python_value(result[api_name])
File "/home/test/RatedApp/mysquare/server/mysquare/../lib/mangopay/fields.py", line 298, in python_value
return Reason(type=value['RefusedReasonType'], message=value['RefusedReasonMessage'])
KeyError: 'RefusedReasonType'

the process i am following to get refund done is as follows:

    user_author = User.get(user.mangopay_id)
    transfer = Transfer.get(order.transaction_mangopay)
    params = {
        "author": user_author,
        "transfer": transfer
    }        
    transfer_refund = TransferRefund(**params)
    transfer_refund.save()

pip install problem

pip install mangopaysdk==1.5 gives this:
It works if I point directly to the git url but I suspect there is a problem with the packaging..

Downloading/unpacking mangopaysdk==1.5 (from -r experiments/requirements.txt (line 2))
  Downloading mangopaysdk-1.5.zip (43kB): 43kB downloaded
  Running setup.py (path:/Users/andrea/.virtualenvs/wallet2/build/mangopaysdk/setup.py) egg_info for package mangopaysdk
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/Users/andrea/.virtualenvs/wallet2/build/mangopaysdk/setup.py", line 12, in <module>
        long_description=open('README.md').read(),
    IOError: [Errno 2] No such file or directory: 'README.md'
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/Users/andrea/.virtualenvs/wallet2/build/mangopaysdk/setup.py", line 12, in <module>

    long_description=open('README.md').read(),

IOError: [Errno 2] No such file or directory: 'README.md'

Typo in CardRegistration model (v3)

class CardRegistration(BaseModel):
user = ForeignKeyField(User, api_name='UserId', required=True, related_name='card_registrations')
currency = CharField(api_name='Currency', required=True)
card_type = CharField(api_name='CardType', choices=constants.CARD_TYPE_CHOICES, default=None)
card_registration_url = CharField(api_name='CardRegistrationURL')
registation_data = CharField(api_name='RegistrationData')
access_key = CharField(api_name='AccessKey')
preregistration_data = CharField(api_name='PreregistrationData')
registration_data = CharField(api_name='RegistrationData')
card = ForeignKeyField(Card, api_name='CardId')
result_code = CharField(api_name='ResultCode')
result_message = CharField(api_name='ResultMessage')
status = CharField(api_name='Status', choices=constants.CARD_STATUS_CHOICES, default=None)
creation_date = DateField(api_name='CreationDate')

Notice the registration_data field

Can't use the SDK in production environment

Some methods don't take a handler as an argument, but it's via this handler that you define the sandbox parameter. As a result, I can't NaturalUser.get(1) on a production environment.

Here is the patch I use that fixes the issue:

---
 mangopay/api.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mangopay/api.py b/mangopay/api.py
index 77e8198..d4d0f33 100644
--- a/mangopay/api.py
+++ b/mangopay/api.py
@@ -33,9 +33,9 @@ requests_session = requests.Session()
 
 
 class APIRequest(object):
-    def __init__(self, client_id=None, passphrase=None, api_url=None, api_sandbox_url=None, sandbox=True,
+    def __init__(self, client_id=None, passphrase=None, api_url=None, api_sandbox_url=None, sandbox=None,
                  timeout=30.0, storage_strategy=None, proxies=None):
-        if sandbox:
+        if sandbox or mangopay.sandbox:
             self.api_url = api_sandbox_url or mangopay.api_sandbox_url
         else:
             self.api_url = api_url or mangopay.api_url
-- 

PayIn.get() doesn't delegate to subclass

In v2 payIns.Get(id) returned an object containing all the data provided by the API, albeit in an annoying hierarchy. In v3 PayIn.get() doesn't delegate to its subclasses (DirectPayIn, BankWirePayIn, etc), so only attributes common to all types of payins are accessible, and the rest of the data provided by the API is discarded. This means that getting a proper object requires using the correct subclass directly, which isn't possible when handling a webhook notification because the querystring doesn't contain the payin type.

401

Hi,

I wanted to test mango with this SDK but when following your sample code:

from mangopaysdk.mangopayapi import MangoPayApi
api = MangoPayApi()
api.Config.ClientId = "my_id"
api.Config.ClientPassword = "my_pass"
api.users.GetAll()

I keep getting this error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ggodin/.virtualenvs/mptest/lib/python2.7/site-packages/mangopaysdk/tools/apiusers.py", line 43, in Get
    response = self._getObject('users_get', userId)
  File "/home/ggodin/.virtualenvs/mptest/lib/python2.7/site-packages/mangopaysdk/tools/apibase.py", line 201, in _getObject
    response = rest.Request(urlMethod, self._getRequestType(methodKey))
  File "/home/ggodin/.virtualenvs/mptest/lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 56, in Request
    response = self._runRequest(urlMethod, pagination, additionalUrlParams)
  File "/home/ggodin/.virtualenvs/mptest/lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 98, in _runRequest
    request = self._generateRequest(urlMethod, pagination, additionalUrlParams)
  File "/home/ggodin/.virtualenvs/mptest/lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 68, in _generateRequest
    authObj = AuthenticationHelper(self._root).GetRequestAuthObject(self._authRequired)
  File "/home/ggodin/.virtualenvs/mptest/lib/python2.7/site-packages/mangopaysdk/tools/authenticationHelper.py", line 26, in GetRequestAuthObject
    oauth = self._root.OAuthTokenManager.GetToken()
  File "/home/ggodin/.virtualenvs/mptest/lib/python2.7/site-packages/mangopaysdk/tools/storages/authorizationtokenmanager.py", line 21, in GetToken
    token = self._root.authenticationManager.CreateToken()
  File "/home/ggodin/.virtualenvs/mptest/lib/python2.7/site-packages/mangopaysdk/tools/apioauth.py", line 21, in CreateToken
    response = rest.Request(urlMethod, requestType, requestData)
  File "/home/ggodin/.virtualenvs/mptest/lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 56, in Request
    response = self._runRequest(urlMethod, pagination, additionalUrlParams)
  File "/home/ggodin/.virtualenvs/mptest/lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 104, in _runRequest
    self._checkResponseCode(response, decodedResp)
  File "/home/ggodin/.virtualenvs/mptest/lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 148, in _checkResponseCode
    raise ResponseException(response.request.url, response.status_code, message)
mangopaysdk.types.exceptions.responseexception.ResponseException: 401

I've tried my credential and they work properly while doing direct GET and POST request, I was able to create user and retrieve them no problem.

Am I missing something here ?

Failing tests

There are a couple of tests that either fail with an error or don't pass

ClientID and not ClientId

Hi,

After spending some time searching why I could authenticate using directly your REST API perfectly, but not with your SDK, I found out that, in your README, you put in the "configuration example" section:

api.Config.ClientId = 'your-client-id'

And in the configuration.py file, we can see:

# Setting for client: client Id and client password
    ClientID = ''
    ClientPassword = ''

I can understand that writing good documentation is boring, and that there are apparently more useful way to spend your time.

But I see two possibilities:

  • You delete your documentation. We already need to dive into the code anyway in order to find out which method to call for doing something more complicated than retrieving the list of users.
  • You go to https://stripe.com/docs/api/python and learn how to write a proper documentation (and then write one).

Thank you.

Getting 401 Error when performing any request

When performing any request we get the Your authorization do not allow you to access to this information - 401 error. The ClientID and ClientPassword are properly set and it works from some computers but not from others (same version of Python 2.7.8, requests: 2.5.3 and mangopaysdk)

See from python shell:

Python 2.7.8 (default, Oct 19 2014, 16:02:00) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.54)]

>>> from .lib.mangopay_singleton import SingletonMangoPay
>>> p = SingletonMangoPay()
>>> p.mangoPayApi.Config.ClientID
'testaxant'
>>> p.mangoPayApi.Config.ClientPassword
'wu...[THIS IS THE RIGHT TOKEN]'
>>> p.mangoPayApi.users.GetAll()
11:53:35,463 INFO  [requests.packages.urllib3.connectionpool] Starting new HTTPS connection (1): api.sandbox.mangopay.com
Traceback (most recent call last):
  File "<console>", line 1, in <module>
  File ".../lib/python2.7/site-packages/mangopaysdk/tools/apiusers.py", line 35, in GetAll
    usersList = self._getList('users_all', pagination)
  File ".../lib/python2.7/site-packages/mangopaysdk/tools/apibase.py", line 229, in _getList
    response = rest.Request(urlMethod, self._getRequestType(methodKey), None, pagination, additionalUrlParams)
  File ".../lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 56, in Request
    response = self._runRequest(urlMethod, pagination, additionalUrlParams)
  File ".../lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 104, in _runRequest
    self._checkResponseCode(response, decodedResp)
  File ".../lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 148, in _checkResponseCode
    raise ResponseException(response.request.url, response.status_code, message)
ResponseException: Your authorization do not allow you to access to this information 

Models don't allow using the API names

I'm working on migrating code that uses this library, from v2 to v3, and it would be easier if data could be accessed and modified using the API names (e.g. AuthorId) in addition to the new python names (e.g. author).

If I make a Pull Request adding support for using the API names, will you merge it?

SecureModeReturnURL

Hi guys, can I have some help?
I've some problems with Card Direct PayIn, with payment of more than 100€.
I think that the problem could be the SecureModeReturnUrl for 3D secure.
Thanks,

Andrea

The requested resource does not support http method 'POST'.

i just stated using this library mangopaysdk,
Now while creating the user **api.clients.Create(mangopay_client_id,'test', '[email protected]') **,i am getting some error like :
mangopaysdk.types.exceptions.responseexception.ResponseException: The requested resource does not support http method 'POST'.

Any help will be greatly appreciated !

Here is the complete code:
`from mangopaysdk.mangopayapi import MangoPayApi

api = MangoPayApi()
mangopay_client_id='mangopay_client_id'
mangopay_pass_phrase_code='mangopay_pass_phrase_code'
api.Config.ClientID = mangopay_client_id
api.Config.ClientPassword = mangopay_pass_phrase_code
api.Config.TempPath = "/opt/custom/payment_mangopay/"
api.Config.BaseUrl = "https://api.sandbox.mangopay.com"

client = api.clients.Create(mangopay_client_id,'test', '[email protected]')
print client
`

api.Config.TempPath setting can not be changed

DefaultStorageStrategy always uses the default value of Configuration.TempPath (i.e. "c:\Temp").
Changing api.Config.TempPath value from a MangoPayApi instance has not effect:

from mangopaysdk.mangopayapi import MangoPayApi
api = MangoPayApi()
api.Config.TempPath = '/tmp/'

from mangopaysdk.tools.storages.defaultstoragestrategy import DefaultStorageStrategy
print DefaultStorageStrategy.cache_path

c:\Temp\cached-data.py

Unverified HTTPS

While running the tests with the SDK I get this:

InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html (This warning will only appear once by default.)

In the tests it's not a big deal, but from the doc and the SDK there should be probably written somewhere how to avoid this issue since it's a possible security problem..
thanks

PREAUTHORIZED Payin test

Hello,

One of our users did not find a way to use the SDK for executing the PreAuthorized
PayIns. Can you please provide a clear example of that.

This is our client request:
I cannot find PayInExecutionDetailsPreauthorized, only
PayInExecutionDetailsDirect
or PayInExecutionDetailsWeb or PayInExecutionDetails... I have tested
these, but none of them seem to work.

Below I have added my (last) sample code to execute the PreAuthorized
PayIn:

payIn=PayIn()
payIn.CreditedWalletId = challengeWallet.Id

payIn.ExecutionDetails = PayInExecutionDetailsDirect()

payIn.ExecutionDetails.CardId = card.Id

payIn.ExecutionDetails.SecureModeReturnURL = 'http://test.com'

payIn.ExecutionType = ExecutionType.DIRECT
payIn.ExecutionDetails = PayInExecutionDetailsDirect()
payIn.ExecutionDetails.CardId=card.Id
payIn.ExecutionDetails.SecureModeReturnURL='https://test.com'
payIn.ExecutionDetails.SecureMode = Mode3DSType.DEFAULT

payIn.PaymentDetails = PayInPaymentDetailsPreAuthorized()
payIn.PaymentDetails.PreauthorizationId=PreAuthPayIn.Id

payIn.AuthorId = userX.Id
payIn.DebitedFunds = Money()
payIn.DebitedFunds.Amount = 1000
payIn.DebitedFunds.Currency = 'EUR'
payIn.Fees = Money()
payIn.Fees.Amount = 0
payIn.Fees.Currency = 'EUR'
mango_api.payIns.Create(payIn)

This specific example returns:
KeyError: u'PREAUTHORIZED'

Thank you for your help,
SV

Extraneous argument in ApiUsers.UpdateUserKycDocument

mangopaysdk.tools.apiusers.ApiUsers.UpdateUserKycDocument takes a fourth, uneeded, argument in the form of kycDocumentId

Makye you can raise a warning in the next version and remove it completely in the following versions.

I can do it if you want.

Can't set CreditedUserId when making a DirectPayin

When trying to make a DirectPayin and set credited_user_id, the field is ignored when making the API call.

Example:

payin = DirectPayIn(
    author_id=customer_user_id,
    credited_user_id=settings.TECHNICAL_USER_ID,
    credited_wallet_id=customer_wallet_id,
    debited_funds=Money(amount=full_amount, currency='GBP'),
    fees=Money(amount=fees, currency='GBP'),
    card_id=card_id,
)
res = payin.save()
assert 'credited_user_id' in res

Mangopay Debugger Doesn't work with Unicode Chars

If I have debug mode on, I cannot send Unicode chars.

Traceback (most recent call last):
File "", line 1, in
File "/home/rebecca/.virtualenvs/fundedbyme/src/mangopay/mangopay/models.py", line 67,
in update
return client.users.Update(self._build())
File "/home/rebecca/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/mangopay
sdk/tools/apiusers.py", line 72, in Update
response = self._saveObject(methodKey, user)
File "/home/rebecca/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/mangopay
sdk/tools/apibase.py", line 257, in _saveObject
response = rest.Request(urlMethod, self._getRequestType(methodKey), requestData)
File "/home/rebecca/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/mangopay
sdk/tools/resttool.py", line 51, in Request
response = self._runRequest(urlMethod, pagination, additionalUrlParams)
File "/home/rebecca/.virtualenvs/fundedbyme/local/lib/python2.7/site-packages/mangopay
sdk/tools/resttool.py", line 81, in _runRequest
if (self._debugMode): logging.getLogger(name).debug('RESPONSE: {0}\n {1}\n {2}
'.format(response.status_code, response.headers, response.text))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 55: ordinal
not in range(128)

Bundle certificates or require certifi module

I think the library should either ship with a certificates bundle or require the certifi Python module so that it doesn't generate warnings. I'm guessing there are users who don't know what to do with them.

DirectPayIn missing attribute

Hi,

I think that the following attribute is missing into DirectPayIn object :

secure_mode_needed = BooleanField(api_name='SecureModeNeeded')

cf. Doc link

Thanks,

Using this SDK with python 2.7

Hello,

Should this code work with python 2.7. Does it require any python 3.3 special feature.

Thanks a lot,

Joao Graça

UserLegal KYC verification

I am using the UserLegal API to verify the KYC status.
According to the docs the ProofOfRegistration, Statute and the ShareholderDeclaration needs to be set to be verified.
The SDK doesn't seem to set these properties in the UserLegal entitiy.

How to silent the SSLVerification issue

Hi,

I've cloned the repository and try to run the test suite but I get tons of SSLVerification warning which I tried to fix as mentioned in the README:
I modified buildNewMangoPayApi in TestBase(testbase.py) with my client id and password and the following line:
dk.Config.SSLVerification = certifi.where()
which point to cacert.pem file of my python distribution:
/Users/brieuc/repos/mangopay2-python-sdk/venv/lib/python3.5/site-packages/certifi/cacert.pem

But I still get the warning:

...../Users/brieuc/repos/mangopay2-python-sdk/venv/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)
./Users/brieuc/repos/mangopay2-python-sdk/venv/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py:791: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html
  InsecureRequestWarning)

Any idea what I'm doing wrong ?

Can't `pip install python-mangopay`

I'm trying to upgrade to v3 because v2.x.x will be deprecated in 10 days.

When trying to install python-mangopay, setup.py fails because DESCRIPTION.rst does not exist.

Also it downloads version python-mangopay-1.0.0a0 which has been uploaded in 2015 on PyPI. I'm not sure about what should I do now.

(venv) ➜  myproject pip install python-mangopay --no-cache-dir
Collecting python-mangopay
  Downloading python-mangopay-1.0.0a0.tar.gz (82kB)
    100% |████████████████████████████████| 92kB 922kB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-mnr9gqfg/python-mangopay/setup.py", line 7, in <module>
        with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f:
      File "/tmp/myproject/venv/lib64/python3.5/codecs.py", line 895, in open
        file = builtins.open(filename, mode, buffering)
    FileNotFoundError: [Errno 2] No such file or directory: '/tmp/pip-build-mnr9gqfg/python-mangopay/DESCRIPTION.rst' 

Python 3 support

Hi,

Is the SDK supported on python 3.5 ?
If not is there any plan to implement a python 3.5 compatible version in a near future ?
I'm new to python but would be happy to help in any ways...

Cheers

Brieuc

Data is returned as bytes

It seems that this library does not properly decode the data it gets from the API. I'm getting a UnicodeDecodeError ('ascii' codec can't decode byte 0xc3 in position 1: ordinal not in range(128)) when trying to render a FirstName which has the value "Sébastien".

Logging is inappropriate

The APIRequest class logs all API requests and responses at the INFO level, and not just the URLs but the headers and bodies as well. In case of failure the information is also logged a second time at the ERROR level.

I think all the logging should be at the DEBUG level, except for a simple ERROR message when a request fails (containing only the URL and status code).

Python 2.7 - TypeError: must be type, not classobj

When attempting to run the following code:

from mangopaysdk.mangopayapi import MangoPayApi
api = MangoPayApi()

The following error occurs:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jonathan3/.virtualenvs/gdjango15/local/lib/python2.7/site-packages/mangopaysdk/mangopayapi.py", line 22, in __init__
    self.OAuthTokenManager = AuthorizationTokenManager(self);
  File "/home/jonathan3/.virtualenvs/gdjango15/local/lib/python2.7/site-packages/mangopaysdk/tools/storages/authorizationtokenmanager.py", line 11, in __init__
    super(AuthorizationTokenManager, self).__init__(api)
TypeError: must be type, not classobj

This is on Python 2.7.3.

payIns.GetRefund raises exception

payIns.GetRefund raises the following exception:

ResponseException: The requested resource does not support http method 'GET'.

Traceback:

  File "/Users/alexei/.virtualenvs/myproject/lib/python2.7/site-packages/mangopaysdk/tools/apipayins.py", line 55, in GetRefund
    return self._getObject('payins_getrefunds', payInId, 'Refund')
  File "/Users/alexei/.virtualenvs/myproject/lib/python2.7/site-packages/mangopaysdk/tools/apibase.py", line 272, in _getObject
    response = rest.Request(urlMethod, self._getRequestType(methodKey))
  File "/Users/alexei/.virtualenvs/myproject/lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 54, in Request
    return self.RequestIdempotent(None, urlMethod, requestType, requestData, pagination, additionalUrlParams)
  File "/Users/alexei/.virtualenvs/myproject/lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 68, in RequestIdempotent
    response = self._runRequestIdempotent(idempotencyKey, urlMethod, pagination, additionalUrlParams)
  File "/Users/alexei/.virtualenvs/myproject/lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 133, in _runRequestIdempotent
    self._checkResponseCode(response, decodedResp)
  File "/Users/alexei/.virtualenvs/myproject/lib/python2.7/site-packages/mangopaysdk/tools/resttool.py", line 177, in _checkResponseCode
    raise ResponseException(response.request.url, response.status_code, message)

doc & samples

Hello, all libs is old, nodejs not working, python without any doc, how i can create user etc? How i can use REST api i don't know server domain, why you don't put that info in docs? Or samples of using REST api.

Python3 compatible??

In the README it's written that this project was written with Python3.3, but the tests don't even pass with Python3, for things for example

AttributeError: 'dict' object has no attribute 'has_key'

So was it tested only on Python2 then?
Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.