Skip to content
Draft
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 @@ -16,8 +16,8 @@ class Order(
val validIfPending: Boolean = false,
val total: BigDecimal? = null,
val pendingTotal: BigDecimal? = null,
val payments: JSONArray = JSONArray(),
val refunds: JSONArray = JSONArray(),
val payments: JSONArray? = JSONArray(),
val refunds: JSONArray? = JSONArray(),
) {

val hasValidStatus = when (status) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,9 @@ private fun parsePendingTotal(json: JSONObject): BigDecimal? {
}

private fun parsePayments(json: JSONObject): JSONArray {
try {
return json.getJSONArray("payments")
} catch (e: JSONException) {
e.printStackTrace()
return JSONArray()
}
return json.optJSONArray("payments")
}

private fun parseRefunds(json: JSONObject): JSONArray {
try {
return json.getJSONArray("refunds")
} catch (e: JSONException) {
e.printStackTrace()
return JSONArray()
}
private fun parseRefunds(json: JSONObject): JSONArray? {
return json.optJSONArray("refunds")
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import java.util.Date;
import kotlin.Long;

CREATE TABLE Discount (
id serial AS Long PRIMARY KEY NOT NULL,
server_id bigint NOT NULL,
event_slug character varying(255) NOT NULL,
active boolean NOT NULL,
available_from DATE as Date,
available_until DATE as Date,
available_from DATE AS Date,
available_until DATE AS Date,
"position" bigint NOT NULL,
json_data text NOT NULL
);
16 changes: 16 additions & 0 deletions libpretixsync/src/main/sqldelight/postgres/migrations/111.sqm
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import java.util.Date;
import kotlin.Long;

CREATE TABLE Discount (
id serial AS Long PRIMARY KEY NOT NULL,
server_id bigint NOT NULL,
event_slug character varying(255) NOT NULL,
active boolean NOT NULL,
available_from DATE AS Date,
available_until DATE AS Date,
"position" bigint NOT NULL,
json_data text NOT NULL
);

ALTER TABLE ReceiptLine ADD line_price_gross numeric;
ALTER TABLE ReceiptLine ADD discount_id bigint;