/// <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()); } }
/// <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()); } }
/// <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()); } }
/// <remarks/> public System.IAsyncResult BeginpaymentStatus(EPaymentSessionInfo paymentSessionInfo, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("paymentStatus", new object[] { paymentSessionInfo}, callback, asyncState); }
public EPaymentStatus paymentStatus(EPaymentSessionInfo paymentSessionInfo) { object[] results = this.Invoke("paymentStatus", new object[] { paymentSessionInfo}); return ((EPaymentStatus)(results[0])); }
/// <remarks/> public void refundPaymentAsync(EPaymentSessionInfo sessionInfo) { this.refundPaymentAsync(sessionInfo, null); }
public EPaymentResult refundPayment(EPaymentSessionInfo sessionInfo) { object[] results = this.Invoke("refundPayment", new object[] { sessionInfo}); return ((EPaymentResult)(results[0])); }
/// <remarks/> public void voidRecurrentPaymentAsync(EPaymentSessionInfo sessionInfo) { this.voidRecurrentPaymentAsync(sessionInfo, null); }
public EPaymentResult voidRecurrentPayment(EPaymentSessionInfo sessionInfo) { object[] results = this.Invoke("voidRecurrentPayment", new object[] { sessionInfo}); return ((EPaymentResult)(results[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()); } }
/// <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; }
/// <remarks/> public void paymentStatusAsync(EPaymentSessionInfo paymentSessionInfo) { this.paymentStatusAsync(paymentSessionInfo, null); }
/// <remarks/> public void capturePaymentAsync(EPaymentSessionInfo sessionInfo) { this.capturePaymentAsync(sessionInfo, null); }
/// <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); }
public EPaymentResult voidAuthorization(EPaymentSessionInfo sessionInfo) { object[] results = this.Invoke("voidAuthorization", new object[] { sessionInfo}); return ((EPaymentResult)(results[0])); }
/// <remarks/> public System.IAsyncResult BeginvoidRecurrentPayment(EPaymentSessionInfo sessionInfo, System.AsyncCallback callback, object asyncState) { return this.BeginInvoke("voidRecurrentPayment", new object[] { sessionInfo}, callback, asyncState); }
/// <remarks/> public void voidAuthorizationAsync(EPaymentSessionInfo sessionInfo) { this.voidAuthorizationAsync(sessionInfo, null); }
/// <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); }
/// <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); }