Skip to content

Commit fa7a34a

Browse files
authored
Merge pull request #317 from GianniTie/feature/add-cbp-support
[Feature] Add cbp support
2 parents 79a13f3 + 861c2f2 commit fa7a34a

17 files changed

+244
-17
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.mercadopago.client.payment;
2+
3+
import lombok.Builder;
4+
import lombok.Getter;
5+
6+
@Getter
7+
@Builder
8+
public class PaymentAmountsRequest {
9+
10+
/** Payer amount. */
11+
private PaymentUserAmountRequest payer;
12+
13+
/** Collector amount. */
14+
private PaymentUserAmountRequest collector;
15+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.mercadopago.client.payment;
2+
3+
import lombok.Builder;
4+
import lombok.Getter;
5+
6+
@Getter
7+
@Builder
8+
public class PaymentCounterCurrencyRequest {
9+
/** Currency ID. ISO_4217 code. */
10+
private String currencyId;
11+
}

src/main/java/com/mercadopago/client/payment/PaymentCreateRequest.java

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
@Builder
1313
public class PaymentCreateRequest {
1414
/**
15-
* Data that could improve fraud analysis and conversion rates. Try to send as much information as
15+
* Data that could improve fraud analysis and conversion rates. Try to send as
16+
* much information as
1617
* possible.
1718
*/
1819
private final PaymentAdditionalInfoRequest additionalInfo;
@@ -21,7 +22,8 @@ public class PaymentCreateRequest {
2122
private final BigDecimal applicationFee;
2223

2324
/**
24-
* When set to true, the payment can only be approved or rejected. Otherwise in_process status is
25+
* When set to true, the payment can only be approved or rejected. Otherwise
26+
* in_process status is
2527
* added.
2628
*/
2729
private final Boolean binaryMode;
@@ -32,7 +34,9 @@ public class PaymentCreateRequest {
3234
/** Discount campaign ID. */
3335
private final Long campaignId;
3436

35-
/** Determines if the payment should be captured (true) or just reserved (false). */
37+
/**
38+
* Determines if the payment should be captured (true) or just reserved (false).
39+
*/
3640
private final Boolean capture;
3741

3842
/** Amount of the coupon discount. */
@@ -65,13 +69,19 @@ public class PaymentCreateRequest {
6569
/** Merchant services. */
6670
private final PaymentMerchantServicesRequest merchantServices;
6771

68-
/** Data that can be attached to the payment to record additional attributes of the merchant. */
72+
/**
73+
* Data that can be attached to the payment to record additional attributes of
74+
* the merchant.
75+
*/
6976
private final Map<String, Object> metadata;
7077

7178
/** Net amount. */
7279
private final BigDecimal netAmount;
7380

74-
/** URL where mercadopago will send notifications associated to changes in this payment. */
81+
/**
82+
* URL where mercadopago will send notifications associated to changes in this
83+
* payment.
84+
*/
7585
private final String notificationUrl;
7686

7787
/** Order identifier. */
@@ -118,4 +128,10 @@ public class PaymentCreateRequest {
118128

119129
/** 3DS. */
120130
private final String threeDSecureMode;
131+
132+
/** Amounts. */
133+
private final PaymentAmountsRequest amounts;
134+
135+
/** Counter currency. */
136+
private final PaymentCounterCurrencyRequest counterCurrency;
121137
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.mercadopago.client.payment;
2+
3+
import java.math.BigDecimal;
4+
5+
import lombok.Builder;
6+
import lombok.Getter;
7+
8+
@Getter
9+
@Builder
10+
public class PaymentUserAmountRequest {
11+
/** Currency ID. ISO_4217 code. */
12+
private String currencyId;
13+
14+
/** Transaction amount. */
15+
private BigDecimal transaction;
16+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.mercadopago.client.preference;
2+
3+
import lombok.Builder;
4+
import lombok.Getter;
5+
6+
@Getter
7+
@Builder
8+
public class PreferenceAmountsRequest {
9+
/** Counter currency. */
10+
private PreferenceCounterCurrencyRequest counterCurrency;
11+
12+
/** Payer amount. */
13+
private PreferenceUserAmountRequest payer;
14+
15+
/** Collector amount. */
16+
private PreferenceUserAmountRequest collector;
17+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.mercadopago.client.preference;
2+
3+
import lombok.Builder;
4+
import lombok.Getter;
5+
6+
@Getter
7+
@Builder
8+
public class PreferenceCounterCurrencyRequest {
9+
/** Currency ID. ISO_4217 code. */
10+
private String currencyId;
11+
}

src/main/java/com/mercadopago/client/preference/PreferenceRequest.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ public class PreferenceRequest {
1515
private final String additionalInfo;
1616

1717
/**
18-
* If specified, your buyers will be redirected back to your site immediately after completing the
18+
* If specified, your buyers will be redirected back to your site immediately
19+
* after completing the
1920
* purchase.
2021
*/
2122
private final String autoReturn;
@@ -24,7 +25,8 @@ public class PreferenceRequest {
2425
private final PreferenceBackUrlsRequest backUrls;
2526

2627
/**
27-
* When set to true, the payment can only be approved or rejected. Otherwise in_process status is
28+
* When set to true, the payment can only be approved or rejected. Otherwise
29+
* in_process status is
2830
* added.
2931
*/
3032
private final Boolean binaryMode;
@@ -57,7 +59,8 @@ public class PreferenceRequest {
5759
private final BigDecimal marketplaceFee;
5860

5961
/**
60-
* Data that can be attached to the preference to record additional attributes of the merchant.
62+
* Data that can be attached to the preference to record additional attributes
63+
* of the merchant.
6164
*/
6265
private final Map<String, Object> metadata;
6366

@@ -90,4 +93,10 @@ public class PreferenceRequest {
9093

9194
/** Tracks to be executed during the users interaction in the Checkout flow. */
9295
private final List<PreferenceTrackRequest> tracks;
96+
97+
/** Amounts. */
98+
private final PreferenceAmountsRequest amounts;
99+
100+
/** Counter currency. */
101+
private final PreferenceCounterCurrencyRequest counterCurrency;
93102
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.mercadopago.client.preference;
2+
3+
import java.math.BigDecimal;
4+
5+
import lombok.Builder;
6+
import lombok.Getter;
7+
8+
@Getter
9+
@Builder
10+
public class PreferenceUserAmountRequest {
11+
/** Currency ID. ISO_4217 code. */
12+
private String currencyId;
13+
/** Transaction amount. */
14+
private BigDecimal transaction;
15+
}

src/main/java/com/mercadopago/resources/payment/Payment.java

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,15 @@ public class Payment extends MPResource {
8282
/** Payer information. */
8383
private PaymentPayer payer;
8484

85-
/** Data that can be attached to the payment to record additional attributes of the merchant. */
85+
/**
86+
* Data that can be attached to the payment to record additional attributes of
87+
* the merchant.
88+
*/
8689
private Map<String, Object> metadata;
8790

8891
/**
89-
* Data that could improve fraud analysis and conversion rates. Try to send as much information as
92+
* Data that could improve fraud analysis and conversion rates. Try to send as
93+
* much information as
9094
* possible.
9195
*/
9296
private PaymentAdditionalInfo additionalInfo;
@@ -122,7 +126,8 @@ public class Payment extends MPResource {
122126
private boolean captured;
123127

124128
/**
125-
* When set to true, the payment can only be approved or rejected. Otherwise in_process status is
129+
* When set to true, the payment can only be approved or rejected. Otherwise
130+
* in_process status is
126131
* added.
127132
*/
128133
private boolean binaryMode;
@@ -136,7 +141,10 @@ public class Payment extends MPResource {
136141
/** Card used to pay. */
137142
private PaymentCard card;
138143

139-
/** URL where mercadopago will send notifications associated to changes in this payment. */
144+
/**
145+
* URL where mercadopago will send notifications associated to changes in this
146+
* payment.
147+
*/
140148
private String notificationUrl;
141149

142150
/** URL where mercadopago does the final redirect (only for bank transfers). */
@@ -167,7 +175,7 @@ public class Payment extends MPResource {
167175
private BigDecimal taxesAmount;
168176

169177
/** Counter currency. */
170-
private String counterCurrency;
178+
private PaymentCounterCurrency counterCurrency;
171179

172180
/** Shipping amount. */
173181
private BigDecimal shippingAmount;
@@ -195,11 +203,15 @@ public class Payment extends MPResource {
195203
private PaymentThreeDSInfo threeDSInfo;
196204

197205
/**
198-
* Internal data that can be attached to the payment to record additional attributes of the
206+
* Internal data that can be attached to the payment to record additional
207+
* attributes of the
199208
* merchant.
200209
*/
201210
private Map<String, Object> internalMetadata;
202211

203212
/** Expanded information returned when using X-Expand-Response-Nodes header. */
204213
private PaymentExpanded expanded;
214+
215+
/** Amounts. */
216+
private PaymentAmounts amounts;
205217
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package com.mercadopago.resources.payment;
2+
3+
import lombok.Getter;
4+
5+
@Getter
6+
public class PaymentAmounts {
7+
/** Payer amount. */
8+
private PaymentUsersAmountPayer payer;
9+
10+
/** Collector amount. */
11+
private PaymentUsersAmountCollector collector;
12+
}

0 commit comments

Comments
 (0)