public static IGateways RegisterAllinpay(this IGateways gateways) { var merchants = (List <Hashtable>)ConfigurationManager.GetSection("paySharp/allinpays"); if (merchants == null) { return(gateways); } foreach (var item in merchants) { var allinpayGateway = new AllinpayGateway(new Merchant { AppId = item["appId"].ToString(), SubAppId = item["subAppId"].ToString(), MchId = item["mchId"].ToString(), Key = item["key"].ToString(), NotifyUrl = item["notifyUrl"].ToString() }); var gatewayUrl = item["gatewayUrl"].ToString(); if (!string.IsNullOrEmpty(gatewayUrl)) { allinpayGateway.GatewayUrl = gatewayUrl; } gateways.Add(allinpayGateway); } return(gateways); }
public AllinpayGatewayTest(ITestOutputHelper output) { _output = output; _merchant = new Merchant { AppId = "00000051", MchId = "990581007426001", Key = "allinpay888", NotifyUrl = "http://localhost:61337/Notify" }; _allinpayGateway = new AllinpayGateway(_merchant) { GatewayUrl = "https://test.allinpaygd.com" }; }
public static IGateways UseAllinpay(this IGateways gateways, IConfiguration configuration) { var merchants = configuration.GetSection("PaySharp:Allinpays").Get <Merchant[]>(); if (merchants != null) { for (var i = 0; i < merchants.Length; i++) { var allinpayGateway = new AllinpayGateway(merchants[i]); var gatewayUrl = configuration.GetSection($"PaySharp:Allinpays:{i}:GatewayUrl").Value; if (!string.IsNullOrEmpty(gatewayUrl)) { allinpayGateway.GatewayUrl = gatewayUrl; } gateways.Add(allinpayGateway); } } return(gateways); }