How to use mangopaysdk - 10 common examples

To help you get started, we’ve selected a few mangopaysdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Mangopay / mangopay2-python-sdk / tests / testpayins.py View on Github external
def test_PayIns_Create_DirectDebitWeb(self):
        wallet = self.getJohnsWallet()
        user = self.getJohn()
        # create pay-in PRE-AUTHORIZED DIRECT
        payIn = PayIn()
        payIn.CreditedWalletId = wallet.Id
        payIn.AuthorId = user.Id
        payIn.DebitedFunds = Money()
        payIn.DebitedFunds.Amount = 10000
        payIn.DebitedFunds.Currency = 'EUR'
        payIn.Fees = Money()
        payIn.Fees.Amount = 100
        payIn.Fees.Currency = 'EUR'
        
        # payment type as CARD
        payIn.PaymentDetails = PayInPaymentDetailsDirectDebit()
        payIn.PaymentDetails.DirectDebitType = 'GIROPAY'
        payIn.ExecutionDetails = PayInExecutionDetailsWeb()
        payIn.ExecutionDetails.ReturnURL = 'http://www.mysite.com/returnURL/'
        payIn.ExecutionDetails.Culture = 'FR'
        payIn.ExecutionDetails.TemplateURLOptions = PayInTemplateURLOptions()
        payIn.ExecutionDetails.TemplateURLOptions.PAYLINE = 'https://www.maysite.com/payline_template/'

        createPayIn = self.sdk.payIns.Create(payIn)

        self.assertTrue(int(createPayIn.Id) > 0)
        self.assertEqual(wallet.Id, createPayIn.CreditedWalletId)
github Mangopay / mangopay2-python-sdk / tests / testpayins.py View on Github external
def test_PayIns_Create_DirectDebitWeb(self):
        wallet = self.getJohnsWallet()
        user = self.getJohn()
        # create pay-in PRE-AUTHORIZED DIRECT
        payIn = PayIn()
        payIn.CreditedWalletId = wallet.Id
        payIn.AuthorId = user.Id
        payIn.DebitedFunds = Money()
        payIn.DebitedFunds.Amount = 10000
        payIn.DebitedFunds.Currency = 'EUR'
        payIn.Fees = Money()
        payIn.Fees.Amount = 100
        payIn.Fees.Currency = 'EUR'
        
        # payment type as CARD
        payIn.PaymentDetails = PayInPaymentDetailsDirectDebit()
        payIn.PaymentDetails.DirectDebitType = 'GIROPAY'
        payIn.ExecutionDetails = PayInExecutionDetailsWeb()
        payIn.ExecutionDetails.ReturnURL = 'http://www.mysite.com/returnURL/'
        payIn.ExecutionDetails.Culture = 'FR'
        payIn.ExecutionDetails.TemplateURLOptions = PayInTemplateURLOptions()
github Mangopay / mangopay2-python-sdk / tests / testpayins.py View on Github external
user = self.getJohn()
        # create pay-in PRE-AUTHORIZED DIRECT
        payIn = PayIn()
        payIn.CreditedWalletId = wallet.Id
        payIn.AuthorId = user.Id
        payIn.DebitedFunds = Money()
        payIn.DebitedFunds.Amount = 10000
        payIn.DebitedFunds.Currency = 'EUR'
        payIn.Fees = Money()
        payIn.Fees.Amount = 100
        payIn.Fees.Currency = 'EUR'
        
        # payment type as CARD
        payIn.PaymentDetails = PayInPaymentDetailsDirectDebit()
        payIn.PaymentDetails.DirectDebitType = 'GIROPAY'
        payIn.ExecutionDetails = PayInExecutionDetailsWeb()
        payIn.ExecutionDetails.ReturnURL = 'http://www.mysite.com/returnURL/'
        payIn.ExecutionDetails.Culture = 'FR'
        payIn.ExecutionDetails.TemplateURLOptions = PayInTemplateURLOptions()
        payIn.ExecutionDetails.TemplateURLOptions.PAYLINE = 'https://www.maysite.com/payline_template/'

        createPayIn = self.sdk.payIns.Create(payIn)

        self.assertTrue(int(createPayIn.Id) > 0)
        self.assertEqual(wallet.Id, createPayIn.CreditedWalletId)
        self.assertEqual('DIRECT_DEBIT', createPayIn.PaymentType)
        self.assertIsInstance(createPayIn.PaymentDetails, PayInPaymentDetailsDirectDebit)
        self.assertEqual(createPayIn.PaymentDetails.DirectDebitType, 'GIROPAY')
        self.assertEqual('WEB', createPayIn.ExecutionType)
        self.assertIsInstance(createPayIn.ExecutionDetails, PayInExecutionDetailsWeb)
        self.assertEqual('FR', createPayIn.ExecutionDetails.Culture)
        self.assertEqual(user.Id, createPayIn.AuthorId)
