public void preparePayParametersTest() { BeeCloud.registerApp("c5d1cba1-5e3f-4ba0-941d-9b0a371fe719", "39a7a518-9ac8-4a9e-87bc-7885f33cf18c", "e14ae2db-608c-4f8b-b863-c8c18953eef2", null); BCBill bill = new BCBill("ALI", 100, "10000000", "UT"); bill.optional = new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" } }; Analysis anaylsis = new Analysis(); anaylsis.product = new List <Product>(); Product p1 = new Product(); p1.name = "apple"; p1.count = 10; p1.price = 1000; Product p2 = new Product(); p2.name = "pair"; p2.count = 2; p2.price = 2500; anaylsis.product.Add(p1); anaylsis.product.Add(p2); anaylsis.ip = "111.123.1.12"; bill.analysis = anaylsis; bill.returnUrl = "http://www.test.com"; bill.billTimeout = 360; string paraString = "\"channel\":\"ALI\",\"total_fee\":100,\"bill_no\":\"10000000\",\"title\":\"UT\",\"return_url\":\"http://www.test.com\",\"bill_timeout\":360,\"openid\":null,\"show_url\":null,\"qr_pay_mode\":null,\"identity_id\":null,\"optional\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"analysis\":{\"product\":[{\"name\":\"apple\",\"count\":10,\"price\":1000},{\"name\":\"pair\",\"count\":2,\"price\":2500}],\"ip\":\"111.123.1.12\"},\"bc_analysis\":{\"sdk_version\":\"2.8.0\"}}"; string actual = BCPay.preparePayParameters(bill); Assert.IsTrue(actual.Contains(paraString)); }
public void prepareBCTransferWithBankCardTest() { BeeCloud.registerApp("c5d1cba1-5e3f-4ba0-941d-9b0a371fe719", "39a7a518-9ac8-4a9e-87bc-7885f33cf18c", "e14ae2db-608c-4f8b-b863-c8c18953eef2", null); string paraString = BCPay.prepareBCTransferWithBankCard(new BCTransferWithBackCard(1, "8558f188e3cb4008bf8ab077d11f59bf", ".net测试代付", "OUT_PC", "中国银行", "DE", "P", "xxxxxxxxxxxxxxx", "xxx")); Assert.IsTrue(paraString.Contains("\"total_fee\":1,\"bill_no\":\"8558f188e3cb4008bf8ab077d11f59bf\",\"title\":\".net\\u6D4B\\u8BD5\\u4EE3\\u4ED8\",\"trade_source\":\"OUT_PC\",\"bank_fullname\":\"\\u4E2D\\u56FD\\u94F6\\u884C\",\"card_type\":\"DE\",\"account_type\":\"P\",\"account_no\":\"xxxxxxxxxxxxxxx\",\"account_name\":\"xxx\",\"mobile\":null}")); }
public void GetSignTest() { BeeCloud.registerApp("afae2a33-c9cb-4139-88c9-af5c1df472e1", "fc8865bb-9dca-454e-ba8e-0d8ed6cc83a2", "506371c7-b095-45da-bfce-9ae857c41a85", null); string sign = "e204d63775d3d29dafe6788a0a978755"; string actual = BCUtil.GetSign("5f0c1466d8bd11e6b66d00163e005bb3", "PAY", "BC", 1); Assert.IsTrue(actual.Equals(sign)); }
public void prepareRefundStatusQueryParametersTest() { BeeCloud.registerApp("c5d1cba1-5e3f-4ba0-941d-9b0a371fe719", "39a7a518-9ac8-4a9e-87bc-7885f33cf18c", "e14ae2db-608c-4f8b-b863-c8c18953eef2", null); string paraString = "\"channel\":\"WX\",\"refund_no\":\"00000001\"}"; string actual = BCPay.prepareRefundStatusQueryParameters("WX", "00000001"); Assert.IsTrue(actual.Contains(paraString)); }
public void prepareQueryByIdParametersTest() { BeeCloud.registerApp("c5d1cba1-5e3f-4ba0-941d-9b0a371fe719", "39a7a518-9ac8-4a9e-87bc-7885f33cf18c", "e14ae2db-608c-4f8b-b863-c8c18953eef2", null); string paraString = "{\"app_id\":\"c5d1cba1-5e3f-4ba0-941d-9b0a371fe719\",\"app_sign\":"; string actual = BCPay.prepareQueryByIdParameters("000000001"); Assert.IsTrue(actual.Contains(paraString)); }
public void prepareApproveRefundParametersTest() { string paraString = "\"channel\":\"ALI\",\"ids\":[\"001\",\"002\"],\"agree\":true,\"denyReason\":null}"; BeeCloud.registerApp("c5d1cba1-5e3f-4ba0-941d-9b0a371fe719", "39a7a518-9ac8-4a9e-87bc-7885f33cf18c", "e14ae2db-608c-4f8b-b863-c8c18953eef2", null); string actual = BCPay.prepareApproveRefundParameters("ALI", new List <string> { "001", "002" }, true, null); Assert.IsTrue(actual.Contains(paraString)); }
public void BCUserRegisterTest() { BeeCloud.registerApp("beacfdf5-badd-4a11-9b23-9ef3801732d1", "0fa599d9-b0ae-41b3-85de-d3153809004d", "e14ae2db-608c-4f8b-b863-c8c18953eef2", "4bfdd244-574d-4bf3-b034-0c751ed34fee"); bool result = false; try { result = BCPay.BCUserRegister("1821111111206"); } catch (Exception ex) { Console.WriteLine(ex.Message); } Assert.IsTrue(result); }
public void prepareRefundParametersTest() { BCRefund refund = new BCRefund("10000000", "20000000", 100); refund.channel = "WX"; refund.optional = new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" } }; string paraString = "\"channel\":\"WX\",\"refund_no\":\"20000000\",\"bill_no\":\"10000000\",\"refund_fee\":100,\"refund_account\":0,\"optional\":{\"key1\":\"value1\",\"key2\":\"value2\"},\"need_approval\":false}"; BeeCloud.registerApp("c5d1cba1-5e3f-4ba0-941d-9b0a371fe719", "39a7a518-9ac8-4a9e-87bc-7885f33cf18c", "e14ae2db-608c-4f8b-b863-c8c18953eef2", null); string actual = BCPay.prepareRefundParameters(refund); Assert.IsTrue(actual.Contains(paraString)); }
public void BCMarketingQueryCoupons() { BeeCloud.registerApp("beacfdf5-badd-4a11-9b23-9ef3801732d1", "0fa599d9-b0ae-41b3-85de-d3153809004d", "e14ae2db-608c-4f8b-b863-c8c18953eef2", "4bfdd244-574d-4bf3-b034-0c751ed34fee"); List <BCCoupon> coupons = new List <BCCoupon>(); try { coupons = BCPay.BCMarketingQueryCoupons("201708111", null, null, null, null); Console.WriteLine(coupons.Count); } catch (Exception ex) { Console.WriteLine(ex.Message); } Assert.IsTrue(coupons.Count == 5); }
public void BCMarketingDeliverCoupons() { BeeCloud.registerApp("beacfdf5-badd-4a11-9b23-9ef3801732d1", "0fa599d9-b0ae-41b3-85de-d3153809004d", "e14ae2db-608c-4f8b-b863-c8c18953eef2", "4bfdd244-574d-4bf3-b034-0c751ed34fee"); BCCoupon coupon = new BCCoupon(); try { coupon = BCPay.BCMarketingDeliverCoupons("87ef185d-b279-4490-b33d-da09d127acda", "xz-test-buyer1"); Console.WriteLine(coupon.id); } catch (Exception ex) { Console.WriteLine(ex.Message); } Assert.IsTrue(coupon.template.name == "CShape测试"); }
public void BCUserInfoQueryTest() { BeeCloud.registerApp("beacfdf5-badd-4a11-9b23-9ef3801732d1", "0fa599d9-b0ae-41b3-85de-d3153809004d", "e14ae2db-608c-4f8b-b863-c8c18953eef2", "4bfdd244-574d-4bf3-b034-0c751ed34fee"); List <string> users = new List <string>(); try { users = BCPay.BCUserInfoQuery("*****@*****.**", new DateTime(2017, 6, 2), new DateTime(2017, 6, 2, 23, 59, 59)); Console.WriteLine(users.Count); } catch (Exception ex) { Console.WriteLine(ex.Message); } Assert.IsTrue(users.Count > 0); }
public void prepareRefundQueryByConditionParametersTest() { BeeCloud.registerApp("c5d1cba1-5e3f-4ba0-941d-9b0a371fe719", "39a7a518-9ac8-4a9e-87bc-7885f33cf18c", "e14ae2db-608c-4f8b-b863-c8c18953eef2", null); BCQueryRefundParameter para = new BCQueryRefundParameter(); para.channel = "ALI"; para.limit = 2; para.needDetail = true; para.skip = 10; para.startTime = 1000000000000; para.endTime = 1100000000000; string paraString = "\"channel\":\"ALI\",\"bill_no\":null,\"refund_no\":null,\"start_time\":1000000000000,\"end_time\":1100000000000,\"need_approval\":null,\"need_detail\":true,\"skip\":10,\"limit\":2}"; string actual = BCPay.prepareRefundQueryByConditionParameters(para); Assert.IsTrue(actual.Contains(paraString)); }
public void reset() { BeeCloud.registerApp(null, null, null, null); }