Exemplo n.º 1
0
    def getJohnsTransfer(self, walletWithMoney = None, wallet = None):
        """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)
Exemplo n.º 2
0
    def getJohnsTransfer(self, walletWithMoney=None, wallet=None):
        """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)
Exemplo n.º 3
0
	def get_or_create_wallet(mp_user, startup_id):
		# FIXME startup_id, and get before create
		wallet = Wallet()
		wallet.Owners = [mp_user.Id]
		wallet.Currency = 'EUR'
		wallet.Description = "user ID %d's Wallet, for the startup ID %d" % (dj_user.id, startup_id)

		return self.sdk.wallets.Create(wallet)
Exemplo n.º 4
0
 def create(self, description):
     mangopay_wallet = Wallet()
     mangopay_wallet.Owners = [str(self.mangopay_user.mangopay_id)]
     mangopay_wallet.Description = description
     mangopay_wallet.Currency = self.currency
     client = get_mangopay_api_client()
     created_mangopay_wallet = client.wallets.Create(mangopay_wallet)
     self.mangopay_id = created_mangopay_wallet.Id
     self.save()
Exemplo n.º 5
0
 def create(self, currency, description=""):
     mangopay_wallet = Wallet()
     mangopay_wallet.Owners = [str(self.mangopay_user.mangopay_id)]
     mangopay_wallet.Description = description
     mangopay_wallet.Currency = currency
     client = get_mangopay_api_client()
     created_mangopay_wallet = client.wallets.Create(mangopay_wallet)
     self.mangopay_id = created_mangopay_wallet.Id
     self.save()
Exemplo n.º 6
0
 def getJohnsWallet(self):
     """Creates TestBase._johnsWallet (wallets belonging to John) if not created yet"""
     if self._johnsWallet == None:
         john = self.getJohn()
         wallet = Wallet()
         wallet.Owners = [john.Id]
         wallet.Currency = 'EUR'
         wallet.Description = 'WALLET IN EUR'
         self._johnsWallet = self.sdk.wallets.Create(wallet)
         #TODO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
         #self.assertEqualInputProps(self._johnsWallet, wallet, True)
     return self._johnsWallet
Exemplo n.º 7
0
 def getJohnsWallet(self):
     """Creates TestBase._johnsWallet (wallets belonging to John) if not created yet"""
     if self._johnsWallet == None:
         john = self.getJohn()
         wallet = Wallet()
         wallet.Owners = [john.Id]
         wallet.Currency = 'EUR'
         wallet.Description = 'WALLET IN EUR'            
         self._johnsWallet = self.sdk.wallets.Create(wallet)
         #TODO!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
         #self.assertEqualInputProps(self._johnsWallet, wallet, True)
     return self._johnsWallet
Exemplo n.º 8
0
def create_wallet(db, participant):
    w = Wallet()
    w.Owners.append(participant.mangopay_user_id)
    w.Description = str(participant.id)
    w.Currency = 'EUR'
    w = mangoapi.wallets.Create(w)
    db.run("""
        UPDATE participants
           SET mangopay_wallet_id = %s
         WHERE id = %s
    """, (w.Id, participant.id))
    participant.set_attributes(mangopay_wallet_id=w.Id)
    return w.Id
Exemplo n.º 9
0
def create_wallet(db, participant):
    w = Wallet()
    w.Owners.append(participant.mangopay_user_id)
    w.Description = str(participant.id)
    w.Currency = 'EUR'
    w = mangoapi.wallets.Create(w)
    db.run("""
        UPDATE participants
           SET mangopay_wallet_id = %s
         WHERE id = %s
    """, (w.Id, participant.id))
    participant.set_attributes(mangopay_wallet_id=w.Id)
    return w.Id
