Skip to content

Commit

Permalink
data collector app
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugene Istrati committed May 10, 2024
1 parent 52ba458 commit c698bc3
Show file tree
Hide file tree
Showing 33 changed files with 1,721 additions and 251 deletions.
31 changes: 31 additions & 0 deletions app/data-collector/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Usage
#
# To build image -
# finch build -t fraud-app .
# OR
# docker build -t fraud-app .

# To Run
# finch run -it --rm fraud-app
# OR
# docker run -it --rm fraud-app

# Build stage
#
FROM maven AS build
ENV HOME=/usr/app
RUN mkdir -p $HOME
WORKDIR $HOME
ADD . $HOME
RUN --mount=type=cache,target=/root/.m2 mvn -f $HOME/pom.xml clean compile assembly:single

#
# Package stage
#
FROM public.ecr.aws/amazoncorretto/amazoncorretto:22-headless
ARG JAR_FILE=/usr/app/target/*.jar
COPY --from=build $JAR_FILE /app/runner.jar
RUN mkdir /root/.aws
ADD credentials /root/.aws
EXPOSE 8080
#ENTRYPOINT java -jar /app/runner.jar
15 changes: 15 additions & 0 deletions app/data-collector/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
**Push image to ECR**
1. Ensure repo is created. For example - payment-fraud-app

Execute -
- docker build -t payment-fraud-app --platform linux/amd64 .
- docker tag payment-fraud-app:latest public.ecr.aws/s5s3y9s1/payment-fraud-app:latest
- docker push public.ecr.aws/s5s3y9s1/payment-fraud-app:latest


Run the cron job for data collector -
In EKS Cluster -
1. cd app/data-collector/eks
2. kubectl apply -f data-collector-cron.yaml

This will run the data collector job on every 5th minute of every hour. If there are not new items to process, the job completes without processing anything.
4 changes: 4 additions & 0 deletions app/data-collector/credentials
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[default]
aws_access_key_id = XXXXXXX
aws_secret_access_key = XXXXXXXX
region = us-east-1
1 change: 1 addition & 0 deletions app/data-collector/data/card_transdata.csv

Large diffs are not rendered by default.

125 changes: 125 additions & 0 deletions app/data-collector/data/pacs.008.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8" ?>
<RequestPayload>
<AppHdr xmlns:h="urn:iso:std:iso:20022:tech:xsd:head.001.001.02">
<Fr>
<FIId>
<FinInstnId>
<BICFI>FVTOUSWX</BICFI>
</FinInstnId>
</FIId>
</Fr>
<To>
<FIId>
<FinInstnId>
<BICFI>DAIKCAGK</BICFI>
</FinInstnId>
</FIId>
</To>
<BizMsgIdr>qE5yVJIHAPxNoLiC</BizMsgIdr>
<MsgDefIdr>pacs.008.001.08</MsgDefIdr>
<BizSvc>swift.cbprplus.01</BizSvc>
<CreDt>2023-05-05</CreDt>
</AppHdr>
<Document xmlns:Doc="urn:iso:std:iso:20022:tech:xsd:pacs.008.001.08">
<FIToFICstmrCdtTrf>
<GrpHdr>
<MsgId>qE5yVJIHAPxNoLiC</MsgId>
<CreDtTm>2023-05-05T16:20:45.837-04:00</CreDtTm>
<NbOfTxs>1</NbOfTxs>
<SttlmInf>
<SttlmMtd>INDA</SttlmMtd>
</SttlmInf>
</GrpHdr>
<CdtTrfTxInf>
<PmtId>
<InstrId>og1D9i5LDuwpCEM5</InstrId>
<EndToEndId>ejLBXejVX0MCdA4r</EndToEndId>
<UETR>b94458f8-1f27-40e9-bf74-b07cbb339439</UETR>
</PmtId>
<PmtTpInf>
<InstrPrty>NORM</InstrPrty>
<CtgyPurp>
<Cd>DIVI</Cd>
</CtgyPurp>
</PmtTpInf>
<IntrBkSttlmAmt Ccy="USD">92406.00</IntrBkSttlmAmt>
<IntrBkSttlmDt>2023-05-05</IntrBkSttlmDt>
<InstdAmt Ccy="USD">92406.00</InstdAmt>
<ChrgBr>SHAR</ChrgBr>
<PrvsInstgAgt1>
<FinInstnId>
<BICFI>ABGCUSC0</BICFI>
</FinInstnId>
</PrvsInstgAgt1>
<InstgAgt>
<FinInstnId>
<BICFI>FVTOUSWX</BICFI>
</FinInstnId>
</InstgAgt>
<InstdAgt>
<FinInstnId>
<BICFI>DAIKCAGK</BICFI>
</FinInstnId>
</InstdAgt>
<IntrmyAgt1>
<FinInstnId>
<BICFI>OENQCAVU</BICFI>
</FinInstnId>
</IntrmyAgt1>
<Dbtr>
<Nm>AMERICAN BEACON FUNDS - American Beacon SIM High Yield Opportunities Fund</Nm>
<PstlAdr>
<StrtNm>C/O CT CORPORATION SYSTEM</StrtNm>
<PstCd>02110</PstCd>
<TwnNm>BOSTON</TwnNm>
<Ctry>US</Ctry>
</PstlAdr>
</Dbtr>
<DbtrAgt>
<FinInstnId>
<BICFI>WYHWUSSB</BICFI>
</FinInstnId>
</DbtrAgt>
<CdtrAgt>
<FinInstnId>
<BICFI>DKBVCAVR</BICFI>
</FinInstnId>
</CdtrAgt>
<Cdtr>
<Nm>GE Healthcare Canada Inc.</Nm>
<PstlAdr>
<StrtNm>2300 Meadowvale Boulevard</StrtNm>
<PstCd>L5N 5P9</PstCd>
<TwnNm>Mississauga</TwnNm>
<Ctry>CA</Ctry>
</PstlAdr>
</Cdtr>
<CdtrAcct>
<Id>
<Othr>
<Id>468924248622</Id>
</Othr>
</Id>
<Ccy>CAD</Ccy>
<Nm>GE Healthcare Canada Inc.</Nm>
<Prxy>
<Tp>
<Cd>EMAL</Cd>
</Tp>
<Id>webmaster-services-peter-crazy-but-oh-so-ubber-cool-english-alphabet-loverer-abcdefghijklmnopqrstuvwxyz@please-try-to.send-me-an-email-if-you-can-possibly-begin-to-remember-this-coz.this-is-the-longest-email-address-known-to-man-but-to-be-honest.this-is-such-a-stupidly-long-sub-domain-it-could-go-on-forever.pacraig.com</Id>
</Prxy>
</CdtrAcct>
<InstrForCdtrAgt>
<Cd>PHOB</Cd>
<InstrInf>Please call the creditor as soon as funds are credited to the account.The phone number is 4234421443 or 324979347. Leave a message.</InstrInf>
</InstrForCdtrAgt>
<InstrForNxtAgt>
<InstrInf>Good luck with this payment order.I love this free text field and really want to fill it with useless information</InstrInf>
</InstrForNxtAgt>
<Purp>
<Cd>COMC</Cd>
</Purp>
</CdtTrfTxInf>
</FIToFICstmrCdtTrf>
</Document>
</RequestPayload>
33 changes: 33 additions & 0 deletions app/data-collector/eks/data-collector-cron.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: batch/v1
kind: CronJob
metadata:
labels:
app: payment-fraud-detect-deploy
name: payment-data-collector
namespace: payment-fraud-detect-app
spec:
schedule: "*/5 * * * *"
jobTemplate:
spec:
template:
metadata:
labels:
job: payment-data-collector-job
spec:
containers:
- image: public.ecr.aws/s5s3y9s1/payment-fraud-app:latest
name: payment-fraud-detect-deploy
command: ["java"]
args: ["-jar", "/app/runner.jar"]
ports:
- containerPort: 8080
volumeMounts:
- name: data
mountPath: /data
resources:
restartPolicy: OnFailure
volumes:
- name: data
emptyDir:
sizeLimit: 500Mi

Loading

0 comments on commit c698bc3

Please sign in to comment.