Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
orders-monitoring-dashboard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramakanth Dhane
orders-monitoring-dashboard
Commits
f6ec77f5
Commit
f6ec77f5
authored
Apr 20, 2020
by
Durga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
random order creation in checkout service
parent
7a73ad0e
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
545 additions
and
2 deletions
+545
-2
pom.xml
omd-checkout-service/pom.xml
+21
-1
OmdCheckoutServiceApplication.java
...ain/java/com/nisum/omd/OmdCheckoutServiceApplication.java
+26
-1
RandomDataGenerateImpl.java
...e/src/main/java/com/nisum/omd/RandomDataGenerateImpl.java
+34
-0
RandomDataGenerator.java
...vice/src/main/java/com/nisum/omd/RandomDataGenerator.java
+11
-0
LineItem.java
...-service/src/main/java/com/nisum/omd/domain/LineItem.java
+141
-0
Order.java
...out-service/src/main/java/com/nisum/omd/domain/Order.java
+127
-0
PaymentMethod.java
...ice/src/main/java/com/nisum/omd/domain/PaymentMethod.java
+57
-0
Promotions.java
...ervice/src/main/java/com/nisum/omd/domain/Promotions.java
+27
-0
Order.json
omd-checkout-service/src/main/resources/Order.json
+101
-0
No files found.
omd-checkout-service/pom.xml
View file @
f6ec77f5
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
<properties>
<properties>
<java.version>
1.8
</java.version>
<java.version>
1.8
</java.version>
<maven-jar-plugin.version>
3.1.1
</maven-jar-plugin.version>
</properties>
</properties>
<dependencies>
<dependencies>
...
@@ -23,7 +24,26 @@
...
@@ -23,7 +24,26 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
</dependency>
<dependency>
<groupId>
com.fasterxml.jackson.core
</groupId>
<artifactId>
jackson-databind
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-devtools
</artifactId>
<scope>
runtime
</scope>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
com.h2database
</groupId>
<artifactId>
h2
</artifactId>
<scope>
runtime
</scope>
</dependency>
<dependency>
<groupId>
com.github.javafaker
</groupId>
<artifactId>
javafaker
</artifactId>
<version>
1.0.2
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<artifactId>
spring-boot-starter-test
</artifactId>
...
...
omd-checkout-service/src/main/java/com/nisum/omd/OmdCheckoutServiceApplication.java
View file @
f6ec77f5
package
com
.
nisum
.
omd
;
package
com
.
nisum
.
omd
;
import
java.io.File
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.nisum.omd.domain.Order
;
@SpringBootApplication
@SpringBootApplication
public
class
OmdCheckoutServiceApplication
{
public
class
OmdCheckoutServiceApplication
implements
CommandLineRunner
{
@Autowired
RandomDataGenerateImpl
rdg
;
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
OmdCheckoutServiceApplication
.
class
,
args
);
SpringApplication
.
run
(
OmdCheckoutServiceApplication
.
class
,
args
);
}
}
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
// TODO Auto-generated method stub
ObjectMapper
objectMapper
=
new
ObjectMapper
();
Order
order
=
objectMapper
.
readValue
(
new
File
(
"src/main/resources/Order.json"
),
Order
.
class
);
for
(
int
i
=
0
;
i
<
100
;
i
++)
{
order
.
setOrderNum
(
rdg
.
generateOrderNumber
());
order
.
setCustomerId
(
rdg
.
generateCustomerId
());
order
.
setLineItem
(
rdg
.
genetateLineItem
());
System
.
out
.
println
(
order
);
}
}
}
}
omd-checkout-service/src/main/java/com/nisum/omd/RandomDataGenerateImpl.java
0 → 100644
View file @
f6ec77f5
package
com
.
nisum
.
omd
;
import
org.springframework.stereotype.Component
;
import
com.github.javafaker.Faker
;
import
com.nisum.omd.domain.LineItem
;
@Component
//@Scope(value="prototype", proxyMode=ScopedProxyMode.TARGET_CLASS)
public
class
RandomDataGenerateImpl
implements
RandomDataGenerator
{
Faker
fk
=
new
Faker
();
public
String
generateOrderNumber
()
{
return
String
.
valueOf
(
fk
.
number
().
numberBetween
(
1000000
,
9999999
));
}
public
String
generateCustomerId
()
{
// TODO Auto-generated method stub
return
String
.
valueOf
(
fk
.
number
().
numberBetween
(
10000
,
99999
));
}
public
LineItem
genetateLineItem
()
{
// TODO Auto-generated method stub
LineItem
li
=
new
LineItem
();
li
.
setProductName
(
fk
.
commerce
().
productName
());
li
.
setTaxCode
(
String
.
valueOf
(
fk
.
number
().
numberBetween
(
100
,
1000
)));
return
li
;
}
}
omd-checkout-service/src/main/java/com/nisum/omd/RandomDataGenerator.java
0 → 100644
View file @
f6ec77f5
package
com
.
nisum
.
omd
;
import
com.nisum.omd.domain.LineItem
;
public
interface
RandomDataGenerator
{
String
generateOrderNumber
();
String
generateCustomerId
();
LineItem
genetateLineItem
();
}
omd-checkout-service/src/main/java/com/nisum/omd/domain/LineItem.java
0 → 100644
View file @
f6ec77f5
package
com
.
nisum
.
omd
.
domain
;
import
java.util.Map
;
public
class
LineItem
{
private
String
lineItemNumber
;
private
String
skuNumber
;
private
String
itemColorDesc
;
private
String
size
;
private
String
orderedQty
;
private
String
productName
;
private
String
itemType
;
private
boolean
shipChrgApplInd
;
private
String
estimatedShipDate
;
private
Map
<
String
,
Object
>
linePriceInfo
;
private
String
taxCode
;
private
boolean
autoAddInd
;
private
Map
<
String
,
Object
>
lineTax
;
private
String
originalLineItemId
;
private
String
vendorUpcCode
;
private
String
brandCode
;
private
String
eligibleReturnLocationCode
;
public
String
getLineItemNumber
()
{
return
lineItemNumber
;
}
public
void
setLineItemNumber
(
String
lineItemNumber
)
{
this
.
lineItemNumber
=
lineItemNumber
;
}
public
String
getSkuNumber
()
{
return
skuNumber
;
}
public
void
setSkuNumber
(
String
skuNumber
)
{
this
.
skuNumber
=
skuNumber
;
}
public
String
getItemColorDesc
()
{
return
itemColorDesc
;
}
public
void
setItemColorDesc
(
String
itemColorDesc
)
{
this
.
itemColorDesc
=
itemColorDesc
;
}
public
String
getSize
()
{
return
size
;
}
public
void
setSize
(
String
size
)
{
this
.
size
=
size
;
}
public
String
getOrderedQty
()
{
return
orderedQty
;
}
public
void
setOrderedQty
(
String
orderedQty
)
{
this
.
orderedQty
=
orderedQty
;
}
public
String
getProductName
()
{
return
productName
;
}
public
void
setProductName
(
String
productName
)
{
this
.
productName
=
productName
;
}
public
String
getItemType
()
{
return
itemType
;
}
public
void
setItemType
(
String
itemType
)
{
this
.
itemType
=
itemType
;
}
public
boolean
isShipChrgApplInd
()
{
return
shipChrgApplInd
;
}
public
void
setShipChrgApplInd
(
boolean
shipChrgApplInd
)
{
this
.
shipChrgApplInd
=
shipChrgApplInd
;
}
public
String
getEstimatedShipDate
()
{
return
estimatedShipDate
;
}
public
void
setEstimatedShipDate
(
String
estimatedShipDate
)
{
this
.
estimatedShipDate
=
estimatedShipDate
;
}
public
Map
<
String
,
Object
>
getLinePriceInfo
()
{
return
linePriceInfo
;
}
public
void
setLinePriceInfo
(
Map
<
String
,
Object
>
linePriceInfo
)
{
this
.
linePriceInfo
=
linePriceInfo
;
}
public
String
getTaxCode
()
{
return
taxCode
;
}
public
void
setTaxCode
(
String
taxCode
)
{
this
.
taxCode
=
taxCode
;
}
public
boolean
isAutoAddInd
()
{
return
autoAddInd
;
}
public
void
setAutoAddInd
(
boolean
autoAddInd
)
{
this
.
autoAddInd
=
autoAddInd
;
}
public
Map
<
String
,
Object
>
getLineTax
()
{
return
lineTax
;
}
public
void
setLineTax
(
Map
<
String
,
Object
>
lineTax
)
{
this
.
lineTax
=
lineTax
;
}
public
String
getOriginalLineItemId
()
{
return
originalLineItemId
;
}
public
void
setOriginalLineItemId
(
String
originalLineItemId
)
{
this
.
originalLineItemId
=
originalLineItemId
;
}
public
String
getVendorUpcCode
()
{
return
vendorUpcCode
;
}
public
void
setVendorUpcCode
(
String
vendorUpcCode
)
{
this
.
vendorUpcCode
=
vendorUpcCode
;
}
public
String
getBrandCode
()
{
return
brandCode
;
}
public
void
setBrandCode
(
String
brandCode
)
{
this
.
brandCode
=
brandCode
;
}
public
String
getEligibleReturnLocationCode
()
{
return
eligibleReturnLocationCode
;
}
public
void
setEligibleReturnLocationCode
(
String
eligibleReturnLocationCode
)
{
this
.
eligibleReturnLocationCode
=
eligibleReturnLocationCode
;
}
@Override
public
String
toString
()
{
return
"LineItem [lineItemNumber="
+
lineItemNumber
+
", skuNumber="
+
skuNumber
+
", itemColorDesc="
+
itemColorDesc
+
", size="
+
size
+
", orderedQty="
+
orderedQty
+
", productName="
+
productName
+
", itemType="
+
itemType
+
", shipChrgApplInd="
+
shipChrgApplInd
+
", estimatedShipDate="
+
estimatedShipDate
+
", linePriceInfo="
+
linePriceInfo
+
", taxCode="
+
taxCode
+
", autoAddInd="
+
autoAddInd
+
", lineTax="
+
lineTax
+
", originalLineItemId="
+
originalLineItemId
+
", vendorUpcCode="
+
vendorUpcCode
+
", brandCode="
+
brandCode
+
", eligibleReturnLocationCode="
+
eligibleReturnLocationCode
+
"]"
;
}
}
omd-checkout-service/src/main/java/com/nisum/omd/domain/Order.java
0 → 100644
View file @
f6ec77f5
package
com
.
nisum
.
omd
.
domain
;
import
java.util.Map
;
public
class
Order
{
private
String
orderNum
;
private
String
orderDate
;
private
String
currency
;
private
String
shipMethod
;
private
String
customerId
;
private
String
customerType
;
private
Promotions
promotions
;
private
String
gift
;
private
LineItem
lineItem
;
private
Map
<
String
,
Object
>
shippingInfo
;
private
Map
<
String
,
Object
>
shipTo
;
private
Map
<
String
,
Object
>
billingTo
;
private
Map
<
String
,
Object
>
orderCharges
;
private
Map
<
String
,
Object
>
OrderTaxes
;
private
PaymentMethod
paymentMethod
;
public
String
getOrderNum
()
{
return
orderNum
;
}
public
void
setOrderNum
(
String
orderNum
)
{
this
.
orderNum
=
orderNum
;
//rdg.generateOrderNumber();
}
public
String
getOrderDate
()
{
return
orderDate
;
}
public
void
setOrderDate
(
String
orderDate
)
{
this
.
orderDate
=
orderDate
;
}
public
String
getCurrency
()
{
return
currency
;
}
public
void
setCurrency
(
String
currency
)
{
this
.
currency
=
currency
;
}
public
String
getShipMethod
()
{
return
shipMethod
;
}
public
void
setShipMethod
(
String
shipMethod
)
{
this
.
shipMethod
=
shipMethod
;
}
public
String
getCustomerId
()
{
return
customerId
;
}
public
void
setCustomerId
(
String
customerId
)
{
this
.
customerId
=
customerId
;
//rdg.generateCustomerId();
}
public
String
getCustomerType
()
{
return
customerType
;
}
public
void
setCustomerType
(
String
customerType
)
{
this
.
customerType
=
customerType
;
}
public
Promotions
getPromotions
()
{
return
promotions
;
}
public
void
setPromotions
(
Promotions
promotions
)
{
this
.
promotions
=
promotions
;
}
public
String
getGift
()
{
return
gift
;
}
public
void
setGift
(
String
gift
)
{
this
.
gift
=
gift
;
}
public
LineItem
getLineItem
()
{
return
lineItem
;
}
public
void
setLineItem
(
LineItem
lineItem
)
{
//this.lineItem = rdg.genetateLineItem();
this
.
lineItem
=
lineItem
;
}
public
Map
<
String
,
Object
>
getShippingInfo
()
{
return
shippingInfo
;
}
public
void
setShippingInfo
(
Map
<
String
,
Object
>
shippingInfo
)
{
this
.
shippingInfo
=
shippingInfo
;
}
public
Map
<
String
,
Object
>
getShipTo
()
{
return
shipTo
;
}
public
void
setShipTo
(
Map
<
String
,
Object
>
shipTo
)
{
this
.
shipTo
=
shipTo
;
}
public
Map
<
String
,
Object
>
getBillingTo
()
{
return
billingTo
;
}
public
void
setBillingTo
(
Map
<
String
,
Object
>
billingTo
)
{
this
.
billingTo
=
billingTo
;
}
public
Map
<
String
,
Object
>
getOrderCharges
()
{
return
orderCharges
;
}
public
void
setOrderCharges
(
Map
<
String
,
Object
>
orderCharges
)
{
this
.
orderCharges
=
orderCharges
;
}
public
Map
<
String
,
Object
>
getOrderTaxes
()
{
return
OrderTaxes
;
}
public
void
setOrderTaxes
(
Map
<
String
,
Object
>
orderTaxes
)
{
OrderTaxes
=
orderTaxes
;
}
public
PaymentMethod
getPaymentMethod
()
{
return
paymentMethod
;
}
public
void
setPaymentMethod
(
PaymentMethod
paymentMethod
)
{
this
.
paymentMethod
=
paymentMethod
;
}
@Override
public
String
toString
()
{
return
"Order [orderNum="
+
orderNum
+
", orderDate="
+
orderDate
+
", currency="
+
currency
+
", shipMethod="
+
shipMethod
+
", customerId="
+
customerId
+
", customerType="
+
customerType
+
", promotions="
+
promotions
+
", gift="
+
gift
+
", lineItem="
+
lineItem
+
", shippingInfo="
+
shippingInfo
+
", shipTo="
+
shipTo
+
", billingTo="
+
billingTo
+
", orderCharges="
+
orderCharges
+
", OrderTaxes="
+
OrderTaxes
+
", paymentMethod="
+
paymentMethod
+
"]"
;
}
}
omd-checkout-service/src/main/java/com/nisum/omd/domain/PaymentMethod.java
0 → 100644
View file @
f6ec77f5
package
com
.
nisum
.
omd
.
domain
;
import
java.util.Map
;
public
class
PaymentMethod
{
private
String
paymetMethod
;
private
String
creditCardNo
;
private
String
creditCardType
;
private
String
displayCreditCardNo
;
private
String
paymentStatus
;
private
Map
<
String
,
Object
>
paymentDetail
;
public
String
getPaymetMethod
()
{
return
paymetMethod
;
}
public
void
setPaymetMethod
(
String
paymetMethod
)
{
this
.
paymetMethod
=
paymetMethod
;
}
public
String
getCreditCardNo
()
{
return
creditCardNo
;
}
public
void
setCreditCardNo
(
String
creditCardNo
)
{
this
.
creditCardNo
=
creditCardNo
;
}
public
String
getCreditCardType
()
{
return
creditCardType
;
}
public
void
setCreditCardType
(
String
creditCardType
)
{
this
.
creditCardType
=
creditCardType
;
}
public
String
getDisplayCreditCardNo
()
{
return
displayCreditCardNo
;
}
public
void
setDisplayCreditCardNo
(
String
displayCreditCardNo
)
{
this
.
displayCreditCardNo
=
displayCreditCardNo
;
}
public
String
getPaymentStatus
()
{
return
paymentStatus
;
}
public
void
setPaymentStatus
(
String
paymentStatus
)
{
this
.
paymentStatus
=
paymentStatus
;
}
public
Map
<
String
,
Object
>
getPaymentDetail
()
{
return
paymentDetail
;
}
public
void
setPaymentDetail
(
Map
<
String
,
Object
>
paymentDetail
)
{
this
.
paymentDetail
=
paymentDetail
;
}
@Override
public
String
toString
()
{
return
"PaymentMethod [paymetMethod="
+
paymetMethod
+
", creditCardNo="
+
creditCardNo
+
", creditCardType="
+
creditCardType
+
", displayCreditCardNo="
+
displayCreditCardNo
+
", paymentStatus="
+
paymentStatus
+
", paymentDetail="
+
paymentDetail
+
"]"
;
}
}
omd-checkout-service/src/main/java/com/nisum/omd/domain/Promotions.java
0 → 100644
View file @
f6ec77f5
package
com
.
nisum
.
omd
.
domain
;
import
java.util.Map
;
public
class
Promotions
{
private
Map
<
String
,
Object
>
PromotionDetails
;
private
Map
<
String
,
Object
>
Awards
;
public
Map
<
String
,
Object
>
getPromotionDetails
()
{
return
PromotionDetails
;
}
public
void
setPromotionDetails
(
Map
<
String
,
Object
>
promotionDetails
)
{
PromotionDetails
=
promotionDetails
;
}
public
Map
<
String
,
Object
>
getAwards
()
{
return
Awards
;
}
public
void
setAwards
(
Map
<
String
,
Object
>
awards
)
{
Awards
=
awards
;
}
@Override
public
String
toString
()
{
return
"Promotions [PromotionDetails="
+
PromotionDetails
+
", Awards="
+
Awards
+
"]"
;
}
}
omd-checkout-service/src/main/resources/Order.json
0 → 100644
View file @
f6ec77f5
{
"orderNum"
:
"1000A1BX"
,
"orderDate"
:
"2020-04-15T13:33:15.657-05:00"
,
"currency"
:
"INR"
,
"shipMethod"
:
"1"
,
"customerId"
:
"189359"
,
"customerType"
:
"01"
,
"promotions"
:
{
"promotionDetails"
:
{
"promotionDesc"
:
"Electronic Items Ship Free"
,
"promotionApplied"
:
"false"
,
"awards"
:
{
"awardId"
:
"1000"
,
"awardAmt"
:
"0.00"
}
}
},
"gift"
:
"false"
,
"lineItem"
:
{
"lineItemNumber"
:
"5475"
,
"skuNumber"
:
"22222222"
,
"itemColorDesc"
:
"White"
,
"size"
:
"6"
,
"orderedQty"
:
"2"
,
"productName"
:
"Apple Mobile"
,
"itemType"
:
"7"
,
"shipChrgApplInd"
:
"true"
,
"estimatedShipDate"
:
"2020-04-15T00:00:00-05:00"
,
"linePriceInfo"
:
{
"listPrice"
:
"29.50"
,
"retailPrice"
:
"29.50"
,
"unitPrice"
:
"20.00"
,
"linePriceType"
:
"03"
},
"lineTax"
:
{
"chargeCategory"
:
"Price"
,
"chargeName"
:
"Price"
,
"taxName"
:
"SalesTax"
,
"tax"
:
"3.40"
,
"taxPercentage"
:
"8.50"
,
"taxCode"
:
"C1"
,
"unitTaxAmount"
:
"1.70"
}
},
"shippingInfo"
:
{
"vaildShipTo"
:
"true"
,
"maxDaysToDeliver"
:
"9"
,
"minDaysToDeliver"
:
"6"
},
"shipTo"
:
{
"firstName"
:
"Narendra"
,
"lastName"
:
"Modi"
,
"addressLine1"
:
"2 Folsom St"
,
"city"
:
"Delhi"
,
"state"
:
"DL"
,
"zipCode"
:
"110001"
,
"country"
:
"IN"
,
"mobile"
:
"9988776655"
,
"eMailID"
:
"modi@india.com"
,
"residentialAddr"
:
"false"
},
"billingTo"
:
{
"firstName"
:
"Narendra"
,
"fastName"
:
"Modi"
,
"addressLine1"
:
"2 Folsom St"
,
"city"
:
"Delhi"
,
"state"
:
"DL"
,
"zipCode"
:
"110001"
,
"country"
:
"IN"
,
"mobile"
:
"9988776655"
,
"eMailID"
:
"modi@india.com"
,
"residentialAddr"
:
"false"
},
"orderCharges"
:
{
"ChargeAmount"
:
"10.00"
,
"ChargeCategory"
:
"Ship"
,
"ChargeName"
:
"Ship"
},
"orderTaxes"
:
{
"ChargeCategory"
:
"Shipping"
,
"TaxName"
:
"GST"
,
"Tax"
:
"0.00"
,
"taxCode"
:
"C1"
,
"TaxPercentage"
:
"12"
},
"paymentMethod"
:
{
"paymetMethod"
:
"CC"
,
"creditCardNo"
:
"12345678987665"
,
"creditCardType"
:
"VISA"
,
"displayCreditCardNo"
:
"8277"
,
"paymentStatus"
:
"AUTH"
,
"paymentDetail"
:
{
"TransactionId"
:
"021361475199"
,
"ProcessedAmount"
:
"1000.00"
,
"RequestAmount"
:
"1000.00"
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment