Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: remove custom variables for hw that are not needed #256

Merged
merged 2 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ public class Account extends MdxBase<Account> {
private BigDecimal creditLimit;
@XmlElement(name = "currency_code")
private String currencyCode;
@XmlElement(name = "daily_deposit_limit_current")
private Double dailyDepositLimitCurrent;
@XmlElement(name = "daily_deposit_limit_total")
private Double dailyDepositLimitTotal;
@XmlElement(name = "day_payment_is_due")
private LocalDate dayPaymentIsDue;
@XmlElement(name = "guid")
Expand All @@ -45,10 +41,6 @@ public class Account extends MdxBase<Account> {
private BigDecimal holdTotal;
@XmlElement(name = "id")
private String id;
@XmlElement(name = "interest_paid_previous_year")
private Double interestPaidPreviousYear;
@XmlElement(name = "interest_paid_ytd")
private Double interestPaidYtd;
@XmlElement(name = "interest_rate")
private Double interestRate;
@XmlElement(name = "is_closed")
Expand All @@ -63,10 +55,6 @@ public class Account extends MdxBase<Account> {
private LocalDate lastPaymentOn;
@XmlElement(name = "loan_amount")
private BigDecimal loanAmount;
@XmlElement(name = "monthly_deposit_limit_current")
private Double monthlyDepositLimitCurrent;
@XmlElement(name = "monthly_deposit_limit_total")
private Double monthlyDepositLimitTotal;
@XmlElement(name = "matures_at")
private Long maturesAt;
@XmlElement(name = "matures_on")
Expand All @@ -87,8 +75,6 @@ public class Account extends MdxBase<Account> {
private String name;
@XmlElement(name = "nickname")
private String nickname;
@XmlElement(name = "next_payment")
private Double nextPayment;
@XmlElement(name = "original_balance")
private BigDecimal originalBalance;
@XmlElement(name = "past_due_amount")
Expand All @@ -105,8 +91,6 @@ public class Account extends MdxBase<Account> {
private BigDecimal pendingBalance;
@XmlElement(name = "pending_transactions_total")
private BigDecimal pendingTransactionsTotal;
@XmlElement(name = "principal_balance")
private Double principalBalance;
@XmlElement(name = "routing_number")
private String routingNumber;
@Deprecated
Expand All @@ -120,8 +104,6 @@ public class Account extends MdxBase<Account> {
private BigDecimal statementBalance;
@XmlElement(name = "statement_closed_on")
private LocalDate statementClosedOn;
@XmlElement(name = "statement_late_charges")
private Double statementLateCharges;
@XmlElement(name = "subtype")
private String subtype;
@XmlElement(name = "type")
Expand Down Expand Up @@ -231,22 +213,6 @@ public final void setCurrencyCode(String newCurrencyCode) {
this.currencyCode = newCurrencyCode;
}

public final Double getDailyDepositLimitCurrent() {
return dailyDepositLimitCurrent;
}

public final void setDailyDepositLimitCurrent(Double dailyDepositLimitCurrent) {
this.dailyDepositLimitCurrent = dailyDepositLimitCurrent;
}

public final Double getDailyDepositLimitTotal() {
return dailyDepositLimitTotal;
}

public final void setDailyDepositLimitTotal(Double dailyDepositLimitTotal) {
this.dailyDepositLimitTotal = dailyDepositLimitTotal;
}

public final LocalDate getDayPaymentIsDue() {
return dayPaymentIsDue;
}
Expand Down Expand Up @@ -287,22 +253,6 @@ public final void setId(String newId) {
this.id = newId;
}

public final Double getInterestPaidPreviousYear() {
return interestPaidPreviousYear;
}

public final void setInterestPaidPreviousYear(Double interestPaidPreviousYear) {
this.interestPaidPreviousYear = interestPaidPreviousYear;
}

public final Double getInterestPaidYtd() {
return interestPaidYtd;
}

public final void setInterestPaidYtd(Double interestPaidYtd) {
this.interestPaidYtd = interestPaidYtd;
}

public final Double getInterestRate() {
return interestRate;
}
Expand Down Expand Up @@ -359,22 +309,6 @@ public final void setLoanAmount(BigDecimal loanAmount) {
this.loanAmount = loanAmount;
}

public final Double getMonthlyDepositLimitCurrent() {
return monthlyDepositLimitCurrent;
}

public final void setMonthlyDepositLimitCurrent(Double monthlyDepositLimitCurrent) {
this.monthlyDepositLimitCurrent = monthlyDepositLimitCurrent;
}

public final Double getMonthlyDepositLimitTotal() {
return monthlyDepositLimitTotal;
}

public final void setMonthlyDepositLimitTotal(Double monthlyDepositLimitTotal) {
this.monthlyDepositLimitTotal = monthlyDepositLimitTotal;
}

public final Long getMaturesAt() {
return maturesAt;
}
Expand Down Expand Up @@ -455,14 +389,6 @@ public final void setNickname(String newNickname) {
this.nickname = newNickname;
}

public final Double getNextPayment() {
return nextPayment;
}

public final void setNextPayment(Double nextPayment) {
this.nextPayment = nextPayment;
}

public final BigDecimal getOriginalBalance() {
return originalBalance;
}
Expand Down Expand Up @@ -527,14 +453,6 @@ public final void setPendingTransactionsTotal(BigDecimal pendingTransactionsTota
this.pendingTransactionsTotal = pendingTransactionsTotal;
}

public final Double getPrincipalBalance() {
return principalBalance;
}

public final void setPrincipalBalance(Double principalBalance) {
this.principalBalance = principalBalance;
}

public final String getRoutingNumber() {
return routingNumber;
}
Expand Down Expand Up @@ -583,14 +501,6 @@ public final void setStatementClosedOn(LocalDate newStatementClosedOn) {
this.statementClosedOn = newStatementClosedOn;
}

public final Double getStatementLateCharges() {
return statementLateCharges;
}

public final void setStatementLateCharges(Double statementLateCharges) {
this.statementLateCharges = statementLateCharges;
}

public final String getSubtype() {
return subtype;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.mx.path.extensions

class StringStaticExtension {

static String sanitizeXml(final StringWriter self) {
sanitizeXml(self.toString())
}

static String sanitizeXml(final String self) {
self.replaceAll("\n","").replaceAll("\r","").replaceAll("\t","").replaceAll(">\\s+<", "")
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mx.path.model.mdx.model.ondemand

import static com.mx.path.extensions.StringStaticExtension.sanitizeXml

import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.SerializerProvider
import com.fasterxml.jackson.dataformat.xml.XmlFactory
Expand Down Expand Up @@ -52,12 +54,14 @@ class MdxOnDemandMdxListSerializerTest extends Specification implements WithMock
generator.flush()

then:
stringWriter.toString() == "<Transaction>\n" +
def expectedResponse= "<Transaction>\n" +
" <wrapped>false</wrapped>\n" +
" <amount>9.99</amount>\n" +
" <description>Fees</description>\n" +
" <id>T-123</id>\n" +
"</Transaction>\n"

sanitizeXml(stringWriter) == sanitizeXml(expectedResponse)
}

def "wrapper name, empty interacts with generator"() {
Expand All @@ -83,9 +87,11 @@ class MdxOnDemandMdxListSerializerTest extends Specification implements WithMock
generator.flush()

then:
stringWriter.toString() == "<mdx version=\"5.0\">\n" +
def expectedResponse= "<mdx version=\"5.0\">\n" +
"<transactions>\n</transactions>\n" +
"</mdx>\n"

sanitizeXml(stringWriter) == sanitizeXml(expectedResponse)
}

def "wraps list interacts with generator"() {
Expand All @@ -108,7 +114,7 @@ class MdxOnDemandMdxListSerializerTest extends Specification implements WithMock
generator.flush()

then:
stringWriter.toString() == "<mdx version=\"5.0\">\n" +
def expectedResponse= "<mdx version=\"5.0\">\n" +
"<transactions>\n" +
"<Transaction>\n" +
" <wrapped>false</wrapped>\n" +
Expand All @@ -124,6 +130,8 @@ class MdxOnDemandMdxListSerializerTest extends Specification implements WithMock
"</Transaction>\n" +
"</transactions>\n" +
"</mdx>\n"

sanitizeXml(stringWriter) == sanitizeXml(expectedResponse)
}

def "wraps list interacts with generator applies mixins"() {
Expand All @@ -149,7 +157,7 @@ class MdxOnDemandMdxListSerializerTest extends Specification implements WithMock
subject.serialize(list, (JsonGenerator) generator, (SerializerProvider) null)

then:
stringWriter.toString() == "<mdx version=\"5.0\">\n" +
def expectedResponse= "<mdx version=\"5.0\">\n" +
"<accounts>\n" +
"<account>\n" +
" <balance>9.99</balance>\n" +
Expand All @@ -161,5 +169,7 @@ class MdxOnDemandMdxListSerializerTest extends Specification implements WithMock
"</account>\n"
"</accounts>\n" +
"</mdx>\n"

sanitizeXml(stringWriter) == sanitizeXml(expectedResponse)
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.mx.path.model.mdx.model.ondemand

import static com.mx.path.extensions.StringStaticExtension.sanitizeXml

import java.time.LocalDate

import com.fasterxml.jackson.core.JsonGenerator
Expand Down Expand Up @@ -47,12 +49,14 @@ class MdxOnDemandSerializerTest extends Specification implements WithMockery {
generator.flush()

then:
stringWriter.toString() == "<Account>\n" +
def expectedResponse = "<Account>\n" +
" <wrapped>false</wrapped>\n" +
" <balance>0.09</balance>\n" +
" <id>A-123</id>\n" +
" <name>Checking</name>\n" +
"</Account>\n"

sanitizeXml(stringWriter) == sanitizeXml(expectedResponse)
}

def "wrapped, interacts with generator"() {
Expand All @@ -69,14 +73,16 @@ class MdxOnDemandSerializerTest extends Specification implements WithMockery {
generator.flush()

then:
stringWriter.toString() == "<mdx version=\"5.0\">\n" +
def expectedResponse = "<mdx version=\"5.0\">\n" +
"<Account>\n" +
" <wrapped>true</wrapped>\n" +
" <balance>0.09</balance>\n" +
" <id>A-123</id>\n" +
" <name>Checking</name>\n" +
"</Account>\n" +
"</mdx>\n"

sanitizeXml(stringWriter) == sanitizeXml(expectedResponse)
}

def "applies mixins"() {
Expand All @@ -96,14 +102,16 @@ class MdxOnDemandSerializerTest extends Specification implements WithMockery {
generator.flush()

then:
stringWriter.toString() == "<mdx version=\"5.0\">\n" +
def expectedResponse = "<mdx version=\"5.0\">\n" +
"<account>\n" +
" <balance>0.09</balance>\n" +
" <id>A-123</id>\n" +
" <name>Checking</name>\n" +
" <payment_due_on>2020-12-05</payment_due_on>\n" +
"</account>\n" +
"</mdx>\n"

sanitizeXml(stringWriter) == sanitizeXml(expectedResponse)
}

def "accounts list mixins"() {
Expand Down Expand Up @@ -135,7 +143,7 @@ class MdxOnDemandSerializerTest extends Specification implements WithMockery {
generator.flush()

then:
stringWriter.toString() == "<mdx version=\"5.0\">\n" +
def expectedResponse = "<mdx version=\"5.0\">\n" +
"<accounts>\n" +
" <account>\n" +
" <balance>0.09</balance>\n" +
Expand All @@ -151,6 +159,8 @@ class MdxOnDemandSerializerTest extends Specification implements WithMockery {
" </account>\n" +
"</accounts>\n" +
"</mdx>\n"

sanitizeXml(stringWriter) == sanitizeXml(expectedResponse)
}

def "empty accounts list mixins"() {
Expand All @@ -167,9 +177,11 @@ class MdxOnDemandSerializerTest extends Specification implements WithMockery {
generator.flush()

then:
stringWriter.toString() == "<mdx version=\"5.0\">\n" +
def expectedResponse = "<mdx version=\"5.0\">\n" +
"<accounts/>\n" +
"</mdx>\n"

sanitizeXml(stringWriter) == sanitizeXml(expectedResponse)
}

def "serializes LocalDate to string"() {
Expand All @@ -183,10 +195,12 @@ class MdxOnDemandSerializerTest extends Specification implements WithMockery {
generator.flush()

then:
stringWriter.toString() == "<Transaction>\n" +
def expectedResponse = "<Transaction>\n" +
" <wrapped>false</wrapped>\n" +
" <posted_on>2020-01-12</posted_on>\n" +
"</Transaction>\n"

sanitizeXml(stringWriter) == sanitizeXml(expectedResponse)
}

def "serializes large amounts"() {
Expand All @@ -204,13 +218,15 @@ class MdxOnDemandSerializerTest extends Specification implements WithMockery {
generator.flush()

then:
stringWriter.toString() == "<mdx version=\"5.0\">\n" +
def expectedResponse = "<mdx version=\"5.0\">\n" +
"<Account>\n" +
" <wrapped>true</wrapped>\n" +
" <balance>30000000.00</balance>\n" +
" <id>A-123</id>\n" +
" <name>Checking</name>\n" +
"</Account>\n" +
"</mdx>\n"

sanitizeXml(stringWriter) == sanitizeXml(expectedResponse)
}
}
Loading