示例#1
0
 /// <summary>
 /// Get a user's GOMS wallet
 /// </summary>
 /// <param name="user">User with wallet to be retrieved from GOMS.  Will use the active User's wallet</param>
 /// <returns></returns>
 public RespGetWallet GetWallet(User user)
 {
     RespGetWallet result = null;
     try
     {
         if (user != null)
         {
             if (user.IsGomsRegistered)
             {
                 // get user's wallet
                 var wallet = user.UserWallets.FirstOrDefault(w => w.IsActive);
                 if (wallet != null)
                 {
                     result = GetWallet((int)user.GomsCustomerId, user.EMail, (int)wallet.GomsWalletId);
                 }
                 else
                 {
                     throw new GomsInvalidWalletException();
                 }
             }
             else
             {
                 throw new GomsUserNotRegisteredException();
             }
         }
         else
         {
             throw new GomsInvalidUserException();
         }
     }
     catch (GomsException e)
     {
         result = new RespGetWallet { IsSuccess = false, StatusCode = e.StatusCode, StatusMessage = e.StatusMessage };
     }
     return (result);
 }
示例#2
0
 /// <summary>
 /// Get a user's GOMS wallet
 /// </summary>
 /// <param name="gomsCustomerId">User's GOMS Customer ID</param>
 /// <param name="email">User's email address</param>
 /// <param name="gomsWalletId">User's GOMS wallet id</param>
 /// <returns></returns>
 public RespGetWallet GetWallet(int gomsCustomerId, string email, int gomsWalletId)
 {
     InitializeServiceClient();
     RespGetWallet result = null;
     try
     {
         try
         {
             result = _serviceClient.GetWalletInfo(new ReqGetWallet
             {
                 UID = ServiceUserId,
                 PWD = ServicePassword,
                 CustomerId = gomsCustomerId,
                 Email = email,
                 WalletId = gomsWalletId
             });
         }
         catch (Exception e)
         {
             throw new GomsServiceCallException(e.Message);
         }
     }
     catch (GomsException e)
     {
         result = new RespGetWallet { IsSuccess = false, StatusCode = e.StatusCode, StatusMessage = e.StatusMessage };
     }
     return (result);
 }