Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from mangopaysdk.tools.apibase import ApiBase
from mangopaysdk.entities.card import Card
class ApiCards (ApiBase):
"""Class to management MangoPay API for cards."""
def Get(self, cardId):
"""Get card object
param string Card identifier
return Card Object returned from API
"""
return self._getObject('card_get', cardId, 'Card')
def Update(self, card):
"""Get card object
param Card Card entity instance to be updated
return Card Object returned from API
"""
return self._saveObject('card_save', card, 'Card')
from mangopaysdk.tools.apibase import ApiBase
from mangopaysdk.entities.cardpreauthorization import CardPreAuthorization
class ApiCardPreAuthorizations (ApiBase):
"""Class to managemen MangoPay API for card pre-authorization.
see: http://docs.mangopay.com/api-references/card/pre-authorization/
"""
def Create(self, cardPreAuthorization):
"""Create new card preauthorization
param CardPreAuthorization object to create
return CardPreAuthorization Object returned from API
"""
return self.CreateIdempotent(None, cardPreAuthorization)
def CreateIdempotent(self, idempotencyKey, cardPreAuthorization):
"""Create new card preauthorization
param string idempotencyKey Idempotency key for this request
param CardPreAuthorization object to create
return CardPreAuthorization Object returned from API
from mangopaysdk.tools.apibase import ApiBase
from mangopaysdk.entities.payout import PayOut
class ApiPayOuts (ApiBase):
"""MangoPay API methods for pay-out transactions."""
def Create(self, payOut):
"""Create new pay-out.
param PayOut payOut
return PayOut Object returned from API
"""
return self.CreateIdempotent(None, payOut)
def CreateIdempotent(self, idempotencyKey, payOut):
"""Create new pay-out.
param string idempotencyKey Idempotency key for this request
param PayOut payOut
return PayOut Object returned from API
"""
paymentKey = self._getPaymentKey(payOut)
from mangopaysdk.tools.apibase import ApiBase
from mangopaysdk.tools.resttool import RestTool
class ApiEvents(ApiBase):
"""MangoPay API methods for events."""
def Get(self, pagination = None, filter = None, sorting = None):
"""Get Events list
param Pagination pagination object
param FilterTransactions filter Object to filter data
param Sorting sorting
return Events[] from API
"""
return self._getList('events_all', pagination, 'Event', None, filter, sorting)
from mangopaysdk.tools.apibase import ApiBase
from mangopaysdk.tools.resttool import RestTool
from mangopaysdk.entities.dispute import Dispute
from mangopaysdk.entities.transaction import Transaction
from mangopaysdk.entities.repudiation import Repudiation
from mangopaysdk.entities.transfer import Transfer
from mangopaysdk.entities.settlement import Settlement
class ApiDisputes(ApiBase):
"""MangoPay API methods for disputes."""
def Get(self, disputeId):
"""Get Dispute by ID.
param Dispute identifier
return Dispute object returned from API
"""
return self._getObject('disputes_get', disputeId, 'Dispute')
def GetAll(self, pagination = None, filter = None, sorting = None):
"""Get all client's disputes.
param Pagination object
param Filter object
param Sorting object
return Array with disputes
"""
from mangopaysdk.tools.apibase import ApiBase
from mangopaysdk.entities.cardregistration import CardRegistration
from mangopaysdk.entities.temporarypaymentcard import TemporaryPaymentCard
class ApiCardRegistrations (ApiBase):
"""Class to management MangoPay API for card registrations."""
def Create(self, cardRegistration):
"""Create new card registration
param CardRegistration object to create
return CardRegistration Object returned from API
"""
return self.CreateIdempotent(None, cardRegistration)
def CreateIdempotent(self, idempotencyKey, cardRegistration):
"""Create new card registration
param string idempotencyKey Idempotency key for this request
param CardRegistration object to create
return CardRegistration Object returned from API
"""
return self._createObjectIdempotent(idempotencyKey, 'cardregistration_create', cardRegistration, 'CardRegistration')
from mangopaysdk.tools.apibase import ApiBase
class ApiHooks(ApiBase):
"""MangoPay API for hooks and notifications."""
def Create(self, hook):
"""Creates a new hook.
param Hook hook
return Newly created hook object returned from API
"""
return self.CreateIdempotent(None, hook)
def CreateIdempotent(self, idempotencyKey, hook):
"""Creates a new hook.
param string idempotencyKey Idempotency key for this request
param Hook hook
return Newly created hook object returned from API
"""
return self._createObjectIdempotent(idempotencyKey, 'hooks_create', hook, 'Hook')
from mangopaysdk.tools.apibase import ApiBase
from mangopaysdk.tools.resttool import RestTool
from mangopaysdk.entities.client import Client
from mangopaysdk.entities.clientlogo import ClientLogo
import os
class ApiClients(ApiBase):
"""MangoPay API methods for users."""
def Create(self, clientId, clientName, clientEmail):
"""Get client data for Basic Access Authentication.
param string clientId Client identifier
param string clientName Beautiful name for presentation
param string clientEmail Client's email
return Client object
"""
urlMethod = self._getRequestUrl('authentication_base')
requestType = self._getRequestType('authentication_base')
requestData = {
'ClientId' : clientId,
'Name' : clientName,
'Email' : clientEmail,
from mangopaysdk.types.oauthtoken import OAuthToken
from mangopaysdk.tools.apibase import ApiBase
from mangopaysdk.tools.resttool import RestTool
import logging
class ApiOAuth(ApiBase):
"""MangoPay API methods for users."""
def CreateToken(self):
"""Get token information for OAuth Authentication.
return MangoPay OAuthToken object with token information
"""
urlMethod = self._getRequestUrl('authentication_oauth')
requestType = self._getRequestType('authentication_oauth')
requestData = {
'grant_type' : 'client_credentials'
}
rest = RestTool(self._root, False)
response = rest.Request(urlMethod, requestType, requestData)
token = self._castAuthResponseToEntity(response)
return token
from mangopaysdk.tools.apibase import ApiBase
from mangopaysdk.entities.transfer import Transfer
class ApiTransfers (ApiBase ):
"""MangoPay API methods for transfers."""
def Create(self, transfer):
"""Create new transfer.
param Transfer object with fields: AuthorId, CreditedUserId, DebitedFunds,Fees, DebitedWalletID, CreditedWalletID, Tag
return Transfer object returned from API
"""
return self.CreateIdempotent(None, transfer)
def CreateIdempotent(self, idempotencyKey, transfer):
"""Create new transfer.
param string idempotencyKey Idempotency key for this request
param Transfer object with fields: AuthorId, CreditedUserId, DebitedFunds,Fees, DebitedWalletID, CreditedWalletID, Tag
return Transfer object returned from API
"""
return self._createObjectIdempotent(idempotencyKey, 'transfers_create', transfer, 'Transfer')