Subversion Repositories SmartDukaan

Rev

Rev 35403 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 35403 Rev 35652
Line 5... Line 5...
5
 
5
 
6
import javax.persistence.*;
6
import javax.persistence.*;
7
import java.io.Serializable;
7
import java.io.Serializable;
8
import java.math.BigDecimal;
8
import java.math.BigDecimal;
9
import java.time.LocalDateTime;
9
import java.time.LocalDateTime;
-
 
10
import java.util.Objects;
10
 
11
 
11
/**
12
/**
12
 * Entity representing Pinelabs order lifecycle.
13
 * Entity representing Pinelabs order lifecycle.
13
 * Replaces the old payment.pine_labs table with enhanced tracking capabilities.
14
 * Replaces the old payment.pine_labs table with enhanced tracking capabilities.
14
 *
15
 *
15
 * @author Pinelabs Integration Team
16
 * @author Pinelabs Integration Team
16
 * @since 1.0
17
 * @since 1.0
17
 */
18
 */
18
@Entity
19
@Entity
19
@Table(name = "pinelabs_orders", schema = "fofo")
20
@Table(name = "fofo.pinelabs_orders", schema = "fofo")
20
public class PinelabsOrder implements Serializable {
21
public class PinelabsOrder implements Serializable {
21
 
22
 
22
    private static final long serialVersionUID = 1L;
23
    private static final long serialVersionUID = 1L;
23
 
24
 
24
    @Id
25
    @Id
25
    @Column(name = "id")
26
    @Column(name = "id")
26
    @GeneratedValue(strategy = GenerationType.IDENTITY)
27
    @GeneratedValue(strategy = GenerationType.IDENTITY)
27
    private Long id;
28
    private long id;
28
 
29
 
29
    /**
30
    /**
30
     * Reference to internal pending order (fofo.pending_order.id)
31
     * Reference to internal pending order (fofo.pending_order.id)
31
     */
32
     */
32
    @Column(name = "pending_order_id", nullable = false)
33
    @Column(name = "pending_order_id", nullable = false)
Line 45... Line 46...
45
    private String pinelabsMerchantOrderRef;
46
    private String pinelabsMerchantOrderRef;
46
 
47
 
47
    /**
48
    /**
48
     * Reference to Pinelabs customer (null for guest checkout)
49
     * Reference to Pinelabs customer (null for guest checkout)
49
     */
50
     */
50
    @ManyToOne(fetch = FetchType.LAZY)
51
    @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
51
    @JoinColumn(name = "pinelabs_customer_id")
52
    @JoinColumn(name = "pinelabs_customer_id")
52
    private PinelabsCustomer pinelabsCustomer;
53
    private PinelabsCustomer pinelabsCustomer;
53
 
54
 
54
    /**
55
    /**
55
     * Payment method used for this order (null if not using saved card)
56
     * Payment method used for this order (null if not using saved card)
Line 172... Line 173...
172
        this.orderAmount = orderAmount;
173
        this.orderAmount = orderAmount;
173
    }
174
    }
174
 
175
 
175
    // ==================== Getters and Setters ====================
176
    // ==================== Getters and Setters ====================
176
 
177
 
177
    public Long getId() {
178
    public long getId() {
178
        return id;
179
        return id;
179
    }
180
    }
180
 
181
 
181
    public void setId(Long id) {
182
    public void setId(long id) {
182
        this.id = id;
183
        this.id = id;
183
    }
184
    }
184
 
185
 
185
    public Integer getPendingOrderId() {
186
    public Integer getPendingOrderId() {
186
        return pendingOrderId;
187
        return pendingOrderId;
Line 393... Line 394...
393
    }
394
    }
394
 
395
 
395
    // ==================== Object Methods ====================
396
    // ==================== Object Methods ====================
396
 
397
 
397
    @Override
398
    @Override
398
    public int hashCode() {
399
    public boolean equals(Object o) {
399
        final int prime = 31;
400
        if (!(o instanceof PinelabsOrder)) return false;
400
        int result = 1;
-
 
401
        result = prime * result + ((id == null) ? 0 : id.hashCode());
401
        PinelabsOrder that = (PinelabsOrder) o;
402
        result = prime * result + ((pinelabsOrderId == null) ? 0 : pinelabsOrderId.hashCode());
-
 
403
        result = prime * result + ((pendingOrderId == null) ? 0 : pendingOrderId.hashCode());
-
 
404
        return result;
402
        return id == that.id && Objects.equals(pendingOrderId, that.pendingOrderId) && Objects.equals(pinelabsOrderId, that.pinelabsOrderId) && Objects.equals(pinelabsMerchantOrderRef, that.pinelabsMerchantOrderRef) && Objects.equals(pinelabsCustomer, that.pinelabsCustomer) && Objects.equals(paymentMethod, that.paymentMethod) && Objects.equals(orderAmount, that.orderAmount) && Objects.equals(currency, that.currency) && paymentStatus == that.paymentStatus && Objects.equals(paymentMethodType, that.paymentMethodType) && Objects.equals(transactionId, that.transactionId) && Objects.equals(paymentUrl, that.paymentUrl) && Objects.equals(capturedAmount, that.capturedAmount) && Objects.equals(refundedAmount, that.refundedAmount) && Objects.equals(offerCode, that.offerCode) && Objects.equals(emiTenure, that.emiTenure) && Objects.equals(orderExpiryTimestamp, that.orderExpiryTimestamp) && Objects.equals(callbackReceivedTimestamp, that.callbackReceivedTimestamp) && Objects.equals(responseData, that.responseData) && Objects.equals(createTimestamp, that.createTimestamp) && Objects.equals(updateTimestamp, that.updateTimestamp);
405
    }
403
    }
406
 
404
 
407
    @Override
405
    @Override
408
    public boolean equals(Object obj) {
406
    public int hashCode() {
409
        if (this == obj)
-
 
410
            return true;
-
 
411
        if (obj == null)
-
 
412
            return false;
-
 
413
        if (getClass() != obj.getClass())
-
 
414
            return false;
-
 
415
        PinelabsOrder other = (PinelabsOrder) obj;
-
 
416
        if (id == null) {
-
 
417
            if (other.id != null)
-
 
418
                return false;
-
 
419
        } else if (!id.equals(other.id))
-
 
420
            return false;
-
 
421
        if (pinelabsOrderId == null) {
-
 
422
            if (other.pinelabsOrderId != null)
-
 
423
                return false;
-
 
424
        } else if (!pinelabsOrderId.equals(other.pinelabsOrderId))
-
 
425
            return false;
-
 
426
        if (pendingOrderId == null) {
-
 
427
            if (other.pendingOrderId != null)
-
 
428
                return false;
-
 
429
        } else if (!pendingOrderId.equals(other.pendingOrderId))
-
 
430
            return false;
-
 
431
        return true;
407
        return Objects.hash(id, pendingOrderId, pinelabsOrderId, pinelabsMerchantOrderRef, pinelabsCustomer, paymentMethod, orderAmount, currency, paymentStatus, paymentMethodType, transactionId, paymentUrl, capturedAmount, refundedAmount, offerCode, emiTenure, orderExpiryTimestamp, callbackReceivedTimestamp, responseData, createTimestamp, updateTimestamp);
432
    }
408
    }
433
 
409
 
434
    @Override
410
    @Override
435
    public String toString() {
411
    public String toString() {
436
        return "PinelabsOrder [id=" + id + ", pendingOrderId=" + pendingOrderId + ", pinelabsOrderId="
412
        return "PinelabsOrder [id=" + id + ", pendingOrderId=" + pendingOrderId + ", pinelabsOrderId="