Exemplo n.º 1
0
 public AccountResponse Get(AccountRequest req)
 {
     AccountResponse response;
     try
     {
         response = new WePayClient().Invoke<AccountRequest, AccountResponse>(req, req.actionUrl, req.accessToken);
     }
     catch (WePayException ex)
     {
         response = new AccountResponse { name = ex.error, Error = ex };
     }
     return response;
 }
Exemplo n.º 2
0
        public CheckoutCreateResponse Post(CheckoutCreateRequest req)
        {
            CheckoutCreateResponse response;
            try
            {
                response = new WePayClient().Invoke<CheckoutCreateRequest, CheckoutCreateResponse>(req, req.actionUrl,req.accessToken);
            }
            catch (WePayException ex)
            {
                response = new CheckoutCreateResponse { checkout_id = 0, checkout_uri =req.redirect_uri+"?error="+ex.error, Error =ex };
            }

            return response;
        }
Exemplo n.º 3
0
 public CheckoutResponse GetStatus(long checkout_id)
 {
     var req = new CheckoutRequest { checkout_id = checkout_id };
     CheckoutResponse response;
     try
     {
         response = new WePayClient().Invoke<CheckoutRequest, CheckoutResponse>(req, req.actionUrl);
     }
     catch (WePayException ex)
     {
         response = new CheckoutResponse { state = ex.error, amount = 0, Error = ex };
     }
     return response;
 }
Exemplo n.º 4
0
        public PreapprovalCreateResponse Post(PreapprovalCreateRequest req)
        {
            PreapprovalCreateResponse response;
            try
            {
                response = new WePayClient().Invoke<PreapprovalCreateRequest, PreapprovalCreateResponse>(req, req.actionUrl, req.accessToken);
            }
            catch(WePayException ex)
            {
                response = new PreapprovalCreateResponse { preapproval_uri = req.redirect_uri+"?error="+ex.error, Error = ex };
            }

            return response;
        }
Exemplo n.º 5
0
 public PreapprovalResponse GetStatus(PreapprovalRequest req)
 {
     // var req = new PreapprovalRequest { preapproval_id = preapproval_id };
     PreapprovalResponse response;
     try
     {
         response = new WePayClient().Invoke<PreapprovalRequest, PreapprovalResponse>(req, req.actionUrl);
     }
     catch (WePayException ex)
     {
         response = new PreapprovalResponse { state = ex.error, amount = 0, Error = ex };
     }
     return response;
 }
Exemplo n.º 6
0
        public TokenResponse Authorize(TokenRequest req)
        {
            TokenResponse response;
            try
            {
                response = new WePayClient().Invoke<TokenRequest, TokenResponse>(req, req.actionUrl);
            }
            catch (WePayException ex)
            {
                response = new TokenResponse { access_token = "error", Error=ex };
            }

            return response;
        }
Exemplo n.º 7
0
        public UserRegisterResponse Register(UserRegisterRequest req)
        {
            UserRegisterResponse response;
            try
            {
                response = new WePayClient().Invoke<UserRegisterRequest, UserRegisterResponse>(req, req.actionUrl);
            }
            catch (WePayException ex)
            {
                response = new UserRegisterResponse { access_token = "error", Error=ex };
            }

            return response;
        }
Exemplo n.º 8
0
        public AccountCreateResponse Post(AccountCreateRequest req)
        {
            AccountCreateResponse response;
            try
            {
                response = new WePayClient().Invoke<AccountCreateRequest, AccountCreateResponse>(req, req.actionUrl, req.accessToken);
            }
            catch(WePayException ex)
            {
                response = new AccountCreateResponse { account_id=0, Error = ex };
            }

            return response;
        }
Exemplo n.º 9
0
        public UserResponse GetUser(string accessToken)
        {
            UserRequest req = new UserRequest { accessToken = accessToken };
            UserResponse response;
            try
            {
                response = new WePayClient().Invoke<UserRequest, UserResponse>(req, req.actionUrl, accessToken);
            }
            catch (WePayException ex)
            {
                response = new UserResponse { state = "error", Error=ex };
            }

            return response;
        }
Exemplo n.º 10
0
        public CheckoutResponse Post(CheckoutCreateRequest req)
        {
            CheckoutResponse response;
            try
            {
                response = new WePayClient().Invoke<CheckoutCreateRequest, CheckoutResponse>(req, req.actionUrl, WePayConfig.accessToken);
            }
            catch (WePayException ex)
            {
                response = new CheckoutResponse();
                response.Error = ex;
            }

            return response;
        }