Exemplo n.º 10
0
    def getJohnsWalletWithMoney(self, amount=10000):
        """Creates static JohnsWallet (wallets belonging to John) if not created yet
        return Wallet
        """
        if self._johnsWalletWithMoney == None:
            john = self.getJohn()
            wallet = Wallet()
            wallet.Owners = [john.Id]
            wallet.Currency = 'EUR'
            wallet.Description = 'WALLET IN EUR'
            wallet = self.sdk.wallets.Create(wallet)
            cardRegistration = CardRegistration()
            cardRegistration.UserId = wallet.Owners[0]
            cardRegistration.Currency = 'EUR'
            cardRegistration = self.sdk.cardRegistrations.Create(
                cardRegistration)
            cardRegistration.RegistrationData = self.getPaylineCorrectRegistartionData(
                cardRegistration)
            cardRegistration = self.sdk.cardRegistrations.Update(
                cardRegistration)
            card = self.sdk.cards.Get(cardRegistration.CardId)
            # create pay-in CARD DIRECT
            payIn = PayIn()
            payIn.CreditedWalletId = wallet.Id
            payIn.AuthorId = cardRegistration.UserId
            payIn.DebitedFunds = Money()
            payIn.DebitedFunds.Amount = amount
            payIn.DebitedFunds.Currency = 'EUR'
            payIn.Fees = Money()
            payIn.Fees.Amount = 0
            payIn.Fees.Currency = 'EUR'
            # payment type as CARD
            payIn.PaymentDetails = PayInPaymentDetailsCard()
            if (card.CardType == 'CB' or card.CardType == 'VISA'
                    or card.CardType == 'MASTERCARD'
                    or card.CardType == CardType.CB_VISA_MASTERCARD):
                payIn.PaymentDetails.CardType = CardType.CB_VISA_MASTERCARD
            # elif (card.CardType == CardType.AMEX):
            #    payIn.PaymentDetails.CardType = CardType.AMEX

            # execution type as DIRECT
            payIn.ExecutionDetails = PayInExecutionDetailsDirect()
            payIn.ExecutionDetails.CardId = card.Id
            payIn.ExecutionDetails.SecureModeReturnURL = 'http://test.com'
            # create Pay-In
            self.sdk.payIns.Create(payIn)
            self._johnsWalletWithMoney = self.sdk.wallets.Get(wallet.Id)
        return self._johnsWalletWithMoney
Exemplo n.º 11
0
    def getJohnsWalletWithMoney(self, amount = 10000):
        """Creates static JohnsWallet (wallets belonging to John) if not created yet
        return Wallet
        """
        if self._johnsWalletWithMoney == None:
            john = self.getJohn()
            wallet = Wallet()
            wallet.Owners = [john.Id]
            wallet.Currency = 'EUR'
            wallet.Description = 'WALLET IN EUR'            
            wallet = self.sdk.wallets.Create(wallet)    
            cardRegistration = CardRegistration()
            cardRegistration.UserId = wallet.Owners[0]
            cardRegistration.Currency = 'EUR'
            cardRegistration = self.sdk.cardRegistrations.Create(cardRegistration)
            cardRegistration.RegistrationData = self.getPaylineCorrectRegistartionData(cardRegistration)
            cardRegistration = self.sdk.cardRegistrations.Update(cardRegistration)
            card = self.sdk.cards.Get(cardRegistration.CardId)
            # create pay-in CARD DIRECT
            payIn = PayIn()
            payIn.CreditedWalletId = wallet.Id
            payIn.AuthorId = cardRegistration.UserId
            payIn.DebitedFunds = Money()
            payIn.DebitedFunds.Amount = amount
            payIn.DebitedFunds.Currency = 'EUR'
            payIn.Fees = Money()
            payIn.Fees.Amount = 0
            payIn.Fees.Currency = 'EUR'
            # payment type as CARD
            payIn.PaymentDetails = PayInPaymentDetailsCard()
            if (card.CardType == 'CB' or card.CardType == 'VISA' or card.CardType == 'MASTERCARD' or card.CardType == CardType.CB_VISA_MASTERCARD):
                payIn.PaymentDetails.CardType = CardType.CB_VISA_MASTERCARD
            # elif (card.CardType == CardType.AMEX):
            #    payIn.PaymentDetails.CardType = CardType.AMEX

            # execution type as DIRECT
            payIn.ExecutionDetails = PayInExecutionDetailsDirect()
            payIn.ExecutionDetails.CardId = card.Id
            payIn.ExecutionDetails.SecureModeReturnURL = 'http://test.com'
            # create Pay-In
            self.sdk.payIns.Create(payIn)
            self._johnsWalletWithMoney = self.sdk.wallets.Get(wallet.Id)
        return self._johnsWalletWithMoney
Exemplo n.º 12
0
 def Get(self, wallet_id):
     wallet = Wallet()
     wallet.id = wallet_id
     wallet.Balance = Money(10000, currency="EUR")
     return wallet
Exemplo n.º 13
0
def make_wallet(mangopay_user_id):
    w = Wallet()
    w.Owners.append(mangopay_user_id)
    w.Description = 'test wallet'
    w.Currency = 'EUR'
    return mangoapi.wallets.Create(w)
Exemplo n.º 14
0
def make_wallet(mangopay_user_id):
    w = Wallet()
    w.Owners.append(mangopay_user_id)
    w.Description = 'test wallet'
    w.Currency = 'EUR'
    return mangoapi.wallets.Create(w)
Exemplo n.º 15
0
 def Get(self, wallet_id):
     wallet = Wallet()
     wallet.id = wallet_id
     wallet.Balance = Money(10000, currency="EUR")
     return wallet