Skip to content

Commit b086558

Browse files
committed
fix: ProcessorSummary
1 parent 1218d64 commit b086558

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

.idea/vcs.xml

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/com/bulletonrails/rinha/model/PaymentSummary.java

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,21 @@
44
import java.math.BigDecimal;
55

66
public record PaymentSummary(
7-
@JsonProperty("default") ProcessorSummary defaultProcessor,
8-
@JsonProperty("fallback") ProcessorSummary fallbackProcessor
7+
@JsonProperty("default") ProcessorSummary defaultProcessor,
8+
@JsonProperty("fallback") ProcessorSummary fallbackProcessor
99
) {
1010
public static PaymentSummary empty() {
1111
return new PaymentSummary(
12-
new ProcessorSummary(0, BigDecimal.ZERO),
13-
new ProcessorSummary(0, BigDecimal.ZERO)
12+
new ProcessorSummary(0, BigDecimal.ZERO),
13+
new ProcessorSummary(0, BigDecimal.ZERO)
1414
);
1515
}
1616

1717
public PaymentSummary add(PaymentSummary other) {
1818
return new PaymentSummary(
19-
defaultProcessor.add(other.defaultProcessor),
20-
fallbackProcessor.add(other.fallbackProcessor)
19+
defaultProcessor.add(other.defaultProcessor),
20+
fallbackProcessor.add(other.fallbackProcessor)
2121
);
2222
}
2323
}
2424

25-
public record ProcessorSummary(
26-
@JsonProperty("totalRequests") long totalRequests,
27-
@JsonProperty("totalAmount") BigDecimal totalAmount
28-
) {
29-
public ProcessorSummary add(ProcessorSummary other) {
30-
return new ProcessorSummary(
31-
totalRequests + other.totalRequests,
32-
totalAmount.add(other.totalAmount)
33-
);
34-
}
35-
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.bulletonrails.rinha.model;
2+
3+
import com.fasterxml.jackson.annotation.JsonProperty;
4+
5+
import java.math.BigDecimal;
6+
7+
public record ProcessorSummary(
8+
@JsonProperty("totalRequests") long totalRequests,
9+
@JsonProperty("totalAmount") BigDecimal totalAmount
10+
) {
11+
public ProcessorSummary add(ProcessorSummary other) {
12+
return new ProcessorSummary(
13+
totalRequests + other.totalRequests,
14+
totalAmount.add(other.totalAmount)
15+
);
16+
}
17+
}

0 commit comments

Comments
 (0)