-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix account holder payment context source. Partial Authorization (#427)
* Fix account holder payment context source * Add partial authorization in payment request
- Loading branch information
1 parent
8e17ba0
commit b822ab6
Showing
11 changed files
with
137 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
src/main/java/com/checkout/payments/contexts/PaymentContextsResponse.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
package com.checkout.payments.contexts; | ||
|
||
import com.checkout.payments.response.source.contexts.ResponseSource; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString(callSuper = true) | ||
public final class PaymentContextsResponse extends PaymentContexts { | ||
|
||
private ResponseSource source; | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
src/main/java/com/checkout/payments/request/PartialAuthorization.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.checkout.payments.request; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Data | ||
@Builder | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public final class PartialAuthorization { | ||
|
||
private Boolean enabled; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 14 additions & 1 deletion
15
...com/checkout/payments/response/source/contexts/AbstractPaymentContextsResponseSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,23 @@ | ||
package com.checkout.payments.response.source.contexts; | ||
|
||
import com.checkout.accounts.payout.schedule.ScheduleFrequency; | ||
import com.checkout.common.AccountHolder; | ||
import com.checkout.common.PaymentSourceType; | ||
import com.google.gson.annotations.SerializedName; | ||
import lombok.Data; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@ToString(callSuper = true) | ||
public abstract class AbstractPaymentContextsResponseSource { | ||
|
||
public PaymentSourceType type; | ||
private final PaymentSourceType type; | ||
|
||
@SerializedName("account_holder") | ||
protected AccountHolder accountHolder; | ||
|
||
protected AbstractPaymentContextsResponseSource(final PaymentSourceType type) { | ||
this.type = type; | ||
} | ||
|
||
} |
13 changes: 9 additions & 4 deletions
13
...a/com/checkout/payments/response/source/contexts/PaymentContextsKlarnaResponseSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
package com.checkout.payments.response.source.contexts; | ||
|
||
import lombok.Data; | ||
import com.checkout.common.PaymentSourceType; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@Getter | ||
@Setter | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString(callSuper = true) | ||
@NoArgsConstructor | ||
public final class PaymentContextsKlarnaResponseSource extends AbstractPaymentContextsResponseSource implements ResponseSource { | ||
|
||
public PaymentContextsKlarnaResponseSource() { | ||
super(PaymentSourceType.KLARNA); | ||
} | ||
|
||
} |
13 changes: 9 additions & 4 deletions
13
...a/com/checkout/payments/response/source/contexts/PaymentContextsPayPalResponseSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,19 @@ | ||
package com.checkout.payments.response.source.contexts; | ||
|
||
import lombok.Data; | ||
import com.checkout.common.PaymentSourceType; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.Setter; | ||
import lombok.ToString; | ||
|
||
@Data | ||
@Getter | ||
@Setter | ||
@EqualsAndHashCode(callSuper = true) | ||
@ToString(callSuper = true) | ||
@NoArgsConstructor | ||
public final class PaymentContextsPayPalResponseSource extends AbstractPaymentContextsResponseSource implements ResponseSource { | ||
|
||
public PaymentContextsPayPalResponseSource() { | ||
super(PaymentSourceType.PAYPAL); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...t/resources/mocks/payments/response/contexts/payment_context_paypal_details_response.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"partner_metadata": { | ||
"customer_id": "WXZ3YUKYW27V4", | ||
"order_id": "0UX64350RX431305J" | ||
}, | ||
"payment_request": { | ||
"amount": 2500, | ||
"authorization_type": "Final", | ||
"capture": true, | ||
"currency": "GBP", | ||
"failure_url": "https://www.spaseekers.com/checkout/checkoutdotcom3/payment-failed", | ||
"items": [ | ||
{ | ||
"discount_amount": 0, | ||
"name": "£25.00 Voucher", | ||
"quantity": 1, | ||
"tax_amount": 0, | ||
"total_amount": 2500, | ||
"unit_price": 2500 | ||
} | ||
], | ||
"payment_type": "Regular", | ||
"processing": { | ||
"shipping_amount": 0, | ||
"user_action": "PAY_NOW" | ||
}, | ||
"processing_channel_id": "pc_strugfrty47ellyymdfg6fzhc4i", | ||
"reference": "770859", | ||
"shipping": { | ||
"address": { | ||
"address_line1": "6 May Close", | ||
"address_line2": "Goring-by-Sea", | ||
"city": "Worthing", | ||
"country": "GB", | ||
"state": "WEST SUSSEX", | ||
"zip": "BN12 6HW" | ||
}, | ||
"first_name": "Matthew Abbott" | ||
}, | ||
"source": { | ||
"account_holder": { | ||
"email": "[email protected]", | ||
"full_name": "Matthew Abbott" | ||
}, | ||
"type": "paypal" | ||
}, | ||
"success_url": "https://www.spaseekers.com/checkout/checkoutdotcom3/payment-successful" | ||
}, | ||
"status": "Created" | ||
} |