Пример #1
0
        public bool SendPayment(string userEmail, int points, string userId)
        {
            PaypalPaymentGateway paypalGatway   = new PaypalPaymentGateway();
            string            paymentNote       = string.Format("You have redeemed {0} points", points);
            decimal           amount            = (decimal)(points * 1.0);
            PayoutBatchHeader payoutBatchHeader = paypalGatway.SendPayment(userEmail, amount, paymentNote);

            SavePaymentTransaction(userId, PaymentMethodType.PayPal, payoutBatchHeader.payout_batch_id, amount, PaymentType.Redeem);
            UserGameInfo gameInfo = _GameDataAccess.GetGameInfoByUser(userId);
            int          point    = gameInfo.Point - points;

            _GameDataAccess.SaveUserPoint(userId, point);

            return(true);
        }