@Test public void test() throws Exception { Assert.assertNotNull(service); Assert.assertNotNull(data); PaymentForm view = service.generatePaymentData(data); Assert.assertNotNull(view); Assert.assertNotNull(view.getTransactionId()); logger.info("view url " + view.getForwardURL() + " view forward Type " + view.getForwardType()); for (String key : view.getParams().keySet()) logger.info("key = " + key + " value = " + view.getParams().get(key)); logger.info("transactionId = " + view.getTransactionId()); }
@Override public PaymentForm generatePaymentData(BillingData bill) { Assert.isNotNull(bill, "billing data cannot be null"); logger.info("start generate alipay forward view data"); logger.debug("[billing : \n {} ]", bill); initConfig(bill); bill.setOrderNo(ParamUtils.getOrderNo( (String) bill.getConfigData().get("partner"))); Long transId = transactionService .createTransactionFromBillingData(bill); PaymentForm paymentForm = new PaymentForm(); paymentForm.setTransactionId(transId); paymentForm.setForwardType(FrontPageForwardType.POST); paymentForm.setForwardURL(PaymentConstant.GENERAL_POST_FORM_FORWARD_URL); String gateway = (String) bill.getConfigData().get("gateway"); Assert.isNotNull(gateway); String gatewayUrl = gateway + "?_input_charset=" + AlipayConstant.INPUT_CHARSET; paymentForm.setGatewayURL(gatewayUrl); paymentForm.setParams(this.generatePaymentForm(transId, bill)); logger.info("finish generate payment form "); logger.debug("[generated payment form : \n {}]", paymentForm); return paymentForm; }
AlipayPaymentService implements PaymentService { @Override public PaymentForm generatePaymentData(BillingData bill) { Assert.isNotNull(bill, "billing data cannot be null"); logger.info("start generate alipay forward view data"); logger.debug("[billing : \n {} ]", bill); initConfig(bill); bill.setOrderNo(ParamUtils.getOrderNo( (String) bill.getConfigData().get("partner"))); Long transId = transactionService .createTransactionFromBillingData(bill); PaymentForm paymentForm = new PaymentForm(); paymentForm.setTransactionId(transId); paymentForm.setForwardType(FrontPageForwardType.POST); paymentForm.setForwardURL(PaymentConstant.GENERAL_POST_FORM_FORWARD_URL); String gateway = (String) bill.getConfigData().get("gateway"); Assert.isNotNull(gateway); String gatewayUrl = gateway + "?_input_charset=" + AlipayConstant.INPUT_CHARSET; paymentForm.setGatewayURL(gatewayUrl); paymentForm.setParams(this.generatePaymentForm(transId, bill)); logger.info("finish generate payment form "); logger.debug("[generated payment form : \n {}]", paymentForm); return paymentForm; } }
AlipayPaymentService implements PaymentService { @Override public PaymentForm generatePaymentData(BillingData bill) { Assert.isNotNull(bill, "billing data cannot be null"); logger.info("start generate alipay forward view data"); logger.debug("[billing : \n {} ]", bill); initConfig(bill); bill.setOrderNo(ParamUtils.getOrderNo( (String) bill.getConfigData().get("partner"))); Long transId = transactionService .createTransactionFromBillingData(bill); PaymentForm paymentForm = new PaymentForm(); paymentForm.setTransactionId(transId); paymentForm.setForwardType(FrontPageForwardType.POST); paymentForm.setForwardURL(PaymentConstant.GENERAL_POST_FORM_FORWARD_URL); String gateway = (String) bill.getConfigData().get("gateway"); Assert.isNotNull(gateway); String gatewayUrl = gateway + "?_input_charset=" + AlipayConstant.INPUT_CHARSET; paymentForm.setGatewayURL(gatewayUrl); paymentForm.setParams(this.generatePaymentForm(transId, bill)); logger.info("finish generate payment form "); logger.debug("[generated payment form : \n {}]", paymentForm); return paymentForm; }  }
AlipayPaymentService implements PaymentService { @Override public PaymentForm generatePaymentData(BillingData bill) { Assert.isNotNull(bill, "billing data cannot be null"); logger.info("start generate alipay forward view data"); logger.debug("[billing : \n {} ]", bill); initConfig(bill); bill.setOrderNo(ParamUtils.getOrderNo( (String) bill.getConfigData().get("partner"))); Long transId = transactionService .createTransactionFromBillingData(bill); PaymentForm paymentForm = new PaymentForm(); paymentForm.setTransactionId(transId); paymentForm.setForwardType(FrontPageForwardType.POST); paymentForm.setForwardURL(PaymentConstant.GENERAL_POST_FORM_FORWARD_URL); String gateway = (String) bill.getConfigData().get("gateway"); Assert.isNotNull(gateway); String gatewayUrl = gateway + "?_input_charset=" + AlipayConstant.INPUT_CHARSET; paymentForm.setGatewayURL(gatewayUrl); paymentForm.setParams(this.generatePaymentForm(transId, bill)); logger.info("finish generate payment form "); logger.debug("[generated payment form : \n {}]", paymentForm); return paymentForm; }  @Override PaymentForm generatePaymentData(BillingData bill); }
AlipayPaymentService implements PaymentService { @Override public PaymentForm generatePaymentData(BillingData bill) { Assert.isNotNull(bill, "billing data cannot be null"); logger.info("start generate alipay forward view data"); logger.debug("[billing : \n {} ]", bill); initConfig(bill); bill.setOrderNo(ParamUtils.getOrderNo( (String) bill.getConfigData().get("partner"))); Long transId = transactionService .createTransactionFromBillingData(bill); PaymentForm paymentForm = new PaymentForm(); paymentForm.setTransactionId(transId); paymentForm.setForwardType(FrontPageForwardType.POST); paymentForm.setForwardURL(PaymentConstant.GENERAL_POST_FORM_FORWARD_URL); String gateway = (String) bill.getConfigData().get("gateway"); Assert.isNotNull(gateway); String gatewayUrl = gateway + "?_input_charset=" + AlipayConstant.INPUT_CHARSET; paymentForm.setGatewayURL(gatewayUrl); paymentForm.setParams(this.generatePaymentForm(transId, bill)); logger.info("finish generate payment form "); logger.debug("[generated payment form : \n {}]", paymentForm); return paymentForm; }  @Override PaymentForm generatePaymentData(BillingData bill);  }