Skip to content

Commit 88d0bcd

Browse files
author
Vladislav Lipianin
committed
Add deprecation comments
1 parent b6084c9 commit 88d0bcd

8 files changed

Lines changed: 89 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This release introduces Unzer PayPal Express in Java SDK.
2727
### Deprecated
2828

2929
* Deprecated `com.unzer.payment.paymenttypes.Invoice`. Use `com.unzer.payment.paymenttypes.PaylaterInvoice` instead
30-
* Deprecated behavioral methods for data objects at:
30+
* Deprecated behavioral methods for data objects. Please, use Unzer facade instead. List of deprecations:
3131
* `AbstractTransaction` (base class of `Authorization`, `Cancel`, `Charge`, `Payout`, `Recurring`, `Shipment`, `MarketplaceAuthorization`, `MarketplaceCharge`, `MarketplacePayment`, `MarketplaceCancel`):
3232
* `getUnzer`/`setUnzer`
3333
* `Charge`:

src/main/java/com/unzer/payment/AbstractPayment.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,21 +192,33 @@ protected boolean isNotEmpty(String value) {
192192
return value != null && !"".equalsIgnoreCase(value.trim());
193193
}
194194

195+
/**
196+
* @deprecated use {@link Unzer#fetchPaymentType(String)} instead
197+
*/
195198
@Deprecated
196199
protected PaymentType fetchPaymentType(String paymentTypeId) throws HttpCommunicationException {
197200
return getUnzer().fetchPaymentType(paymentTypeId);
198201
}
199202

203+
/**
204+
* @deprecated use {@link Unzer#fetchCustomer(String)} instead
205+
*/
200206
@Deprecated
201207
protected Customer fetchCustomer(String customerId) throws HttpCommunicationException {
202208
return getUnzer().fetchCustomer(customerId);
203209
}
204210

211+
/**
212+
* @deprecated use {@link Unzer#fetchMetadata(String)} instead
213+
*/
205214
@Deprecated
206215
protected Metadata fetchMetadata(String metadataId) throws HttpCommunicationException {
207216
return getUnzer().fetchMetadata(metadataId);
208217
}
209218

