示例#1
0
        /// <summary>
        /// Zruseni opakovani plateb
        /// </summary>
        ///
        /// <param name="paymentSessionId">identifikator platby </param>
        /// <param name="targetGoId">identifikator prijemnce - GoId</param>
        /// <param name="secureKey">kryptovaci klic prideleny GoPay</param>
        public static void VoidRecurrentPayment(
            long paymentSessionId,
            long targetGoId,
            string secureKey
            )
        {
            try
            {
                // Inicializace providera pro WS
                AxisEPaymentProviderV2Service provider = new AxisEPaymentProviderV2Service(GopayConfig.Ws);
                EPaymentResult paymentResult;

                // Sestaveni dotazu na stav platby
                string hash = GopayHelper.Hash(
                    GopayHelper.ConcatPaymentSession(
                        targetGoId,
                        paymentSessionId,
                        secureKey)
                    );

                string sessionEncryptedSignature = GopayHelper.Encrypt(hash, secureKey);

                EPaymentSessionInfo paymentSessionInfo = new EPaymentSessionInfo();
                paymentSessionInfo.targetGoId         = targetGoId;
                paymentSessionInfo.paymentSessionId   = paymentSessionId;
                paymentSessionInfo.encryptedSignature = sessionEncryptedSignature;

                paymentResult = provider.voidRecurrentPayment(paymentSessionInfo);

                string returnHash = GopayHelper.Decrypt(paymentResult.encryptedSignature, secureKey);

                if (hash != returnHash)
                {
                    throw new GopayException("Encrypted signature differ");
                }

                if (paymentResult.result == GopayHelper.CALL_RESULT_FAILED)
                {
                    throw new GopayException("autorization not voided [" + paymentResult.resultDescription + "]");
                }
                else if (paymentResult.result == GopayHelper.CALL_RESULT_ACCEPTED)
                {
                    //zruseni opakovani platby bylo zarazeno ke zpracovani
                    //po urcite dobe je nutne dotazat zruseni se shodnymi parametry zda je j*z $paymentResult->result == GopayHelper::CALL_RESULT_FINISHED
                }
                else if (paymentResult.result == GopayHelper.CALL_RESULT_FINISHED)
                {
                    //opakovani platby bylo zruseno
                    //oznacte platbu
                }
            }
            catch (Exception ex)
            {
                //
                // Chyba pri komunikaci s WS
                //
                throw new GopayException(ex.ToString());
            }
        }
示例#2
0
        /// <summary>
        /// Zruseni predautorizovani plateb
        /// </summary>
        ///
        /// <param name="paymentSessionId">identifikator platby </param>
        /// <param name="targetGoId">identifikator prijemnce - GoId</param>
        /// <param name="secureKey">kryptovaci klic prideleny GoPay</param>
        public static void VoidAuthorization(
            long paymentSessionId,
            long targetGoId,
            string secureKey
            )
        {
            try
            {
                // Inicializace providera pro WS
                AxisEPaymentProviderV2Service provider = new AxisEPaymentProviderV2Service(GopayConfig.Ws);
                EPaymentResult paymentResult;

                // Sestaveni dotazu na stav platby
                string sessionEncryptedSignature = GopayHelper.Encrypt(
                    GopayHelper.Hash(
                        GopayHelper.ConcatPaymentSession(
                            targetGoId,
                            paymentSessionId,
                            secureKey)),
                    secureKey);

                EPaymentSessionInfo paymentSessionInfo = new EPaymentSessionInfo();
                paymentSessionInfo.targetGoId         = targetGoId;
                paymentSessionInfo.paymentSessionId   = paymentSessionId;
                paymentSessionInfo.encryptedSignature = sessionEncryptedSignature;

                paymentResult = provider.voidAuthorization(paymentSessionInfo);

                if (paymentResult.result == GopayHelper.CALL_RESULT_FAILED)
                {
                    throw new GopayException("autorization not voided [" + paymentResult.resultDescription + "]");
                }

                //Overeni podpisu
                GopayHelper.CheckPaymentResult(
                    (long)paymentResult.paymentSessionId,
                    paymentResult.encryptedSignature,
                    paymentResult.result,
                    paymentSessionId,
                    secureKey);
            }
            catch (Exception ex)
            {
                //
                // Chyba pri komunikaci s WS
                //
                throw new GopayException(ex.ToString());
            }
        }
