提交 524f2f41 authored 作者: Whispa's avatar Whispa

commit commit

上级 eaa0f9f1
...@@ -78,13 +78,14 @@ public class CardCharge { ...@@ -78,13 +78,14 @@ public class CardCharge {
json.put("orderRef", this.getTxRef()); json.put("orderRef", this.getTxRef());
json.put("amount", this.getAmount()); json.put("amount", this.getAmount());
json.put("currency", this.getCurrency()); json.put("currency", this.getCurrency());
json.put("network", "RWF"); json.put("network", "MTN");
json.put("country", "NG"); json.put("country", "NG");
json.put("payment_type", "mobilemoneygh"); json.put("payment_type", "mobilemoneyzambia");
json.put("is_mobile_money_gh", "1"); json.put("is_mobile_money_gh", "1");
json.put("email", this.getEmail()); json.put("email", this.getEmail());
json.put("phonenumber", this.getPhonenumber()); json.put("phonenumber", this.getPhonenumber());
json.put("fullname", this.getFullname()); json.put("firstname", this.getFirstname());
json.put("lastname", this.getLastname());
} catch (JSONException ex) { } catch (JSONException ex) {
ex.getMessage(); ex.getMessage();
} }
......
...@@ -147,7 +147,7 @@ public class FlutterWaveController extends Controller { ...@@ -147,7 +147,7 @@ public class FlutterWaveController extends Controller {
CardCharge ch = new CardCharge(); CardCharge ch = new CardCharge();
ch.setCardno(flutterWaveCard.getCard()) ch.setCardno(flutterWaveCard.getCard())
.setCvv(flutterWaveCard.getCvv()) .setCvv(flutterWaveCard.getCvv())
.setCurrency("RWF") .setCurrency("ZMW")
.setCountry("NG") .setCountry("NG")
.setAmount(orderEntity.getRealityPay().toString()) .setAmount(orderEntity.getRealityPay().toString())
.setRedirect_url(REDIRECT_URL+"/"+orderId) .setRedirect_url(REDIRECT_URL+"/"+orderId)
......
...@@ -9,6 +9,7 @@ import com.example.afrishop_v3.repository.*; ...@@ -9,6 +9,7 @@ import com.example.afrishop_v3.repository.*;
import com.example.afrishop_v3.security.services.AuthenticationUser; import com.example.afrishop_v3.security.services.AuthenticationUser;
import com.example.afrishop_v3.util.IdUtil; import com.example.afrishop_v3.util.IdUtil;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
...@@ -34,15 +35,17 @@ public class OrderController extends Controller { ...@@ -34,15 +35,17 @@ public class OrderController extends Controller {
private final TbCfStationItemRepository itemRepository; private final TbCfStationItemRepository itemRepository;
private final TbCfItemCommentRepository commentRepository; private final TbCfItemCommentRepository commentRepository;
private final TbCfExpressTemplateRepository templateRepository; private final TbCfExpressTemplateRepository templateRepository;
private final TbCfExchangeRepository exchangeRepository;
private final AuthenticationUser user; private final AuthenticationUser user;
public OrderController(TbCfOrderRepository repository, TbCfCartRecordRRepository cartRepository, TbCfToicouponRepository toicouponRepository, TbCfStationItemRepository itemRepository, TbCfItemCommentRepository commentRepository, TbCfExpressTemplateRepository templateRepository, AuthenticationUser user) { public OrderController(TbCfOrderRepository repository, TbCfCartRecordRRepository cartRepository, TbCfToicouponRepository toicouponRepository, TbCfStationItemRepository itemRepository, TbCfItemCommentRepository commentRepository, TbCfExpressTemplateRepository templateRepository, @Qualifier("tbCfExchangeRepository") TbCfExchangeRepository exchangeRepository, AuthenticationUser user) {
this.repository = repository; this.repository = repository;
this.cartRepository = cartRepository; this.cartRepository = cartRepository;
this.toicouponRepository = toicouponRepository; this.toicouponRepository = toicouponRepository;
this.itemRepository = itemRepository; this.itemRepository = itemRepository;
this.commentRepository = commentRepository; this.commentRepository = commentRepository;
this.templateRepository = templateRepository; this.templateRepository = templateRepository;
this.exchangeRepository = exchangeRepository;
this.user = user; this.user = user;
} }
...@@ -63,6 +66,18 @@ public class OrderController extends Controller { ...@@ -63,6 +66,18 @@ public class OrderController extends Controller {
} }
@GetMapping("currencyConversion")
public Result convert(@RequestParam("price") BigDecimal price,@RequestParam("currency") String currency){
TbCfExchange exchangeEntity = exchangeRepository.findByExchangeCurrency(currency.toUpperCase());
if( exchangeEntity == null){
return new Result(ResultCodeEnum.ILLEGAL_ARGUMENT.getCode(),"Currency Not Found");
}
BigDecimal rate = exchangeEntity.getExchangeRate();
BigDecimal resultPrice = price.multiply(rate);
return new Result<>(resultPrice);
}
@GetMapping("/payNow") @GetMapping("/payNow")
public Result<TbCfOrder> payNow(@RequestParam("itemId") String itemId, public Result<TbCfOrder> payNow(@RequestParam("itemId") String itemId,
@RequestParam("itemNum") Integer itemNum, @RequestParam("itemNum") Integer itemNum,
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论