-
Notifications
You must be signed in to change notification settings - Fork 416
Commit
* [Payment] Embedded Payment-Paypal project into Payment project like a dependency #1003 * [Payment] Embedded Payment-Paypal project into Payment project like a dependency #1003 * [Payment] Embedded Payment-Paypal project into Payment project like a dependency #1003 * [Payment] Embedded Payment-Paypal project into Payment project like a dependency #1003 * [Payment] Embedded Payment-Paypal project into Payment project like a dependency #1003 * [Payment] Embedded Payment-Paypal project into Payment project like a dependency #1003 * [Payment] Embedded Payment-Paypal project into Payment project like a dependency #1003 * [Payment] Embedded Payment-Paypal project into Payment project like a dependency #1003 --------- Co-authored-by: khanhtranduy <130121475+khanhtranduy@users.noreply.github.com>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package com.yas.paymentpaypal.model; | ||
package com.yas.payment.paypal.model; | ||
|
||
public class CheckoutIdHelper { | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.yas.payment.paypal.service; | ||
|
||
import com.nimbusds.jose.shaded.gson.JsonObject; | ||
import com.nimbusds.jose.shaded.gson.JsonParser; | ||
import com.paypal.core.PayPalEnvironment; | ||
import com.paypal.core.PayPalHttpClient; | ||
import org.springframework.stereotype.Component; | ||
import org.springframework.util.Assert; | ||
|
||
@Component | ||
public class PayPalHttpClientInitializer { | ||
|
||
public PayPalHttpClient createPaypalClient(String additionalSettings) { | ||
Assert.notNull(additionalSettings, "The additionalSettings can not be null."); | ||
// Parse the additionalSettings field to extract clientId and clientSecret | ||
JsonObject settingsJson = JsonParser.parseString(additionalSettings).getAsJsonObject(); | ||
String clientId = settingsJson.get("clientId").getAsString(); | ||
String clientSecret = settingsJson.get("clientSecret").getAsString(); | ||
String mode = settingsJson.get("mode").getAsString(); | ||
if (mode.equals("sandbox")) { | ||
// Create PayPalHttpClient with the retrieved clientId and clientSecret | ||
return new PayPalHttpClient(new PayPalEnvironment.Sandbox(clientId, clientSecret)); | ||
} | ||
return new PayPalHttpClient(new PayPalEnvironment.Live(clientId, clientSecret)); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.yas.payment.paypal.viewmodel; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record PaypalCapturePaymentRequest(String token, String paymentSettings) { | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
package com.yas.paymentpaypal.viewmodel; | ||
package com.yas.payment.paypal.viewmodel; | ||
|
||
import java.math.BigDecimal; | ||
import lombok.Builder; | ||
|
||
@Builder | ||
public record CapturedPaymentVm( | ||
Long orderId, | ||
public record PaypalCapturePaymentResponse( | ||
String checkoutId, | ||
BigDecimal amount, | ||
BigDecimal paymentFee, | ||
String gatewayTransactionId, | ||
String paymentMethod, | ||
String paymentStatus, | ||
String failureMessage) { | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.yas.payment.paypal.viewmodel; | ||
|
||
import lombok.Builder; | ||
|
||
import java.math.BigDecimal; | ||
Check warning on line 5 in payment-paypal/src/main/java/com/yas/payment/paypal/viewmodel/PaypalCreatePaymentRequest.java GitHub Actions / Checkstylecom.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck
Check warning on line 5 in payment-paypal/src/main/java/com/yas/payment/paypal/viewmodel/PaypalCreatePaymentRequest.java GitHub Actions / Checkstylecom.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck
Check warning on line 5 in payment-paypal/src/main/java/com/yas/payment/paypal/viewmodel/PaypalCreatePaymentRequest.java GitHub Actions / Checkstylecom.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck
Check warning on line 5 in payment-paypal/src/main/java/com/yas/payment/paypal/viewmodel/PaypalCreatePaymentRequest.java GitHub Actions / Checkstylecom.puppycrawl.tools.checkstyle.checks.imports.CustomImportOrderCheck
|
||
|
||
@Builder | ||
public record PaypalCreatePaymentRequest(BigDecimal totalPrice, String checkoutId, String paymentMethod, String paymentSettings) { | ||
Check warning on line 8 in payment-paypal/src/main/java/com/yas/payment/paypal/viewmodel/PaypalCreatePaymentRequest.java GitHub Actions / Checkstylecom.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.yas.payment.paypal.viewmodel; | ||
|
||
import lombok.Builder; | ||
|
||
@Builder | ||
public record PaypalCreatePaymentResponse(String status, String paymentId, String redirectUrl) { | ||
} |
This file was deleted.