use of com.whoiszxl.entity.response.RechargeResponse in project shopzz by whoiszxl.
the class DcPayInfoBuilder method buildAddress.
/**
* 构建地址信息
* @return
*/
public DcPayInfoBuilder buildAddress(Order order) {
CreateAddressFeignClient createAddressFeignClient = createDcAddressFactory.get(dcName);
ResponseResult<RechargeResponse> rechargeResponseResult = createAddressFeignClient.giveAddress(order.getId().toString(), order.getTotalAmount().toPlainString());
if (!rechargeResponseResult.isOk()) {
ExceptionCatcher.catchValidateEx(ResponseResult.buildError("支付创建失败"));
}
RechargeResponse rechargeResponse = rechargeResponseResult.getData();
this.dcPayInfo.setCurrencyName(dcName);
this.dcPayInfo.setCurrencyId(rechargeResponse.getCurrencyId());
this.dcPayInfo.setToAddress(rechargeResponse.getAddress());
this.dcPayInfo.setQrcodeData(rechargeResponse.getQrCodeData());
return this;
}
use of com.whoiszxl.entity.response.RechargeResponse in project shopzz by whoiszxl.
the class ShopzzFeignClientImpl method giveAddress.
@Override
@Transactional
public ResponseResult<RechargeResponse> giveAddress(String orderId, String amount) {
// 1. 获取货币信息
Currency ethInfo = currencyService.getCurrencyByName(currencyName);
AssertUtils.isNotNull(ethInfo, "数据库未配置货币信息:" + currencyName);
// 2. 通过keystore的方式生成一个以太坊地址
EthereumAddress ethereumAddress = ethereumService.createAddressByFile();
String qrCodeData = getQrCodeData(amount, ethereumAddress.getAddress());
// 3. 保存keystore文件与地址的对应关系
CurrencyAccount account = new CurrencyAccount();
account.setAddress(ethereumAddress.getAddress());
account.setCurrencyId(ethInfo.getId());
account.setCurrencyName(ethInfo.getCurrencyName());
account.setKeystoreName(ethereumAddress.getKeystoreName());
account.setMnemonic(ethereumAddress.getMnemonic());
currencyAccountService.save(account);
return ResponseResult.buildSuccess(new RechargeResponse(ethInfo.getId(), ethereumAddress.getAddress(), qrCodeData));
}
use of com.whoiszxl.entity.response.RechargeResponse in project shopzz by whoiszxl.
the class EthFeignClientImpl method giveAddress.
@Override
@Transactional
@PostMapping("/createRecharge/{orderId}/{amount}")
public ResponseResult<RechargeResponse> giveAddress(String orderId, String amount) {
// 1. 获取货币信息
Currency ethInfo = currencyService.getCurrencyByName(currencyName);
AssertUtils.isNotNull(ethInfo, "数据库未配置货币信息:" + currencyName);
// 2. 通过keystore的方式生成一个以太坊地址
EthereumAddress ethereumAddress = ethereumService.createAddressByFile();
String qrCodeData = getQrCodeData(amount, ethereumAddress.getAddress());
// 3. 保存keystore文件与地址的对应关系
CurrencyAccount account = new CurrencyAccount();
account.setAddress(ethereumAddress.getAddress());
account.setCurrencyId(ethInfo.getId());
account.setCurrencyName(ethInfo.getCurrencyName());
account.setKeystoreName(ethereumAddress.getKeystoreName());
account.setMnemonic(ethereumAddress.getMnemonic());
currencyAccountService.save(account);
return ResponseResult.buildSuccess(new RechargeResponse(ethInfo.getId(), ethereumAddress.getAddress(), qrCodeData));
}
use of com.whoiszxl.entity.response.RechargeResponse in project shopzz by whoiszxl.
the class BtcFeignClientImpl method giveAddress.
@Override
@Transactional
@PostMapping("/createRecharge/{orderId}/{amount}")
public ResponseResult<RechargeResponse> giveAddress(String orderId, String amount) {
// 1. 获取货币信息
Currency btcInfo = currencyService.getCurrencyByName(currencyName);
AssertUtils.isNotNull(btcInfo, "数据库未配置货币信息:" + currencyName);
// 2. 生成bitcoin地址
String newAddress = bitcoinClient.getNewAddress(orderId);
return ResponseResult.buildSuccess(new RechargeResponse(btcInfo.getId(), newAddress, amount));
}
use of com.whoiszxl.entity.response.RechargeResponse in project shopzz by whoiszxl.
the class ZXLFeignClientImpl method giveAddress.
@Override
@Transactional
public ResponseResult<RechargeResponse> giveAddress(String orderId, String amount) {
// 1. 获取货币信息
Currency ethInfo = currencyService.getCurrencyByName(currencyName);
AssertUtils.isNotNull(ethInfo, "数据库未配置货币信息:" + currencyName);
// 2. 通过keystore的方式生成一个以太坊地址
EthereumAddress ethereumAddress = ethereumService.createAddressByFile();
String qrCodeData = getQrCodeData(amount, ethereumAddress.getAddress());
// 3. 保存keystore文件与地址的对应关系
CurrencyAccount account = new CurrencyAccount();
account.setAddress(ethereumAddress.getAddress());
account.setCurrencyId(ethInfo.getId());
account.setCurrencyName(ethInfo.getCurrencyName());
account.setKeystoreName(ethereumAddress.getKeystoreName());
account.setMnemonic(ethereumAddress.getMnemonic());
currencyAccountService.save(account);
return ResponseResult.buildSuccess(new RechargeResponse(ethInfo.getId(), ethereumAddress.getAddress(), qrCodeData));
}
Aggregations