| 1946 |
chandransh |
1 |
package in.shop2020.payment.persistence;
|
|
|
2 |
|
|
|
3 |
import java.util.List;
|
|
|
4 |
import java.util.Map;
|
|
|
5 |
|
|
|
6 |
import org.apache.ibatis.annotations.Param;
|
|
|
7 |
|
|
|
8 |
import in.shop2020.payment.domain.Payment;
|
|
|
9 |
import in.shop2020.payment.domain.PaymentAttribute;
|
|
|
10 |
|
|
|
11 |
public interface PaymentMapper {
|
|
|
12 |
int insertPayment(Payment payment);
|
|
|
13 |
|
|
|
14 |
void updatePayment(Payment payment);
|
|
|
15 |
|
|
|
16 |
// TODO: All getPayment methods currently employ the simple N+1 strategy to
|
|
|
17 |
// load the attributes. This is not desirable. Instead, more labour should
|
|
|
18 |
// be spent into writing the long result maps which will use a single query.
|
|
|
19 |
Payment getPayment(long id);
|
|
|
20 |
|
|
|
21 |
List<Payment> getPaymentsForUser(@Param("userId") long userId,
|
|
|
22 |
@Param("fromTime") String fromTime, @Param("toTime") String toTime,
|
|
|
23 |
@Param("status") int status, @Param("gatewayId") long gatewayId);
|
|
|
24 |
|
|
|
25 |
List<Payment> getPayments(@Param("fromTime") String fromTime, @Param("toTime") String toTime,
|
|
|
26 |
@Param("status") int status, @Param("gatewayId") long gatewayId);
|
| 2976 |
chandransh |
27 |
|
| 4141 |
chandransh |
28 |
List<Payment> getPaymentsByCapturedDate(@Param("fromTime") String fromTime, @Param("toTime") String toTime,
|
|
|
29 |
@Param("status") int status, @Param("gatewayId") long gatewayId);
|
| 2976 |
chandransh |
30 |
/**
|
|
|
31 |
* Currently, it returns the last payment for a transaction assuming that
|
|
|
32 |
* it is the only one which can be successful.
|
|
|
33 |
*
|
|
|
34 |
* @param merchantTxnId
|
|
|
35 |
* The merchant transaction for which payments are required.
|
|
|
36 |
* @return A list of payments
|
|
|
37 |
*/
|
| 1946 |
chandransh |
38 |
List<Payment> getPaymentForTxn(long merchantTxnId);
|
| 2976 |
chandransh |
39 |
|
|
|
40 |
/**
|
|
|
41 |
* Finds the maximum and minimum amount among the successful payments.
|
|
|
42 |
*
|
|
|
43 |
* @return A map containing the maximum and minimum amount keyed using MAX
|
|
|
44 |
* and MIN as keys respectively.
|
|
|
45 |
*/
|
| 1946 |
chandransh |
46 |
Map<String, Float> getMinMaxPaymentAmount();
|
| 2976 |
chandransh |
47 |
|
|
|
48 |
/**
|
|
|
49 |
* Get the list of attributes of a payment.
|
|
|
50 |
*
|
|
|
51 |
* @param id
|
|
|
52 |
* Id of the payment whose attributes are required.
|
|
|
53 |
* @return A list of all the attributes of a payment.
|
|
|
54 |
*/
|
| 1946 |
chandransh |
55 |
List<PaymentAttribute> getAttributesForPayment(long id);
|
| 2976 |
chandransh |
56 |
|
|
|
57 |
/**
|
|
|
58 |
* Inserts an attribute for the given payments. If the attribute is already
|
|
|
59 |
* present, just updates its value.
|
|
|
60 |
*
|
|
|
61 |
* @param paymentId
|
|
|
62 |
* Id of the payment for which the attribute has to be added or
|
|
|
63 |
* updated.
|
|
|
64 |
* @param name
|
|
|
65 |
* Name of the attribute
|
|
|
66 |
* @param value
|
|
|
67 |
* Value of the attribute
|
|
|
68 |
*/
|
| 1946 |
chandransh |
69 |
void insertPaymentAttribute(@Param("paymentId") long paymentId,
|
|
|
70 |
@Param("name") String name, @Param("value") String value);
|
| 7049 |
anupam.sin |
71 |
|
|
|
72 |
List<Payment> getPaymentForRechargeTxn(long merchantTxnId);
|
| 1946 |
chandransh |
73 |
}
|