示例#3
0
        /// <summary>
        /// Zruseni platby
        /// </summary>
        ///
        /// <param name="paymentSessionId">identifikator platby</param>
        /// <param name="targetGoId">identifikator prijemnce - GoId</param>
        /// <param name="secureKey">kryptovaci klic prideleny GoPay</param>
        ///
        /// <returns>result/returns>
        public static string RefundPayment(
            long paymentSessionId,
            long targetGoId,
            string secureKey)
        {
            try
            {
                // Inicializace providera pro WS
                AxisEPaymentProviderV2Service provider = new AxisEPaymentProviderV2Service(GopayConfig.Ws);
                EPaymentResult paymentResult;

                string encryptedSignature = GopayHelper.Encrypt(
                    GopayHelper.Hash(
                        GopayHelper.ConcatPaymentSession(
                            targetGoId,
                            paymentSessionId,
                            secureKey)
                        ), secureKey);

                EPaymentSessionInfo paymentSessionInfo = new EPaymentSessionInfo();
                paymentSessionInfo.targetGoId         = targetGoId;
                paymentSessionInfo.paymentSessionId   = paymentSessionId;
                paymentSessionInfo.encryptedSignature = encryptedSignature;

                paymentResult = provider.refundPayment(paymentSessionInfo);

                if (paymentResult.result == GopayHelper.CALL_RESULT_FAILED)
                {
                    throw new GopayException("payment not refunded [" + paymentResult.resultDescription + "]");
                }

                return(paymentResult.result);
            }
            catch (Exception ex)
            {
                //
                // Chyba pri komunikaci s WS
                //
                throw new GopayException(ex.ToString());
            }
        }
示例#4
0
 /// <remarks/>
 public System.IAsyncResult BeginpaymentStatus(EPaymentSessionInfo paymentSessionInfo, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("paymentStatus", new object[] {
                 paymentSessionInfo}, callback, asyncState);
 }
示例#5
0
 public EPaymentStatus paymentStatus(EPaymentSessionInfo paymentSessionInfo) {
     object[] results = this.Invoke("paymentStatus", new object[] {
                 paymentSessionInfo});
     return ((EPaymentStatus)(results[0]));
 }
示例#6
0
 /// <remarks/>
 public void refundPaymentAsync(EPaymentSessionInfo sessionInfo) {
     this.refundPaymentAsync(sessionInfo, null);
 }
示例#7
0
 public EPaymentResult refundPayment(EPaymentSessionInfo sessionInfo) {
     object[] results = this.Invoke("refundPayment", new object[] {
                 sessionInfo});
     return ((EPaymentResult)(results[0]));
 }
示例#8
0
 /// <remarks/>
 public void voidRecurrentPaymentAsync(EPaymentSessionInfo sessionInfo) {
     this.voidRecurrentPaymentAsync(sessionInfo, null);
 }
示例#9
0
 public EPaymentResult voidRecurrentPayment(EPaymentSessionInfo sessionInfo) {
     object[] results = this.Invoke("voidRecurrentPayment", new object[] {
                 sessionInfo});
     return ((EPaymentResult)(results[0]));
 }
