Skip to content

Commit

Permalink
deploy app
Browse files Browse the repository at this point in the history
  • Loading branch information
harmlessprince committed Feb 5, 2025
1 parent 2aa2ccd commit 353d706
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public class Address extends BaseEntity {

private String userId;

@Builder.Default
private Boolean isDefault = false;

private String state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class Cart extends BaseEntity {

private String color;

@Builder.Default
Integer quantity = 0;

@DBRef
Expand Down
20 changes: 11 additions & 9 deletions src/main/java/com/harmlessprince/ecommerceApi/file/File.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,33 @@ public class File extends BaseEntity {

@Id
private String id;
// @Column(nullable = false)
// @Column(nullable = false)
private String name;

// @Column()
// @Column()
private String ownerType;

// @Column()
// @Column()
private String ownerId;

// @Column(nullable = false)
// @Column(nullable = false)
private String type;

// @Column(nullable = false)
// @Column(nullable = false)
private String mimeType;

// @Column(nullable = false)
// @Column(nullable = false)
private String url;

// @Column(nullable = true)
// @Column(nullable = true)
private String customId;

// @Column(nullable = false)
// @Column(nullable = false)
@Builder.Default
private String provider = "cloudinary";

// @Column(columnDefinition = "BOOLEAN DEFAULT TRUE", nullable = false)
// @Column(columnDefinition = "BOOLEAN DEFAULT TRUE", nullable = false)
@Builder.Default
private Boolean status = true;

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public class LocalGovernment extends BaseEntity {
private String id;
private String name;

@Builder.Default
private Boolean status = true;

@DBRef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class Order extends BaseEntity {
private Object meta;
private String status;

//payment
@Builder.Default
private String paymentStatus = AppConstants.PENDING_PAYMENT_STATUS;

private String paymentGateway; // PAYSTACK, FLUTTERWAVE, STRIPE
Expand All @@ -47,6 +47,7 @@ public class Order extends BaseEntity {

private String currency;

@Builder.Default
private String fulfillmentStatus = AppConstants.UNFULFILLED_ORDER_STATUS;

@JsonManagedReference
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
import com.harmlessprince.ecommerceApi.contexts.TenantContext;
import com.harmlessprince.ecommerceApi.custom.AppConstants;
import com.harmlessprince.ecommerceApi.exceptions.CustomBadRequestException;
import com.harmlessprince.ecommerceApi.handler.CustomErrorResponse;
import com.harmlessprince.ecommerceApi.handler.CustomResponse;
import com.harmlessprince.ecommerceApi.handler.CustomSuccessResponse;
import com.harmlessprince.ecommerceApi.order.Order;
import com.harmlessprince.ecommerceApi.order.OrderRepository;
import com.harmlessprince.ecommerceApi.paymentGateway.PaymentVerificationDto;
Expand Down Expand Up @@ -38,7 +36,6 @@ public Object verifyPayment(@RequestBody @Valid ConfirmPaymentRequest request) {
throw new CustomBadRequestException("Invalid reference");
}
Payment retrievedPayment = payment.get();

PaymentVerificationDto paymentVerificationDto = paymentService.verifyPayment(payment.get());
retrievedPayment.setGateway(paymentVerificationDto.getPaymentGateway());
retrievedPayment.setGatewayResponse(paymentVerificationDto.getMessage());
Expand All @@ -47,7 +44,7 @@ public Object verifyPayment(@RequestBody @Valid ConfirmPaymentRequest request) {
log.info("Expected Amount Paid <-> Actual Amount Paid: " + retrievedPayment.getAmount() + "<>" + paymentVerificationDto.getAmountPaid());
if (!Objects.equals(paymentVerificationDto.getStatus().toUpperCase(), AppConstants.SUCCESS_PAYMENT_STATUS) ||
paymentVerificationDto.getAmountPaid() < retrievedPayment.getAmount() || !retrievedPayment.getCurrency().equals(paymentVerificationDto.getCurrency())) {
retrievedPayment.setStatus(AppConstants.FAILED_PAYMENT_STATUS);
retrievedPayment.setStatus(paymentVerificationDto.getStatus().toUpperCase());
paymentRepository.save(retrievedPayment);
return ResponseEntity.badRequest().body(CustomResponse.sendErrorResponse(paymentVerificationDto.getMessage()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class Permission extends BaseEntity {
@Indexed(unique = true)
private String name;

@Builder.Default
private Boolean status = true;

@Indexed(unique = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
@Description(value = "This tables store the basic information about a product")
public class Product extends BaseEntity {
@Id
@Builder.Default
private String id = UUID.randomUUID().toString();

@Indexed()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class Promotion extends BaseEntity {
private LocalDateTime startDate;
private LocalDateTime endDate;
private Double discount;
@Builder.Default
private String status = "active";

@Indexed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class Role extends BaseEntity {
@Indexed(unique = true)
private String name;

@Builder.Default
private Boolean status = true;

@Indexed(unique = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class State extends BaseEntity {

private String name;


@Builder.Default
private Boolean status = true;

@DBRef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class Tenant extends BaseEntity {
@Indexed(unique = true)
private String code;

@Builder.Default
private Boolean status = true;

@DBRef
Expand Down

0 comments on commit 353d706

Please sign in to comment.