|
|
using System;
|
|
|
using System.Text;
|
|
|
using BWP.ABCClient.Businesses;
|
|
|
using NUnit.Framework;
|
|
|
|
|
|
namespace BWP.ABCClient
|
|
|
{
|
|
|
[TestFixture]
|
|
|
public class B2BReceivingPaymentTest
|
|
|
{
|
|
|
[Test]
|
|
|
public void AssignValue()
|
|
|
{
|
|
|
EnsureCertsExists();
|
|
|
B2BReceivingPayment collections = new B2BReceivingPayment();
|
|
|
collections.MerchantID = "337100000000066";
|
|
|
collections.Date = DateTime.Now;
|
|
|
collections.Amount = 234.5m;
|
|
|
collections.AccountNo = "622587263489712639846";
|
|
|
collections.AccountName = string.Empty;
|
|
|
collections.AccountBank = string.Empty;
|
|
|
collections.ResultNotifyURL = "http://a.b.c.d";
|
|
|
collections.Remarks = string.Empty;
|
|
|
collections.Operator = string.Empty;
|
|
|
collections.SequenceNo = "209329384902834";
|
|
|
collections.RequestUrl = "http://localhost:5000/B2B/";
|
|
|
using (new MockWebServer("http://localhost:5000/B2B/", Encoding.UTF8, Encoding.UTF8, false)) {
|
|
|
collections.Request();
|
|
|
}
|
|
|
}
|
|
|
|
|
|
[Test]
|
|
|
public void ReturnValue()
|
|
|
{
|
|
|
EnsureCertsExists();
|
|
|
B2BReceivingPayment collections = new B2BReceivingPayment();
|
|
|
collections.MerchantID = "337100000000066";
|
|
|
collections.Date = DateTime.Now;
|
|
|
collections.Amount = 234.5m;
|
|
|
collections.AccountNo = "622587263489712639846";
|
|
|
collections.ResultNotifyURL = "http://a.b.c.d";
|
|
|
collections.SequenceNo = "209329384902834";
|
|
|
collections.RequestUrl = "http://localhost:5000/B2B/";
|
|
|
using (new MockWebServer("http://localhost:5000/B2B/", Encoding.UTF8, Encoding.UTF8, false)) {
|
|
|
collections.Request();
|
|
|
}
|
|
|
Assert.AreEqual("https://easyabc.95599.cn/b2b/NotCheckStatus/PaymentModeAct.ebf?TOKEN=12975716546177309876", collections.PaymentUrl);
|
|
|
}
|
|
|
|
|
|
public static void EnsureCertsExists()
|
|
|
{
|
|
|
var certManager = new CertManager();
|
|
|
certManager.SetupPfx("Certs/asB.pfx", "14814622");
|
|
|
certManager.SetupABCPubKey("Certs/TrustPay.cer");
|
|
|
}
|
|
|
}
|
|
|
}
|