示例#10
0
        /// <summary>
        /// Zruseni platby
        /// </summary>
        /// 
        /// <param name="paymentSessionId">identifikator platby</param>
        /// <param name="targetGoId">identifikator prijemnce - GoId</param>
        /// <param name="secureKey">kryptovaci klic prideleny GoPay</param>
        ///
        /// <returns>result/returns>
        public static string RefundPayment(
                    long paymentSessionId,
                    long targetGoId,
                    string secureKey)
        {
            try
            {

                // Inicializace providera pro WS
                AxisEPaymentProviderV2Service provider = new AxisEPaymentProviderV2Service(GopayConfig.Ws);
                EPaymentResult paymentResult;

                string encryptedSignature = GopayHelper.Encrypt(
                        GopayHelper.Hash(
                            GopayHelper.ConcatPaymentSession(
                                targetGoId,
                                paymentSessionId,
                                secureKey)
                        ), secureKey);

                EPaymentSessionInfo paymentSessionInfo = new EPaymentSessionInfo();
                paymentSessionInfo.targetGoId = targetGoId;
                paymentSessionInfo.paymentSessionId = paymentSessionId;
                paymentSessionInfo.encryptedSignature = encryptedSignature;

                paymentResult = provider.refundPayment(paymentSessionInfo);

                if (paymentResult.result == GopayHelper.CALL_RESULT_FAILED)
                {
                    throw new GopayException("payment not refunded [" + paymentResult.resultDescription + "]");

                }

                return paymentResult.result;

            }
            catch (Exception ex)
            {
                //
                // Chyba pri komunikaci s WS
                //
                throw new GopayException(ex.ToString());
            }
        }
示例#11
0
        /// <summary>
        /// Zruseni opakovani plateb
        /// </summary>
        /// 
        /// <param name="paymentSessionId">identifikator platby </param>
        /// <param name="targetGoId">identifikator prijemnce - GoId</param>
        /// <param name="secureKey">kryptovaci klic prideleny GoPay</param>
        public static void VoidRecurrentPayment(
                long paymentSessionId,
                long targetGoId,
                string secureKey
                )
        {
            try
            {

                // Inicializace providera pro WS
                AxisEPaymentProviderV2Service provider = new AxisEPaymentProviderV2Service(GopayConfig.Ws);
                EPaymentResult paymentResult;

                // Sestaveni dotazu na stav platby
                string hash = GopayHelper.Hash(
                            GopayHelper.ConcatPaymentSession(
                                targetGoId,
                                paymentSessionId,
                                secureKey)
                    );

                string sessionEncryptedSignature = GopayHelper.Encrypt(hash, secureKey);

                EPaymentSessionInfo paymentSessionInfo = new EPaymentSessionInfo();
                paymentSessionInfo.targetGoId = targetGoId;
                paymentSessionInfo.paymentSessionId = paymentSessionId;
                paymentSessionInfo.encryptedSignature = sessionEncryptedSignature;

                paymentResult = provider.voidRecurrentPayment(paymentSessionInfo);

                string returnHash = GopayHelper.Decrypt(paymentResult.encryptedSignature, secureKey);

                if (hash != returnHash)
                {
                    throw new GopayException("Encrypted signature differ");
                }

                if (paymentResult.result == GopayHelper.CALL_RESULT_FAILED)
                {
                    throw new GopayException("autorization not voided [" + paymentResult.resultDescription + "]");

                }
                else if (paymentResult.result == GopayHelper.CALL_RESULT_ACCEPTED)
                {
                    //zruseni opakovani platby bylo zarazeno ke zpracovani
                    //po urcite dobe je nutne dotazat zruseni se shodnymi parametry zda je j*z $paymentResult->result == GopayHelper::CALL_RESULT_FINISHED

                }
                else if (paymentResult.result == GopayHelper.CALL_RESULT_FINISHED)
                {
                    //opakovani platby bylo zruseno
                    //oznacte platbu
                }

            }
            catch (Exception ex)
            {
                //
                // Chyba pri komunikaci s WS
                //
                throw new GopayException(ex.ToString());
            }

        }
