本文整理了Java中com.egzosn.pay.common.util.Util.conversionAmount()
方法的一些代码示例,展示了Util.conversionAmount()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.conversionAmount()
方法的具体详情如下:
包路径:com.egzosn.pay.common.util.Util
类名称:Util
方法名:conversionAmount
[英]元,两位小数
[中]元,两位小数
代码示例来源:origin: egzosn/pay-java-parent
/**
* 返回创建的订单信息
*
* @param order 支付订单
*
* @return 订单信息
* @see PayOrder 支付订单信息
*/
@Override
public Map<String, Object> orderInfo(PayOrder order) {
Map<String, Object> params = new HashMap<>(7);
params.put("payee_id", order.getAuthCode());
params.put("amount", Util.conversionAmount(order.getPrice()));
params.put("client_reference_id", order.getOutTradeNo());
if (null == order.getCurType()) {
order.setCurType(CurType.USD);
}
params.put("currency", order.getCurType());
params.put("description", order.getSubject());
return params;
}
代码示例来源:origin: egzosn/pay-java-parent
/**
* 获取支付平台所需的订单信息
*
* @param order 支付订单
* @return 订单信息
* @see PayOrder 支付订单信息
*/
@Override
public JSONObject orderInfo(PayOrder order) {
TreeMap<String, String> data = new TreeMap<>();
data.put("access_token", getAccessToken());
data.put("paymoney", Util.conversionAmount(order.getPrice()).toString());
String apbNonce = SignUtils.randomStr();
String sign = createSign(SignUtils.parameterText(data, "") + apbNonce, payConfigStorage.getInputCharset());
data.put("PayMoney", data.remove("paymoney"));
String params = SignUtils.parameterText(data) + "&apb_nonce=" + apbNonce + "&sign=" + sign;
try {
JSONObject json = execute(getUrl(order.getTransactionType())+ "?" + params, MethodType.GET, null);
//友店比较特殊,需要在下完预订单后,自己存储 order_sn 对应 微信官方文档 out_trade_no
order.setOutTradeNo(json.getString("order_sn"));
return json;
} catch (PayErrorException e) {
throw e;
}
}
代码示例来源:origin: egzosn/pay-java-parent
bizContent.put("subject", order.getSubject());
bizContent.put("out_trade_no", order.getOutTradeNo());
bizContent.put("total_amount", Util.conversionAmount(order.getPrice()).toString());
switch ((AliTransactionType) order.getTransactionType()) {
case PAGE:
代码示例来源:origin: egzosn/pay-java-parent
orderInfo.put("total_fee", Util.conversionAmount(order.getPrice()).toString() );
代码示例来源:origin: egzosn/pay-java-parent
/**
* 转账
*
* @param order 转账订单
* @return 对应的转账结果
*/
@Override
public Map<String, Object> transfer(TransferOrder order) {
//获取公共参数
Map<String, Object> parameters = getPublicParameters(AliTransactionType.TRANS);
Map<String, Object> bizContent = new TreeMap<String, Object>();
bizContent.put("out_biz_no", order.getOutNo());
//默认 支付宝登录号,支持邮箱和手机号格式。
bizContent.put("payee_type", "ALIPAY_LOGONID");
if (null != order.getTransferType()) {
bizContent.put("payee_type", order.getTransferType().getType());
}
bizContent.put("payee_account", order.getPayeeAccount());
bizContent.put("amount", Util.conversionAmount(order.getAmount()));
bizContent.put("payer_show_name", order.getPayerName());
bizContent.put("payee_real_name", order.getPayeeName());
bizContent.put("remark", order.getRemark());
//设置请求参数的集合
parameters.put(BIZ_CONTENT, JSON.toJSONString(bizContent));
//设置签名
setSign(parameters);
return getHttpRequestTemplate().postForObject(getReqUrl() + "?" + UriVariables.getMapToParameters(parameters), null, JSONObject.class);
}
代码示例来源:origin: egzosn/pay-java-parent
/**
* 申请退款接口
*
* @param refundOrder 退款订单信息
* @return 返回支付方申请退款后的结果
*/
@Override
public Map<String, Object> refund(RefundOrder refundOrder) {
//获取公共参数
Map<String, Object> parameters = getPublicParameters(AliTransactionType.REFUND);
Map<String, Object> bizContent = getBizContent(refundOrder.getTradeNo(), refundOrder.getOutTradeNo(), null);
if (!StringUtils.isEmpty(refundOrder.getRefundNo())) {
bizContent.put("out_request_no", refundOrder.getRefundNo());
}
bizContent.put("refund_amount", Util.conversionAmount(refundOrder.getRefundAmount()));
//设置请求参数的集合
parameters.put(BIZ_CONTENT, JSON.toJSONString(bizContent));
//设置签名
setSign(parameters);
return requestTemplate.getForObject(getReqUrl() + "?" + UriVariables.getMapToParameters(parameters), JSONObject.class);
}
代码示例来源:origin: egzosn/pay-java-parent
/**
* 申请退款接口
*
* @param refundOrder 退款订单信息
* @return 返回支付方申请退款后的结果
*/
@Override
public Map<String, Object> refund(RefundOrder refundOrder) {
JSONObject request = new JSONObject();
if (null != refundOrder.getRefundAmount() && BigDecimal.ZERO.compareTo( refundOrder.getRefundAmount()) > 0){
Amount amount = new Amount();
amount.setCurrency(refundOrder.getCurType().name());
amount.setTotal(Util.conversionAmount(refundOrder.getRefundAmount()).toString());
request.put("amount", amount);
request.put("description", refundOrder.getDescription());
}
HttpStringEntity httpEntity = new HttpStringEntity(request, ContentType.APPLICATION_JSON);
httpEntity.setHeaders(authHeader());
JSONObject resp = getHttpRequestTemplate().postForObject(getReqUrl(PayPalTransactionType.REFUND), httpEntity, JSONObject.class, refundOrder.getTradeNo());
return resp;
}
/**
代码示例来源:origin: egzosn/pay-java-parent
private String getOrderInfo(PayOrder order) {
String orderInfo = "partner=\"" + this.payConfigStorage.getPid() + "\"";
orderInfo = orderInfo + "&seller_id=\"" + this.payConfigStorage.getSeller() + "\"";
orderInfo = orderInfo + "&out_trade_no=\"" + order.getOutTradeNo() + "\"";
orderInfo = orderInfo + "&subject=\"" + order.getSubject() + "\"";
orderInfo = orderInfo + "&body=\"" + order.getBody() + "\"";
orderInfo = orderInfo + "&total_fee=\"" + Util.conversionAmount(order.getPrice()).toString() + "\"";
orderInfo = orderInfo + "¬ify_url=\"" + this.payConfigStorage.getNotifyUrl() + "\"";
orderInfo = orderInfo + "&service=\"mobile.securitypay.pay\"";
orderInfo = orderInfo + "&payment_type=\"1\"";
orderInfo = orderInfo + "&_input_charset=\""+ payConfigStorage.getInputCharset()+"\"";
orderInfo = orderInfo + "&it_b_pay=\"30m\"";
orderInfo = orderInfo + "&return_url=\""+payConfigStorage.getReturnUrl()+"\"";
return orderInfo;
}
代码示例来源:origin: egzosn/pay-java-parent
amount.setTotal(Util.conversionAmount(order.getPrice()).toString());
内容来源于网络,如有侵权,请联系作者删除!