-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from badass-techie/feature/create-payment-micro…
…service Create payment microservice
- Loading branch information
Showing
34 changed files
with
715 additions
and
95 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
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
23 changes: 23 additions & 0 deletions
23
Order/src/main/java/com/badasstechie/order/dto/OrderPaymentRequest.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,23 @@ | ||
package com.badasstechie.order.dto; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.Map; | ||
|
||
/** | ||
* This is a record class that represents an order payment request to be sent to the payment microservice via the message bus and then to the payment gateway. | ||
* | ||
* @param orderId The order ID. | ||
* @param orderNumber The order number. | ||
* @param amount Total amount to be paid for in the smallest unit of the currency. | ||
* @param currency The currency in which the payment is made. | ||
* @param paymentMethod Exactly one of 'stripe', 'paypal', or 'mpesa'. | ||
* @param payerDetails A map of payer details. The keys are the names of the fields required by the payment gateway such as 'cardNumber', 'cvc', 'expiryMonth', 'expiryYear', and 'phoneNumber'. | ||
*/ | ||
public record OrderPaymentRequest( | ||
Long orderId, | ||
String orderNumber, | ||
BigDecimal amount, | ||
String currency, | ||
String paymentMethod, | ||
Map<String, String> payerDetails | ||
) {} |
15 changes: 15 additions & 0 deletions
15
Order/src/main/java/com/badasstechie/order/dto/OrderPaymentResponse.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,15 @@ | ||
package com.badasstechie.order.dto; | ||
|
||
import java.math.BigDecimal; | ||
import java.util.Map; | ||
|
||
public record OrderPaymentResponse( | ||
Long orderId, | ||
String orderNumber, | ||
BigDecimal amount, | ||
String currency, | ||
String paymentMethod, | ||
Map<String, String> payerDetails, | ||
PaymentResult resultStatus, | ||
String resultMessage | ||
) {} |
5 changes: 4 additions & 1 deletion
5
Order/src/main/java/com/badasstechie/order/dto/OrderRequest.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,11 @@ | ||
package com.badasstechie.order.dto; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public record OrderRequest( | ||
List<OrderItemDto> items, | ||
String deliveryAddress | ||
String deliveryAddress, | ||
String paymentMethod, | ||
Map<String, String> payerDetails | ||
){} |
6 changes: 6 additions & 0 deletions
6
Order/src/main/java/com/badasstechie/order/dto/PaymentResult.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,6 @@ | ||
package com.badasstechie.order.dto; | ||
|
||
public enum PaymentResult { | ||
SUCCESS, | ||
FAILED | ||
} |
2 changes: 1 addition & 1 deletion
2
Order/src/main/java/com/badasstechie/order/model/OrderStatus.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
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
Oops, something went wrong.