私は、DPS(http://sec.paymentexpress.com/technical_resources/ecommerce_hosted/pxpay.html)のASP.Net(C#)のサンプルコードを実装して、弊社。私はそれが正常に動作していた、それはちょうどそうであるように、支払Expressに要求を送信し、応答を得る、等。ボタンのクリックイベントが新しい統合後に停止しました
私はそれを私のシステムに統合しようとしました。私は自分のプロジェクトからいくつかの参照を追加し、それを継承し、別のクラスに "look up/add the database"関数を移動させる基本クラスを与えました。
結局のところ、私は再びそれをテストし、ボタンのクリックイベントは発生していません。私はそれが新しい継承と関係するかもしれないと思ったので、私はページを(以前と同じように)継承するように変更しましたが、それは助けにはなりませんでした。
"look up/add to the database"機能は後で提供されるので、私はそれが何かと関係ないと思う。
誰かが間違っている可能性があることを知っていますか?
明確にするために、私はイベントの最初の行として例外を投げたので例外が発生していないと言いますが、例外は投げていません。しかし、ボタンはポストバックを行うようです。ここで
はいくつかのコードです:
ASPX:
<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Default.aspx.cs"
Inherits="PaymentGatewayDPS._Default" enableViewState="false" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org
/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>PxPay .Net 3.5 test page</title>
</head>
<body>
<form id="form1" runat="server">
<table style="width: 100%">
<tr>
<td>
Amount
</td>
<td>
<asp:TextBox ID="txtAmountInput" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Currency
</td>
<td>
<asp:TextBox ID="txtCurrencyInput" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Reference
</td>
<td>
<asp:TextBox ID="txtMerchantReference" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Transaction type
</td>
<td>
<asp:DropDownList ID="ddlTxnType" runat="server">
<asp:ListItem Selected="True">Purchase</asp:ListItem>
<asp:ListItem Value="Auth">Authorisation</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button ID="Button1" runat="server" Text="Submit"
OnClick="Button1_Click"/>
</td>
</tr>
</table>
<asp:Panel ID="Panel1" runat="server">
</asp:Panel>
<asp:Literal id="LitTest" runat="server"/>
</form>
</body>
</html>
私のC#のコードの先頭:
namespace PaymentGatewayDPS
{
public partial class _Default : TCInsuredQuoteBase
{
マイボタンイベント:
protected void Button1_Click(object sender, EventArgs e)
{
throw new Exception("button clicked");
string PxPayUserId = ConfigurationManager.AppSettings["PxPayUserId"];
string PxPayKey = ConfigurationManager.AppSettings["PxPayKey"];
PxPay WS = new PxPay(PxPayUserId, PxPayKey);
RequestInput input = new RequestInput();
input.AmountInput = txtAmountInput.Text;
input.CurrencyInput = txtCurrencyInput.Text;
input.MerchantReference = txtMerchantReference.Text;
input.TxnType = ddlTxnType.Text;
input.UrlFail = Request.Url.GetLeftPart(UriPartial.Path);
input.UrlSuccess = Request.Url.GetLeftPart(UriPartial.Path);
// TODO: GUID representing unique identifier for the transaction within the shopping cart (normally would be an order ID or similar)
Guid orderId = Guid.NewGuid();
input.TxnId = orderId.ToString();
throw new Exception("about to Generate Request");
RequestOutput output = WS.GenerateRequest(input);
if (output.valid == "1")
{
// Redirect user to payment page
Response.Redirect(output.Url);
}
}
あなたのコードをデバッグして、来るtllが文をスローするかどうか試してみませんか? – DotNetUser
参照してください、そこに問題があります。私はMonoDevelopを使用しており、私たちのコードが編成されている方法では、デバッグは機能しません。それは本当の痛みです。だから私は例外を使用していた。 –
aspxマークアップでAutoEventWireupをtrueに設定しましたか? – DotNetUser