/// <summary> /// 发起支付,预下单,构建订单数据 /// </summary> /// <param name="req"></param> /// <returns></returns> public CreatePaymentRes Any(CreatePaymentReq req) { var res = new CreatePaymentRes(); try { var m_req = Mapper.Map <CreatePaymentReq, M_CreatePaymentReq>(req); var ptcp = ServiceImpl.CreatePayment(m_req); if (ptcp.DoFlag == PtcpState.Success) { res.DoFlag = (int)PtcpState.Success; } res.DoResult = ptcp.DoResult; if (ptcp.ReturnValue.IsNotNull()) { res.ApiParam = ptcp.ReturnValue.ApiParam; res.OrderNo = ptcp.ReturnValue.OrderNo; } } catch (Exception ex) { res.DoResult = "系统繁忙,请稍后再试"; } return(res); }
public async void Test_CreatePayment_Valid() { var req = new CreatePaymentReq { RequestId = Guid.NewGuid().ToString(), AccountId = Config.ACCOUNT_ID, Amount = 100, Currency = Config.CURRENCY, Reference = "Invoice payment #123", Receiver = new CreatePaymentReq.ReceiverData { CounterpartyId = Config.COUNTERPARTY_ID, AccountId = Config.COUNTERPARTY_ACCOUNT_ID, } }; var resp = await _paymentClient.CreatePayment(req); Assert.NotNull(resp); }
public async Task <Result <CreatePaymentResp> > CreatePayment(CreatePaymentReq req) { string endpoint = "/pay"; return(await _apiClient.Post <CreatePaymentResp>(endpoint, req)); }