github Mangopay / mangopay2-python-sdk / tests / testpayins.py View on Github external
def test_PayIns_Create_PayPal_Web(self):
        wallet = self.getJohnsWallet()
        user = self.getJohn()

        payInPost = PayIn()
        payInPost.AuthorId = user.Id
        payInPost.DebitedFunds = Money()
        payInPost.DebitedFunds.Amount = 1000
        payInPost.DebitedFunds.Currency = 'EUR'
        payInPost.Fees = Money()
        payInPost.Fees.Amount = 0
        payInPost.Fees.Currency = 'EUR'
        payInPost.CreditedWalletId = wallet.Id
        payInPost.PaymentDetails = PayInPaymentDetailsPayPal()
        payInPost.ExecutionDetails = PayInExecutionDetailsWeb()
        payInPost.ExecutionDetails.ReturnURL = 'http://test.test'

        payIn = self.sdk.payIns.Create(payInPost)

        self.assertIsNotNone(payIn)
        self.assertTrue(payIn.PaymentType == 'PAYPAL')
github Mangopay / mangopay2-python-sdk / tests / testpayins.py View on Github external
def test_PayIns_Create_PayPal_Web(self):
        wallet = self.getJohnsWallet()
        user = self.getJohn()

        payInPost = PayIn()
        payInPost.AuthorId = user.Id
        payInPost.DebitedFunds = Money()
        payInPost.DebitedFunds.Amount = 1000
        payInPost.DebitedFunds.Currency = 'EUR'
        payInPost.Fees = Money()
        payInPost.Fees.Amount = 0
        payInPost.Fees.Currency = 'EUR'
        payInPost.CreditedWalletId = wallet.Id
        payInPost.PaymentDetails = PayInPaymentDetailsPayPal()
        payInPost.ExecutionDetails = PayInExecutionDetailsWeb()
        payInPost.ExecutionDetails.ReturnURL = 'http://test.test'

        payIn = self.sdk.payIns.Create(payInPost)

        self.assertIsNotNone(payIn)
        self.assertTrue(payIn.PaymentType == 'PAYPAL')
github Mangopay / mangopay2-python-sdk / tests / testbase.py View on Github external
def getJohnsRefundForPayIn(self, payIn = None):
        """ Creates refund object for PayIn
        return Refund
        """
        if payIn == None:
            payIn = self.getJohnsPayInCardDirect()
        
        refund = Refund()
        refund.CreditedWalletId = payIn.CreditedWalletId
        refund.AuthorId = payIn.AuthorId
        refund.DebitedFunds = Money()
        refund.DebitedFunds.Amount = payIn.DebitedFunds.Amount
        refund.DebitedFunds.Currency = payIn.DebitedFunds.Currency
        refund.Fees = Money()
        refund.Fees.Amount = payIn.Fees.Amount
        refund.Fees.Currency = payIn.Fees.Currency
        return self.sdk.payIns.CreateRefund(payIn.Id, refund)