示例#12
0
        /// <summary>
        /// Zruseni predautorizovani plateb
        /// </summary>
        /// 
        /// <param name="paymentSessionId">identifikator platby </param>
        /// <param name="targetGoId">identifikator prijemnce - GoId</param>
        /// <param name="secureKey">kryptovaci klic prideleny GoPay</param>
        public static void VoidAuthorization(
                long paymentSessionId,
                long targetGoId,
                string secureKey
                )
        {
            try
            {

                // Inicializace providera pro WS
                AxisEPaymentProviderV2Service provider = new AxisEPaymentProviderV2Service(GopayConfig.Ws);
                EPaymentResult paymentResult;

                // Sestaveni dotazu na stav platby
                string sessionEncryptedSignature = GopayHelper.Encrypt(
                        GopayHelper.Hash(
                            GopayHelper.ConcatPaymentSession(
                                targetGoId,
                                paymentSessionId,
                                secureKey)),
                             secureKey);

                EPaymentSessionInfo paymentSessionInfo = new EPaymentSessionInfo();
                paymentSessionInfo.targetGoId = targetGoId;
                paymentSessionInfo.paymentSessionId = paymentSessionId;
                paymentSessionInfo.encryptedSignature = sessionEncryptedSignature;

                paymentResult = provider.voidAuthorization(paymentSessionInfo);

                if (paymentResult.result == GopayHelper.CALL_RESULT_FAILED)
                {
                    throw new GopayException("autorization not voided [" + paymentResult.resultDescription + "]");
                }

                //Overeni podpisu
                GopayHelper.CheckPaymentResult(
                        (long)paymentResult.paymentSessionId,
                        paymentResult.encryptedSignature,
                        paymentResult.result,
                        paymentSessionId,
                        secureKey);

            }
            catch (Exception ex)
            {
                //
                // Chyba pri komunikaci s WS
                //
                throw new GopayException(ex.ToString());
            }
        }
示例#13
0
        /// <summary>
        /// Kontrola stavu platby eshopu
        /// - verifikace parametru z redirectu
        /// - kontrola stavu platby
        /// - pokud nesouhlasi udaje vyhazuje GopayException
        /// - pri chybe komunikace s WS vyhazuje GopayException
        /// </summary>
        /// 
        /// <param name="paymentSessionId">identifikator platby </param>
        /// <param name="targetGoId">identifikator prijemnce - GoId</param>
        /// <param name="orderNumber">identifikace akt. objednavky</param>
        /// <param name="totalPriceInCents">celkova cena v halerich</param>
        /// <param name="currency">mena, ve ktere platba probiha</param>
        /// <param name="productName">popis objednavky zobrazujici se na platebni brane</param>
        /// <param name="secureKey">kryptovaci klic pridelene GoPay</param>
        /// 	  
        /// <returns>callbackResult</returns>
        /// callbackResult.sessionState   - stav platby
        /// callbackResult.sessionSubState - detailnejsi popis stavu platby
        public static CallbackResult IsPaymentDone(
                long paymentSessionId,
                long targetGoId,
                string orderNumber,
                long totalPriceInCents,
                string currency,
                string productName,
                string secureKey)
        {

            // Inicializace providera pro WS
            AxisEPaymentProviderV2Service provider = new AxisEPaymentProviderV2Service(GopayConfig.Ws);
            EPaymentStatus status;

            // Sestaveni dotazu na stav platby
            string sessionEncryptedSignature = GopayHelper.Encrypt(
                    GopayHelper.Hash(
                        GopayHelper.ConcatPaymentSession(
                            targetGoId,
                            paymentSessionId,
                            secureKey)
                    ), secureKey);

            EPaymentSessionInfo paymentSessionInfo = new EPaymentSessionInfo();
            paymentSessionInfo.targetGoId = targetGoId;
            paymentSessionInfo.paymentSessionId = paymentSessionId;
            paymentSessionInfo.encryptedSignature = sessionEncryptedSignature;

            CallbackResult callbackResult = new CallbackResult();

            try
            {
                /*
                 * Kontrola stavu platby na strane GoPay prostrednictvim WS 
                 */
                status = provider.paymentStatus(paymentSessionInfo);

                callbackResult.sessionState = status.sessionState;
                callbackResult.sessionSubState = status.sessionSubState;

                /*
                 * Kontrola zaplacenosti objednavky, verifikace parametru objednavky
                 */
                if (status.result != GopayHelper.CALL_COMPLETED)
                {
                    throw new GopayException("Payment Status Call failed: " + status.resultDescription);
                }

                if (callbackResult.sessionState != GopayHelper.SessionState.PAYMENT_METHOD_CHOSEN.ToString()
                        && callbackResult.sessionState != GopayHelper.SessionState.CREATED.ToString()
                        && callbackResult.sessionState != GopayHelper.SessionState.PAID.ToString()
                        && callbackResult.sessionState != GopayHelper.SessionState.AUTHORIZED.ToString()
                        && callbackResult.sessionState != GopayHelper.SessionState.CANCELED.ToString()
                        && callbackResult.sessionState != GopayHelper.SessionState.TIMEOUTED.ToString()
                        && callbackResult.sessionState != GopayHelper.SessionState.REFUNDED.ToString()
                    )
                {

                    throw new GopayException("Bad Payment Session State: " + callbackResult.sessionState);
                }

                GopayHelper.CheckPaymentStatus(
                                status,
                                callbackResult.sessionState,
                                targetGoId,
                                orderNumber,
                                totalPriceInCents,
                                currency,
                                productName,
                                secureKey);

                return callbackResult;

            }
            catch (Exception ex1)
            {

                callbackResult.sessionState = GopayHelper.SessionState.FAILED.ToString();

            }
            finally
            {
                provider.Dispose();
            }

            return callbackResult;
        }
