예제 #1
0
        /// <summary>
        /// Cancels a token.
        /// </summary>
        /// <param name="token">the token to cancel</param>
        /// <returns>the result of the cancel operation, , returned by the server</returns>
        public Task <TokenOperationResult> CancelToken(Token token)
        {
            var signer  = cryptoEngine.CreateSigner(Level.Low);
            var request = new CancelTokenRequest
            {
                TokenId   = token.Id,
                Signature = new Signature
                {
                    MemberId   = MemberId,
                    KeyId      = signer.GetKeyId(),
                    Signature_ = signer.Sign(Stringify(token, TokenAction.Cancelled))
                }
            };

            return(gateway(authenticationContext()).CancelTokenAsync(request)
                   .ToTask(response => response.Result));
        }
예제 #2
0
        public ActionResult CancelToken(string token, string reason)
        {
            TokenResponseModel model = new TokenResponseModel();

            int timeStamp = (Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
            CancelTokenRequest request = new CancelTokenRequest();

            request.MERCHANT     = "OPU_TEST";
            request.CANCELREASON = reason;
            request.TIMESTAMP    = timeStamp.ToString();
            request.TOKEN        = token;
            Options options = new Options();

            options.Url         = "https://secure.payu.com.tr/order/token/v2/merchantToken/";
            options.SecretKey   = "SECRET_KEY";
            model.TokenResponse = CancelTokenRequest.Execute(request, options); //api çağrısının başlatıldığı kısmı temsil eder.
            return(View(model));
        }