219+
/**
220+
* @deprecated use {@link Unzer#fetchBasket(String)} instead
221+
*/
210222
@Deprecated
211223
protected Basket fetchBasket(String basketId) throws HttpCommunicationException {
212224
return getUnzer().fetchBasket(basketId);

src/main/java/com/unzer/payment/Authorization.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,31 +45,49 @@ public Authorization(Unzer unzer) {
4545
super(unzer);
4646
}
4747

48+
/**
49+
* @deprecated use {@link Unzer#chargeAuthorization(Charge)} instead
50+
*/
4851
@Deprecated
4952
public Charge charge() throws HttpCommunicationException {
5053
return getUnzer().chargeAuthorization(getPayment().getId());
5154
}
5255

56+
/**
57+
* @deprecated use {@link Unzer#chargeAuthorization(Charge)} instead
58+
*/
5359
@Deprecated
5460
public Charge charge(BigDecimal amount) throws HttpCommunicationException {
5561
return getUnzer().chargeAuthorization(getPayment().getId(), amount);
5662
}
5763

64+
/**
65+
* @deprecated use {@link Unzer#chargeAuthorization(Charge)} instead
66+
*/
5867
@Deprecated
5968
public Charge charge(BigDecimal amount, String paymentReference) throws HttpCommunicationException {
6069
return getUnzer().chargeAuthorization(getPayment().getId(), amount, paymentReference);
6170
}
6271

72+
/**
73+
* @deprecated use {@link Unzer#cancelAuthorization(String, Cancel)} instead
74+
*/
6375
@Deprecated
6476
public Cancel cancel() throws HttpCommunicationException {
6577
return getUnzer().cancelAuthorization(getPayment().getId());
6678
}
6779

80+
/**
81+
* @deprecated use {@link Unzer#cancelAuthorization(String, Cancel)} instead
82+
*/
6883
@Deprecated
6984
public Cancel cancel(BigDecimal amount) throws HttpCommunicationException {
7085
return getUnzer().cancelAuthorization(getPayment().getId(), amount);
7186
}
7287

88+
/**
89+
* @deprecated use {@link Unzer#cancelAuthorization(String, Cancel)} instead
90+
*/
7391
@Deprecated
7492
public Cancel cancel(Cancel cancel) throws HttpCommunicationException {
7593
return getUnzer().cancelAuthorization(getPayment().getId(), cancel);

src/main/java/com/unzer/payment/Charge.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
import com.unzer.payment.paymenttypes.PaymentType;
2121

2222
import java.math.BigDecimal;
23+
import java.net.URL;
2324
import java.util.ArrayList;
25+
import java.util.Currency;
2426
import java.util.List;
2527
import java.util.Optional;
2628

@@ -46,16 +48,25 @@ public Charge(Unzer unzer) {
4648
setCancelList(new ArrayList<Cancel>());
4749
}
4850

51+
/**
52+
* @deprecated use {@link Unzer#cancelCharge(String, String)} instead
53+
*/
4954
@Deprecated
5055
public Cancel cancel() throws HttpCommunicationException {
5156
return getUnzer().cancelCharge(getPayment().getId(), getId());
5257
}
5358

59+
/**
60+
* @deprecated use {@link Unzer#cancelCharge(String, String, Cancel)} instead
61+
*/
5462
@Deprecated
5563
public Cancel cancel(BigDecimal amount) throws HttpCommunicationException {
5664
return getUnzer().cancelCharge(getPayment().getId(), getId(), amount);
5765
}
5866

67+
/**
68+
* @deprecated use {@link Unzer#cancelCharge(String, String, Cancel)} instead
69+
*/
5970
@Deprecated
6071
public Cancel cancel(Cancel cancel) throws HttpCommunicationException {
6172
return getUnzer().cancelCharge(getPayment().getId(), getId(), cancel);

src/main/java/com/unzer/payment/Payment.java

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,61 +50,97 @@ public Payment(Unzer unzer) {
5050
super(unzer);
5151
}
5252

53+
/**
54+
* @deprecated use {@link Unzer#charge(Charge)} instead
55+
*/
5356
@Deprecated
5457
public Charge charge() throws HttpCommunicationException {
5558
return getUnzer().chargeAuthorization(getId());
5659
}
5760

61+
/**
62+
* @deprecated use {@link Unzer#charge(Charge)} instead
63+
*/
5864
@Deprecated
5965
public Charge charge(BigDecimal amount) throws HttpCommunicationException {
6066
return getUnzer().chargeAuthorization(getId(), amount);
6167
}
6268

69+
/**
70+
* @deprecated use {@link Unzer#charge(Charge)} instead
71+
*/
6372
@Deprecated
6473
public Charge charge(BigDecimal amount, Currency currency, String typeId) throws HttpCommunicationException {
6574
return getUnzer().charge(amount, currency, typeId);
6675
}
6776

77+
/**
78+
* @deprecated use {@link Unzer#charge(Charge)} instead
79+
*/
6880
@Deprecated
6981
public Charge charge(BigDecimal amount, Currency currency, String typeId, String customerId) throws HttpCommunicationException {
7082
return getUnzer().charge(amount, currency, typeId, customerId);
7183
}
7284

85+
/**
86+
* @deprecated use {@link Unzer#charge(Charge)} instead
87+
*/
7388
@Deprecated
7489
public Charge charge(BigDecimal amount, Currency currency, PaymentType paymentType) throws HttpCommunicationException {
7590
return getUnzer().charge(amount, currency, paymentType);
7691
}
7792

93+
/**
94+
* @deprecated use {@link Unzer#charge(Charge)} instead
95+
*/
7896
@Deprecated
7997
public Charge charge(BigDecimal amount, Currency currency, String typeId, URL returnUrl) throws HttpCommunicationException {
8098
return getUnzer().charge(amount, currency, typeId, returnUrl);
8199
}
82100

101+
/**
102+
* @deprecated use {@link Unzer#charge(Charge)} instead
103+
*/
83104
@Deprecated
84105
public Charge charge(BigDecimal amount, Currency currency, String typeId, URL returnUrl, String customerId) throws HttpCommunicationException {
85106
return getUnzer().charge(amount, currency, typeId, returnUrl, customerId);
86107
}
87108

109+
/**
110+
* @deprecated use {@link Unzer#charge(Charge)} instead
111+
*/
88112
@Deprecated
89113
public Charge charge(BigDecimal amount, Currency currency, PaymentType paymentType, URL returnUrl, Customer customer) throws HttpCommunicationException {
90114
return getUnzer().charge(amount, currency, paymentType, returnUrl, customer);
91115
}
92116

117+
/**
118+
* @deprecated use {@link Unzer#authorize(Authorization)} instead
119+
*/
93120
@Deprecated
94121
public Authorization authorize(BigDecimal amount, Currency currency, String typeId, URL returnUrl) throws HttpCommunicationException {
95122
return getUnzer().authorize(amount, currency, typeId, returnUrl);
96123
}
97124

125+
/**
126+
* @deprecated use {@link Unzer#authorize(Authorization)} instead
127+
*/
98128
@Deprecated
99129
public Authorization authorize(BigDecimal amount, Currency currency, String typeId, URL returnUrl, String customerId) throws HttpCommunicationException {
100130
return getUnzer().authorize(amount, currency, typeId, returnUrl, customerId);
101131
}
102132

133+
/**
134+
* @deprecated use {@link Unzer#authorize(Authorization)} instead
135+
*/
103136
@Deprecated
104137
public Authorization authorize(BigDecimal amount, Currency currency, PaymentType paymentType, URL returnUrl, Customer customer) throws HttpCommunicationException {
105138
return getUnzer().authorize(amount, currency, paymentType, returnUrl, customer);
106139
}
107140

141+
/**
142+
* @deprecated use {@link Unzer#cancelAuthorization(String, Cancel)} or {@link Unzer#cancelCharge(String, String)} instead
143+
*/
108144
@Deprecated
109145
public Cancel cancel() throws HttpCommunicationException {
110146
if (getAuthorization() == null) {
@@ -116,6 +152,9 @@ public Cancel cancel() throws HttpCommunicationException {
116152
return getAuthorization().cancel();
117153
}
118154

155+
/**
156+
* @deprecated use {@link Unzer#cancelAuthorization(String, Cancel)} or {@link Unzer#cancelCharge(String, String)} instead
157+
*/
119158
@Deprecated
120159
public Cancel cancel(BigDecimal amount) throws HttpCommunicationException {
121160
if (getAuthorization() == null) {

src/main/java/com/unzer/payment/marketplace/MarketplaceAuthorization.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ public MarketplaceCancel getCancel(String cancelId) {
6464
return null;
6565
}
6666

67+
/**
68+
* @deprecated use {@link Unzer#marketplaceCharge(MarketplaceCharge)} instead
69+
*/
6770
@Deprecated
6871
public MarketplaceCharge charge(MarketplaceCharge charge) throws HttpCommunicationException {
6972
return getUnzer().marketplaceChargeAuthorization(this.getPaymentId(), this.getId(), charge);
@@ -75,6 +78,7 @@ public MarketplaceCharge charge(MarketplaceCharge charge) throws HttpCommunicati
7578
* @param cancel refers to MarketplaceCancel.
7679
* @return MarketplaceCancel
7780
* @throws HttpCommunicationException
81+
* @deprecated use {@link Unzer#marketplaceAuthorizationCancel(String, String, MarketplaceCancel)} instead
7882
*/
7983
@Deprecated
8084
public MarketplaceCancel cancel(MarketplaceCancel cancel) throws HttpCommunicationException {

src/main/java/com/unzer/payment/marketplace/MarketplaceCharge.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ public void setCancelList(List<MarketplaceCancel> cancelList) {
8888
* @param cancel refers to MarketplaceCancel.
8989
* @return MarketplaceCancel
9090
* @throws HttpCommunicationException
91+
* @deprecated use {@link Unzer#marketplaceChargeCancel(String, String, MarketplaceCancel)} instead
9192
*/
9293
@Deprecated
9394
public MarketplaceCancel cancel(MarketplaceCancel cancel) throws HttpCommunicationException {

src/main/java/com/unzer/payment/marketplace/MarketplacePayment.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public PaymentType map(PaymentType paymentType, JsonObject jsonObject) {
119119
*
120120
* @return MarketplacePayment
121121
* @throws HttpCommunicationException
122+
* @deprecated use {@link Unzer#marketplaceFullAuthorizationsCancel(String, MarketplaceCancel)} instead
122123
*/
123124
@Deprecated
124125
public MarketplacePayment marketplaceFullAuthorizeCancel(String paymentReference) throws HttpCommunicationException {
@@ -133,6 +134,7 @@ public MarketplacePayment marketplaceFullAuthorizeCancel(String paymentReference
133134
*
134135
* @return MarketplacePayment
135136
* @throws HttpCommunicationException
137+
* @deprecated use {@link Unzer#marketplaceFullChargesCancel(String, MarketplaceCancel)} instead
136138
*/
137139
@Deprecated
138140
public MarketplacePayment marketplaceFullChargesCancel(String paymentReference) throws HttpCommunicationException {
@@ -147,6 +149,7 @@ public MarketplacePayment marketplaceFullChargesCancel(String paymentReference)
147149
*
148150
* @return MarketplacePayment
149151
* @throws HttpCommunicationException
152+
* @deprecated use {@link Unzer#marketplaceFullChargeAuthorizations(String, String)} instead
150153
*/
151154
@Deprecated
152155
public MarketplacePayment fullChargeAuthorizations(String paymentReference) throws HttpCommunicationException {

0 commit comments

Comments
 (0)