def create(self, debited_funds, fees=None, secure_mode_return_url=None): pay_in = PayIn() pay_in.AuthorId = self.mangopay_user.mangopay_id pay_in.CreditedUserId = self.mangopay_wallet.mangopay_user.mangopay_id pay_in.CreditedWalletId = self.mangopay_wallet.mangopay_id pay_in.DebitedFunds = python_money_to_mangopay_money(debited_funds) if not fees: fees = PythonMoney(0, debited_funds.currency) pay_in.Fees = python_money_to_mangopay_money(fees) payment_details = PayInPaymentDetailsCard() payment_details.CardType = "CB_VISA_MASTERCARD" pay_in.PaymentDetails = payment_details execution_details = PayInExecutionDetailsDirect() execution_details.CardId = self.mangopay_card.mangopay_id execution_details.SecureModeReturnURL = secure_mode_return_url execution_details.SecureMode = "DEFAULT" pay_in.ExecutionDetails = execution_details client = get_mangopay_api_client() created_pay_in = client.payIns.Create(pay_in) self.mangopay_id = created_pay_in.Id self._update(created_pay_in)
def create(self, secure_mode_return_url): pay_in = PayIn() pay_in.AuthorId = self.mangopay_user.mangopay_id pay_in.CreditedUserId = self.mangopay_user.mangopay_id pay_in.CreditedWalletId = self.mangopay_wallet.mangopay_id pay_in.DebitedFunds = python_money_to_mangopay_money( self.debited_funds) pay_in.Fees = python_money_to_mangopay_money(self.fees) payment_details = PayInPaymentDetailsCard() payment_details.CardType = "CB_VISA_MASTERCARD" pay_in.PaymentDetails = payment_details execution_details = PayInExecutionDetailsDirect() execution_details.CardId = self.mangopay_card.mangopay_id execution_details.SecureModeReturnURL = secure_mode_return_url execution_details.SecureMode = "DEFAULT" pay_in.ExecutionDetails = execution_details client = get_mangopay_api_client() created_pay_in = client.payIns.Create(pay_in) self.mangopay_id = created_pay_in.Id self._update(created_pay_in)
def _get_execution_details(self): execution_details = PayInExecutionDetailsDirect() execution_details.CardId = self.mangopay_card.mangopay_id execution_details.SecureModeReturnURL = self.secure_mode_return_url execution_details.SecureMode = "DEFAULT" return execution_details