github Mangopay / mangopay2-python-sdk / tests / testbase.py View on Github external
"""Creates Pay-Out  Bank Wire object"""
        
        if walletWithMoney == None:
            walletWithMoney = self.getJohnsWalletWithMoney()
        if wallet == None:
            wallet = Wallet()
            wallet.Owners = [walletWithMoney.Owners[0]]
            wallet.Currency = 'EUR'
            wallet.Description = 'WALLET IN EUR'
            wallet = self.sdk.wallets.Create(wallet)

        transfer = Transfer()
        transfer.Tag = 'DefaultTag'
        transfer.AuthorId = walletWithMoney.Owners[0]
        transfer.CreditedUserId = walletWithMoney.Owners[0]
        transfer.DebitedFunds = Money()
        transfer.DebitedFunds.Currency = 'EUR'
        transfer.DebitedFunds.Amount = 100
        transfer.Fees = Money()
        transfer.Fees.Currency = 'EUR'
        transfer.Fees.Amount = 0
        transfer.DebitedWalletId = walletWithMoney.Id
        transfer.CreditedWalletId = wallet.Id
        return self.sdk.transfers.Create(transfer)
github Mangopay / mangopay2-python-sdk / tests / testbase.py View on Github external
def getJohnsRefundForTransfer(self, transfer = None):
        """Creates refund object for transfer
        return Refund
        """
        if transfer == None:
            transfer = self.getJohnsTransfer()
        refund = Refund()
        refund.DebitedWalletId = transfer.DebitedWalletId
        refund.CreditedWalletId = transfer.CreditedWalletId
        refund.AuthorId = transfer.AuthorId
        refund.DebitedFunds = Money()
        refund.DebitedFunds.Amount = transfer.DebitedFunds.Amount
        refund.DebitedFunds.Currency = transfer.DebitedFunds.Currency
        refund.Fees = Money()
        refund.Fees.Amount = transfer.Fees.Amount
        refund.Fees.Currency = transfer.Fees.Currency
        return self.sdk.transfers.CreateRefund(transfer.Id, refund)
github Mangopay / mangopay2-python-sdk / tests / testdisputes.py View on Github external
notContestedDispute = None

        for d in self._clientDisputes:
            if ((d.Status == DisputeStatus.PENDING_CLIENT_ACTION or d.Status == DisputeStatus.REOPENED_PENDING_CLIENT_ACTION)
                and (d.DisputeType == DisputeType.CONTESTABLE or d.DisputeType == DisputeType.RETRIEVAL)):
                notContestedDispute = d
                break

        self.assertIsNotNone(notContestedDispute, 'Cannot test contesting dispute because there\'s no dispute that can be contested in the disputes list.')

        result = None

        contestedFunds = None
        if (notContestedDispute.Status == DisputeStatus.PENDING_CLIENT_ACTION):
            contestedFunds = Money()
            contestedFunds.Amount = 100
            contestedFunds.Currency = 'EUR'

        result = self.sdk.disputes.ContestDispute(contestedFunds, notContestedDispute.Id)

        self.assertIsNotNone(result)
        self.assertEqual(result.Id, notContestedDispute.Id)
github Mangopay / mangopay2-python-sdk / tests / testbase.py View on Github external
def getJohnsPayInCardWeb(self):
        """Creates Pay-In Card Web object"""       
        wallet = self.getJohnsWallet()
        user = self.getJohn()
            
        payIn = PayIn()
        payIn.AuthorId = user.Id
        payIn.CreditedUserId = user.Id
        payIn.DebitedFunds = Money()
        payIn.DebitedFunds.Currency = 'EUR'
        payIn.DebitedFunds.Amount = 1000
        payIn.Fees = Money()
        payIn.Fees.Currency = 'EUR'
        payIn.Fees.Amount = 5
        payIn.CreditedWalletId = wallet.Id
        payIn.PaymentDetails = self.getPayInPaymentDetailsCard()
        payIn.ExecutionDetails = self.getPayInExecutionDetailsWeb()
        return self.sdk.payIns.Create(payIn)