-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathAuthorization.java
More file actions
113 lines (94 loc) · 3.15 KB
/
Authorization.java
File metadata and controls
113 lines (94 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package com.unzer.payment;
import com.unzer.payment.communication.HttpCommunicationException;
import java.math.BigDecimal;
import java.util.List;
/**
* Business object for Authorization. Amount, currency and typeId are mandatory parameter to
* execute an Authorization.
* <p>
* The returnUrl is mandatory in case of redirectPayments like Sofort, Paypal, Giropay, Card 3DS
*
* @author Unzer E-Com GmbH
*/
public class Authorization extends BaseTransaction<Payment> {
private BigDecimal effectiveInterestRate;
private List<Cancel> cancelList;
public Authorization() {
super();
}
@Deprecated
public Authorization(Unzer unzer) {
super(unzer);
}
@Override
protected String getTransactionUrl() {
return "/v1/payments/<paymentId>/authorize/<transactionId>";
}
/**
* @deprecated use {@link Unzer#chargeAuthorization(Charge)} instead
*/
@Deprecated
public Charge charge() throws HttpCommunicationException {
return getUnzer().chargeAuthorization(getPayment().getId());
}
/**
* @deprecated use {@link Unzer#chargeAuthorization(Charge)} instead
*/
@Deprecated
public Charge charge(BigDecimal amount) throws HttpCommunicationException {
return getUnzer().chargeAuthorization(getPayment().getId(), amount);
}
/**
* @deprecated use {@link Unzer#chargeAuthorization(Charge)} instead
*/
@Deprecated
public Charge charge(BigDecimal amount, String paymentReference)
throws HttpCommunicationException {
return getUnzer().chargeAuthorization(getPayment().getId(), amount, paymentReference);
}
/**
* @deprecated use {@link Unzer#cancelAuthorization(String, Cancel)} instead
*/
@Deprecated
public Cancel cancel() throws HttpCommunicationException {
return getUnzer().cancelAuthorization(getPayment().getId());
}
/**
* @deprecated use {@link Unzer#cancelAuthorization(String, Cancel)} instead
*/
@Deprecated
public Cancel cancel(BigDecimal amount) throws HttpCommunicationException {
return getUnzer().cancelAuthorization(getPayment().getId(), amount);
}
/**
* @deprecated use {@link Unzer#cancelAuthorization(String, Cancel)} instead
*/
@Deprecated
public Cancel cancel(Cancel cancel) throws HttpCommunicationException {
return getUnzer().cancelAuthorization(getPayment().getId(), cancel);
}
public BigDecimal getEffectiveInterestRate() {
return effectiveInterestRate;
}
public Authorization setEffectiveInterestRate(BigDecimal effectiveInterestRate) {
this.effectiveInterestRate = effectiveInterestRate;
return this;
}
public List<Cancel> getCancelList() {
return cancelList;
}
public void setCancelList(List<Cancel> cancelList) {
this.cancelList = cancelList;
}
public Cancel getCancel(String cancelId) {
if (cancelList == null) {
return null;
}
for (Cancel cancel : cancelList) {
if (cancelId.equalsIgnoreCase(cancel.getId())) {
return cancel;
}
}
return null;
}
}