示例#14
0
 /// <remarks/>
 public void paymentStatusAsync(EPaymentSessionInfo paymentSessionInfo) {
     this.paymentStatusAsync(paymentSessionInfo, null);
 }
示例#15
0
 /// <remarks/>
 public void capturePaymentAsync(EPaymentSessionInfo sessionInfo) {
     this.capturePaymentAsync(sessionInfo, null);
 }
示例#16
0
 /// <remarks/>
 public void paymentStatusAsync(EPaymentSessionInfo paymentSessionInfo, object userState) {
     if ((this.paymentStatusOperationCompleted == null)) {
         this.paymentStatusOperationCompleted = new System.Threading.SendOrPostCallback(this.OnpaymentStatusOperationCompleted);
     }
     this.InvokeAsync("paymentStatus", new object[] {
                 paymentSessionInfo}, this.paymentStatusOperationCompleted, userState);
 }
示例#17
0
 public EPaymentResult voidAuthorization(EPaymentSessionInfo sessionInfo) {
     object[] results = this.Invoke("voidAuthorization", new object[] {
                 sessionInfo});
     return ((EPaymentResult)(results[0]));
 }
示例#18
0
 /// <remarks/>
 public System.IAsyncResult BeginvoidRecurrentPayment(EPaymentSessionInfo sessionInfo, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("voidRecurrentPayment", new object[] {
                 sessionInfo}, callback, asyncState);
 }
示例#19
0
 /// <remarks/>
 public void voidAuthorizationAsync(EPaymentSessionInfo sessionInfo) {
     this.voidAuthorizationAsync(sessionInfo, null);
 }
示例#20
0
 /// <remarks/>
 public void voidRecurrentPaymentAsync(EPaymentSessionInfo sessionInfo, object userState) {
     if ((this.voidRecurrentPaymentOperationCompleted == null)) {
         this.voidRecurrentPaymentOperationCompleted = new System.Threading.SendOrPostCallback(this.OnvoidRecurrentPaymentOperationCompleted);
     }
     this.InvokeAsync("voidRecurrentPayment", new object[] {
                 sessionInfo}, this.voidRecurrentPaymentOperationCompleted, userState);
 }
