imroved webbased datasaved
This commit is contained in:
@@ -1,8 +1,13 @@
|
||||
package com.billpaymentservice.bbps.dto.request;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
|
||||
public class CallbackRequest {
|
||||
@NotBlank(message = "mid is mandatory")
|
||||
private String mid;
|
||||
@NotBlank(message = "data is mandatory")
|
||||
private String data;
|
||||
@NotBlank(message = "signature is mandatory")
|
||||
private String signature;
|
||||
|
||||
public String getMid() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.billpaymentservice.bbps.dto.request;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
@@ -13,14 +14,21 @@ import lombok.Setter;
|
||||
@AllArgsConstructor
|
||||
// DTO representing the user request payload described by the user
|
||||
public class PaymentStartUserRequest extends BaseClass implements Serializable {
|
||||
@NotBlank(message = "amount can not be null")
|
||||
private String amount;
|
||||
private String currency;
|
||||
private String emailId;
|
||||
@NotBlank(message = "currency can not be null")
|
||||
String currency;
|
||||
@NotBlank(message = "customerVpa can not be null")
|
||||
private String customerVpa;
|
||||
private String mobileNo;
|
||||
private String respUrl;
|
||||
@NotBlank(message = "txnReqType can not be null")
|
||||
private String txnReqType;
|
||||
@NotBlank(message = "udf1(Latitude) can not be null")
|
||||
private String udf1;
|
||||
@NotBlank(message = "udf2(Longitude) can not be null")
|
||||
private String udf2;
|
||||
private String emailId;
|
||||
private String mobileNo;
|
||||
private String name;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -26,11 +26,9 @@ public class AdditionalInfo {
|
||||
private Long id; // primary key for the table
|
||||
|
||||
@Column(name = "param_config_id", nullable = false)
|
||||
@NotBlank(message = "Param Config ID cannot be blank")
|
||||
private String paramConfigId;
|
||||
|
||||
@Column(name = "param_name", nullable = false)
|
||||
@NotBlank(message = "Param name cannot be blank")
|
||||
private String paramName;
|
||||
|
||||
@Column(name = "data_type_dao")
|
||||
|
||||
@@ -21,11 +21,9 @@ public class BillerAdditionalInfoPayment {
|
||||
private Long id; // primary key for the table
|
||||
|
||||
@Column(name = "param_config_id", nullable = false)
|
||||
@NotBlank(message = "Param Config ID cannot be blank")
|
||||
private String paramConfigId;
|
||||
|
||||
@Column(name = "param_name", nullable = false)
|
||||
@NotBlank(message = "Param name cannot be blank")
|
||||
private String paramName;
|
||||
|
||||
@Column(name = "data_type_dao")
|
||||
|
||||
@@ -45,18 +45,15 @@ public class BillerDetails{
|
||||
private String billerId;
|
||||
|
||||
@Column(name = "biller_name")
|
||||
@NotBlank(message = "Biller name cannot be blank")
|
||||
private String billerName;
|
||||
|
||||
@Column(name = "biller_alias_name")
|
||||
private String billerAliasName;
|
||||
|
||||
@Column(name = "biller_category_name", nullable = false)
|
||||
@NotBlank(message = "Biller category name cannot be blank")
|
||||
@Column(name = "biller_category_name")
|
||||
private String billerCategoryName;
|
||||
|
||||
@Column(name = "biller_mode")
|
||||
@NotBlank(message = "Biller mode cannot be blank")
|
||||
private String billerMode;
|
||||
|
||||
@Column(name = "biller_accepts_adhoc")
|
||||
@@ -69,14 +66,12 @@ public class BillerDetails{
|
||||
private String parentBillerId;
|
||||
|
||||
@Column(name = "biller_ownership")
|
||||
@NotBlank(message = "Biller ownership is required (PSU or Private)")
|
||||
private String billerOwnerShp;
|
||||
|
||||
@Column(name = "biller_coverage")
|
||||
private String billerCoverage;
|
||||
|
||||
@Column(name = "fetch_requirement")
|
||||
@NotBlank(message = "Fetch requirement is mandatory")
|
||||
private String fetchRequirement;
|
||||
|
||||
@Column(name = "payment_amount_exactness")
|
||||
|
||||
@@ -24,7 +24,6 @@ public class BillerPlanResponseParams {
|
||||
private Long id; // Primary Key
|
||||
|
||||
@Column(name = "biller_plan_response_id", nullable = false, unique = true)
|
||||
@NotBlank(message = "Biller Plan Response ID cannot be blank")
|
||||
private String billerPlanResponseId;
|
||||
// ✅ params list — since it's not a separate table, we can store as JSON or text
|
||||
@Column(name = "params", columnDefinition = "TEXT")
|
||||
|
||||
@@ -29,11 +29,9 @@ public class InterchangeFee {
|
||||
private Long id; // Primary key
|
||||
|
||||
@Column(name = "interchange_fee_id", nullable = false, unique = true)
|
||||
@NotBlank(message = "Interchange Fee ID cannot be blank")
|
||||
private String interchangeFeeId;
|
||||
|
||||
@Column(name = "fee_code", nullable = false)
|
||||
@NotBlank(message = "Fee code is mandatory")
|
||||
private String feeCode;
|
||||
|
||||
@Column(name = "fee_description")
|
||||
|
||||
@@ -27,7 +27,6 @@ public class InterchangeFeeConf {
|
||||
private Long id; // Primary Key for DB table
|
||||
|
||||
@Column(name = "interchange_fee_conf_id", nullable = false, unique = true)
|
||||
@NotBlank(message = "Interchange Fee Config ID cannot be blank")
|
||||
private String interChangeFeeConfId;
|
||||
|
||||
@Column(name = "mti")
|
||||
|
||||
@@ -24,7 +24,6 @@ public class PaymentChannel {
|
||||
@Column(name = "payment_channel_limit_id")
|
||||
private String paymentChannelLimitId; // Primary key (manual, not auto-generated)
|
||||
|
||||
@NotBlank(message = "Payment channel is required")
|
||||
@Column(name = "payment_channel", nullable = false)
|
||||
private String paymentChannel;
|
||||
|
||||
|
||||
@@ -26,11 +26,9 @@ public class PaymentMode {
|
||||
|
||||
@Id //
|
||||
@Column(name = "payment_model_limit_id", unique = true, length = 50)
|
||||
@NotBlank(message = "Payment model limit ID cannot be blank")
|
||||
private String paymentModelLimitId;
|
||||
|
||||
@Column(name = "payment_mode", nullable = false, length = 50)
|
||||
@NotBlank(message = "Payment mode is mandatory")
|
||||
private String paymentMode;
|
||||
|
||||
@Column(name = "max_limit")
|
||||
@@ -42,7 +40,6 @@ public class PaymentMode {
|
||||
private long minLimit;
|
||||
|
||||
@Column(name = "support_pending_status", length = 10)
|
||||
@Pattern(regexp = "^(Yes|No)?$", message = "Support pending status must be either 'Yes' or 'No'")
|
||||
private String supportPendingStatus;
|
||||
|
||||
// 🔗 Many-to-One relationship with BillerDAO
|
||||
|
||||
@@ -286,11 +286,36 @@ public class PaymentStartServiceImpl implements PaymentStartService {
|
||||
// Save record with HTML (persist original request and HTML response)
|
||||
String responseTypeWeb = BBPSConstant.RESPONSE_TYPE_HTML;
|
||||
String rawResponseWeb = respBody == null ? "" : respBody;
|
||||
// bbpsMapperHelper.savePaymentStartRecord(request, null, txnId, orderNo, requestJson, rawResponseWeb, responseTypeWeb);
|
||||
LOGGER.info("[startWebPayment] saved payment start record txnId={} orderNo={} responseType={}", txnId, orderNo, responseTypeWeb);
|
||||
|
||||
// Try to extract useful fields from returned HTML (txnId, amount, mid)
|
||||
Map<String, String> parsed = parseHtmlResponse(rawResponseWeb);
|
||||
|
||||
// Build a minimal PaymentStartApiResponse so savePaymentStartRecord() can safely read fields
|
||||
com.billpaymentservice.bbps.dto.response.PaymentStartApiResponse apiResp = new com.billpaymentservice.bbps.dto.response.PaymentStartApiResponse();
|
||||
com.billpaymentservice.bbps.dto.response.PaymentStartApiResponse.ResponseData rd = new com.billpaymentservice.bbps.dto.response.PaymentStartApiResponse.ResponseData();
|
||||
|
||||
String parsedTxn = parsed.getOrDefault("txnId", "");
|
||||
String parsedAmount = parsed.getOrDefault("amount", "0.00");
|
||||
String parsedMid = parsed.getOrDefault("mid", paymentMid == null ? "DUMMY_MID" : paymentMid);
|
||||
|
||||
// prefer HTML-provided txnId if present, otherwise reuse generated txnId
|
||||
rd.setTxnId(parsedTxn != null && !parsedTxn.isEmpty() ? parsedTxn : txnId);
|
||||
rd.setAmount(parsedAmount != null && !parsedAmount.isEmpty() ? parsedAmount : "0.00");
|
||||
rd.setMid(parsedMid);
|
||||
rd.setOrderNo(orderNo);
|
||||
rd.setQrString("NO_QR");
|
||||
rd.setCreatedOn(LocalDateTime.now().toString());
|
||||
|
||||
apiResp.setResponseData(rd);
|
||||
apiResp.setMessage("HTML_RESPONSE");
|
||||
apiResp.setStatusCode(String.valueOf(BBPSConstant.HTTP_OK_INT));
|
||||
|
||||
bbpsMapperHelper.savePaymentStartRecord(request, apiResp, txnId, orderNo, requestJson, rawResponseWeb, responseTypeWeb);
|
||||
LOGGER.info("[startWebPayment] saved payment start record txnId={} orderNo={} responseType={}", txnId, orderNo, responseTypeWeb);
|
||||
|
||||
// Return HTML directly in API response
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put("OrderId", orderNo);
|
||||
result.put("html", respBody);
|
||||
|
||||
LOGGER.info("[startWebPayment] complete txnId={} orderNo={} returning HTML", txnId, orderNo);
|
||||
@@ -437,4 +462,4 @@ public class PaymentStartServiceImpl implements PaymentStartService {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.billpaymentservice.bbps.util;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
@@ -1109,14 +1110,15 @@ public class BillerMapperHelper {
|
||||
record.setClientMid(request.getMid());
|
||||
record.setClientUserId(request.getClientUserId());
|
||||
record.setInternalTxnId(txnId);
|
||||
if (apiResponse != null && apiResponse.getResponseData() != null) {
|
||||
record.setAmount(apiResponse.getResponseData().getAmount());
|
||||
record.setMid(apiResponse.getResponseData().getMid());
|
||||
record.setTxnId(apiResponse.getResponseData().getTxnId());
|
||||
record.setQrString(apiResponse.getResponseData().getQrString());
|
||||
record.setCreatedOn(apiResponse.getResponseData().getCreatedOn());
|
||||
record.setTxnStatus("PENDING");
|
||||
}
|
||||
|
||||
|
||||
record.setAmount(Optional.ofNullable(apiResponse.getResponseData().getAmount()).orElse("0.00"));
|
||||
record.setMid(Optional.ofNullable(apiResponse.getResponseData().getMid()).orElse("DUMMY_MID"));
|
||||
record.setTxnId(Optional.ofNullable(apiResponse.getResponseData().getTxnId()).orElse("DUMMY_TXN"));
|
||||
record.setQrString(Optional.ofNullable(apiResponse.getResponseData().getQrString()).orElse("NO_QR"));
|
||||
record.setCreatedOn(Optional.ofNullable(apiResponse.getResponseData().getCreatedOn()).orElse(LocalDateTime.now().toString()));
|
||||
record.setTxnStatus("PENDING");
|
||||
|
||||
|
||||
// store the original request body and raw response
|
||||
record.setRequestBody(requestJson);
|
||||
|
||||
@@ -20,9 +20,9 @@ swagger.server.description=Local Development Server
|
||||
# DataSource
|
||||
spring.datasource.url=jdbc:postgresql://localhost:5432/BBPS
|
||||
spring.datasource.username=postgres
|
||||
spring.datasource.password=UAT@DB_2025
|
||||
#spring.datasource.password=UAT@DB_2025
|
||||
|
||||
#spring.datasource.password=himanshu@123
|
||||
spring.datasource.password=himanshu@123
|
||||
spring.datasource.driver-class-name=org.postgresql.Driver
|
||||
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
|
||||
|
||||
|
||||
Reference in New Issue
Block a user