示例#21
0
        /// <summary>
        /// Kontrola stavu platby eshopu
        /// - verifikace parametru z redirectu
        /// - kontrola stavu platby
        /// - pokud nesouhlasi udaje vyhazuje GopayException
        /// - pri chybe komunikace s WS vyhazuje GopayException
        /// </summary>
        ///
        /// <param name="paymentSessionId">identifikator platby </param>
        /// <param name="targetGoId">identifikator prijemnce - GoId</param>
        /// <param name="orderNumber">identifikace akt. objednavky</param>
        /// <param name="totalPriceInCents">celkova cena v halerich</param>
        /// <param name="currency">mena, ve ktere platba probiha</param>
        /// <param name="productName">popis objednavky zobrazujici se na platebni brane</param>
        /// <param name="secureKey">kryptovaci klic pridelene GoPay</param>
        ///
        /// <returns>callbackResult</returns>
        /// callbackResult.sessionState   - stav platby
        /// callbackResult.sessionSubState - detailnejsi popis stavu platby
        public static CallbackResult IsPaymentDone(
            long paymentSessionId,
            long targetGoId,
            string orderNumber,
            long totalPriceInCents,
            string currency,
            string productName,
            string secureKey)
        {
            // Inicializace providera pro WS
            AxisEPaymentProviderV2Service provider = new AxisEPaymentProviderV2Service(GopayConfig.Ws);
            EPaymentStatus status;

            // Sestaveni dotazu na stav platby
            string sessionEncryptedSignature = GopayHelper.Encrypt(
                GopayHelper.Hash(
                    GopayHelper.ConcatPaymentSession(
                        targetGoId,
                        paymentSessionId,
                        secureKey)
                    ), secureKey);

            EPaymentSessionInfo paymentSessionInfo = new EPaymentSessionInfo();

            paymentSessionInfo.targetGoId         = targetGoId;
            paymentSessionInfo.paymentSessionId   = paymentSessionId;
            paymentSessionInfo.encryptedSignature = sessionEncryptedSignature;

            CallbackResult callbackResult = new CallbackResult();

            try
            {
                /*
                 * Kontrola stavu platby na strane GoPay prostrednictvim WS
                 */
                status = provider.paymentStatus(paymentSessionInfo);

                callbackResult.sessionState    = status.sessionState;
                callbackResult.sessionSubState = status.sessionSubState;

                /*
                 * Kontrola zaplacenosti objednavky, verifikace parametru objednavky
                 */
                if (status.result != GopayHelper.CALL_COMPLETED)
                {
                    throw new GopayException("Payment Status Call failed: " + status.resultDescription);
                }

                if (callbackResult.sessionState != GopayHelper.SessionState.PAYMENT_METHOD_CHOSEN.ToString() &&
                    callbackResult.sessionState != GopayHelper.SessionState.CREATED.ToString() &&
                    callbackResult.sessionState != GopayHelper.SessionState.PAID.ToString() &&
                    callbackResult.sessionState != GopayHelper.SessionState.AUTHORIZED.ToString() &&
                    callbackResult.sessionState != GopayHelper.SessionState.CANCELED.ToString() &&
                    callbackResult.sessionState != GopayHelper.SessionState.TIMEOUTED.ToString() &&
                    callbackResult.sessionState != GopayHelper.SessionState.REFUNDED.ToString()
                    )
                {
                    throw new GopayException("Bad Payment Session State: " + callbackResult.sessionState);
                }

                GopayHelper.CheckPaymentStatus(
                    status,
                    callbackResult.sessionState,
                    targetGoId,
                    orderNumber,
                    totalPriceInCents,
                    currency,
                    productName,
                    secureKey);

                return(callbackResult);
            }
            catch (Exception ex1)
            {
                callbackResult.sessionState = GopayHelper.SessionState.FAILED.ToString();
            }
            finally
            {
                provider.Dispose();
            }

            return(callbackResult);
        }