Skip to content

Commit

Permalink
feat(api)!: change physical_cards.status value, remove `event_subsc…
Browse files Browse the repository at this point in the history
…ription` field, add fields (#65)

change `physical_cards.status` enum value `submitted` to `active`, remove `event_subscription` property `shared_secret`, add `acknowledgement` to `ach_transfer`, add new optional parameter to `get /card_profiles`
## Migration guide
If you were referencing the `PhysicalCards.status` property `submitted`, you will now want to reference it as `active` instead. If you were previously using the `sharedSecret` property of `EventSubscription`, you will need to stop using it.
  • Loading branch information
stainless-bot authored Aug 16, 2023
1 parent d785c52 commit af0cae8
Show file tree
Hide file tree
Showing 7 changed files with 386 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ private constructor(
private val statementDescriptor: JsonField<String>,
private val status: JsonField<Status>,
private val submission: JsonField<Submission>,
private val acknowledgement: JsonField<Acknowledgement>,
private val transactionId: JsonField<String>,
private val companyDescriptiveDate: JsonField<String>,
private val companyDiscretionaryData: JsonField<String>,
Expand Down Expand Up @@ -131,10 +132,22 @@ private constructor(
/** The lifecycle status of the transfer. */
fun status(): Status = status.getRequired("status")

/** After the transfer is submitted to FedACH, this will contain supplemental details. */
/**
* After the transfer is submitted to FedACH, this will contain supplemental details. Increase
* batches transfers and submits a file to the Federal Reserve roughly every 30 minutes. The
* Federal Reserve processes ACH transfers during weekdays according to their (posted
* schedule)[https://www.frbservices.org/resources/resource-centers/same-day-ach/fedach-processing-schedule.html].
*/
fun submission(): Optional<Submission> =
Optional.ofNullable(submission.getNullable("submission"))

/**
* After the transfer is acknowledged by FedACH, this will contain supplemental details. The
* Federal Reserve sends an acknowledgement message for each file that Increase submits.
*/
fun acknowledgement(): Optional<Acknowledgement> =
Optional.ofNullable(acknowledgement.getNullable("acknowledgement"))

/** The ID for the transaction funding the transfer. */
fun transactionId(): Optional<String> =
Optional.ofNullable(transactionId.getNullable("transaction_id"))
Expand Down Expand Up @@ -260,9 +273,20 @@ private constructor(
/** The lifecycle status of the transfer. */
@JsonProperty("status") @ExcludeMissing fun _status() = status

/** After the transfer is submitted to FedACH, this will contain supplemental details. */
/**
* After the transfer is submitted to FedACH, this will contain supplemental details. Increase
* batches transfers and submits a file to the Federal Reserve roughly every 30 minutes. The
* Federal Reserve processes ACH transfers during weekdays according to their (posted
* schedule)[https://www.frbservices.org/resources/resource-centers/same-day-ach/fedach-processing-schedule.html].
*/
@JsonProperty("submission") @ExcludeMissing fun _submission() = submission

/**
* After the transfer is acknowledged by FedACH, this will contain supplemental details. The
* Federal Reserve sends an acknowledgement message for each file that Increase submits.
*/
@JsonProperty("acknowledgement") @ExcludeMissing fun _acknowledgement() = acknowledgement

/** The ID for the transaction funding the transfer. */
@JsonProperty("transaction_id") @ExcludeMissing fun _transactionId() = transactionId

Expand Down Expand Up @@ -336,6 +360,7 @@ private constructor(
statementDescriptor()
status()
submission().map { it.validate() }
acknowledgement().map { it.validate() }
transactionId()
companyDescriptiveDate()
companyDiscretionaryData()
Expand Down Expand Up @@ -377,6 +402,7 @@ private constructor(
this.statementDescriptor == other.statementDescriptor &&
this.status == other.status &&
this.submission == other.submission &&
this.acknowledgement == other.acknowledgement &&
this.transactionId == other.transactionId &&
this.companyDescriptiveDate == other.companyDescriptiveDate &&
this.companyDiscretionaryData == other.companyDiscretionaryData &&
Expand Down Expand Up @@ -413,6 +439,7 @@ private constructor(
statementDescriptor,
status,
submission,
acknowledgement,
transactionId,
companyDescriptiveDate,
companyDiscretionaryData,
Expand All @@ -432,7 +459,7 @@ private constructor(
}

override fun toString() =
"AchTransfer{accountId=$accountId, accountNumber=$accountNumber, addendum=$addendum, amount=$amount, currency=$currency, approval=$approval, cancellation=$cancellation, createdAt=$createdAt, externalAccountId=$externalAccountId, id=$id, network=$network, notificationsOfChange=$notificationsOfChange, return_=$return_, routingNumber=$routingNumber, statementDescriptor=$statementDescriptor, status=$status, submission=$submission, transactionId=$transactionId, companyDescriptiveDate=$companyDescriptiveDate, companyDiscretionaryData=$companyDiscretionaryData, companyEntryDescription=$companyEntryDescription, companyName=$companyName, funding=$funding, individualId=$individualId, individualName=$individualName, effectiveDate=$effectiveDate, standardEntryClassCode=$standardEntryClassCode, uniqueIdentifier=$uniqueIdentifier, type=$type, additionalProperties=$additionalProperties}"
"AchTransfer{accountId=$accountId, accountNumber=$accountNumber, addendum=$addendum, amount=$amount, currency=$currency, approval=$approval, cancellation=$cancellation, createdAt=$createdAt, externalAccountId=$externalAccountId, id=$id, network=$network, notificationsOfChange=$notificationsOfChange, return_=$return_, routingNumber=$routingNumber, statementDescriptor=$statementDescriptor, status=$status, submission=$submission, acknowledgement=$acknowledgement, transactionId=$transactionId, companyDescriptiveDate=$companyDescriptiveDate, companyDiscretionaryData=$companyDiscretionaryData, companyEntryDescription=$companyEntryDescription, companyName=$companyName, funding=$funding, individualId=$individualId, individualName=$individualName, effectiveDate=$effectiveDate, standardEntryClassCode=$standardEntryClassCode, uniqueIdentifier=$uniqueIdentifier, type=$type, additionalProperties=$additionalProperties}"

companion object {

Expand All @@ -458,6 +485,7 @@ private constructor(
private var statementDescriptor: JsonField<String> = JsonMissing.of()
private var status: JsonField<Status> = JsonMissing.of()
private var submission: JsonField<Submission> = JsonMissing.of()
private var acknowledgement: JsonField<Acknowledgement> = JsonMissing.of()
private var transactionId: JsonField<String> = JsonMissing.of()
private var companyDescriptiveDate: JsonField<String> = JsonMissing.of()
private var companyDiscretionaryData: JsonField<String> = JsonMissing.of()
Expand Down Expand Up @@ -491,6 +519,7 @@ private constructor(
this.statementDescriptor = achTransfer.statementDescriptor
this.status = achTransfer.status
this.submission = achTransfer.submission
this.acknowledgement = achTransfer.acknowledgement
this.transactionId = achTransfer.transactionId
this.companyDescriptiveDate = achTransfer.companyDescriptiveDate
this.companyDiscretionaryData = achTransfer.companyDiscretionaryData
Expand Down Expand Up @@ -686,14 +715,43 @@ private constructor(
@ExcludeMissing
fun status(status: JsonField<Status>) = apply { this.status = status }

/** After the transfer is submitted to FedACH, this will contain supplemental details. */
/**
* After the transfer is submitted to FedACH, this will contain supplemental details.
* Increase batches transfers and submits a file to the Federal Reserve roughly every 30
* minutes. The Federal Reserve processes ACH transfers during weekdays according to their
* (posted
* schedule)[https://www.frbservices.org/resources/resource-centers/same-day-ach/fedach-processing-schedule.html].
*/
fun submission(submission: Submission) = submission(JsonField.of(submission))

/** After the transfer is submitted to FedACH, this will contain supplemental details. */
/**
* After the transfer is submitted to FedACH, this will contain supplemental details.
* Increase batches transfers and submits a file to the Federal Reserve roughly every 30
* minutes. The Federal Reserve processes ACH transfers during weekdays according to their
* (posted
* schedule)[https://www.frbservices.org/resources/resource-centers/same-day-ach/fedach-processing-schedule.html].
*/
@JsonProperty("submission")
@ExcludeMissing
fun submission(submission: JsonField<Submission>) = apply { this.submission = submission }

/**
* After the transfer is acknowledged by FedACH, this will contain supplemental details. The
* Federal Reserve sends an acknowledgement message for each file that Increase submits.
*/
fun acknowledgement(acknowledgement: Acknowledgement) =
acknowledgement(JsonField.of(acknowledgement))

/**
* After the transfer is acknowledged by FedACH, this will contain supplemental details. The
* Federal Reserve sends an acknowledgement message for each file that Increase submits.
*/
@JsonProperty("acknowledgement")
@ExcludeMissing
fun acknowledgement(acknowledgement: JsonField<Acknowledgement>) = apply {
this.acknowledgement = acknowledgement
}

/** The ID for the transaction funding the transfer. */
fun transactionId(transactionId: String) = transactionId(JsonField.of(transactionId))

Expand Down Expand Up @@ -863,6 +921,7 @@ private constructor(
statementDescriptor,
status,
submission,
acknowledgement,
transactionId,
companyDescriptiveDate,
companyDiscretionaryData,
Expand All @@ -879,6 +938,111 @@ private constructor(
)
}

/**
* After the transfer is acknowledged by FedACH, this will contain supplemental details. The
* Federal Reserve sends an acknowledgement message for each file that Increase submits.
*/
@JsonDeserialize(builder = Acknowledgement.Builder::class)
@NoAutoDetect
class Acknowledgement
private constructor(
private val acknowledgedAt: JsonField<String>,
private val additionalProperties: Map<String, JsonValue>,
) {

private var validated: Boolean = false

private var hashCode: Int = 0

/** When the Federal Reserve acknowledged the submitted file containing this transfer. */
fun acknowledgedAt(): String = acknowledgedAt.getRequired("acknowledged_at")

/** When the Federal Reserve acknowledged the submitted file containing this transfer. */
@JsonProperty("acknowledged_at") @ExcludeMissing fun _acknowledgedAt() = acknowledgedAt

@JsonAnyGetter
@ExcludeMissing
fun _additionalProperties(): Map<String, JsonValue> = additionalProperties

fun validate(): Acknowledgement = apply {
if (!validated) {
acknowledgedAt()
validated = true
}
}

fun toBuilder() = Builder().from(this)

override fun equals(other: Any?): Boolean {
if (this === other) {
return true
}

return other is Acknowledgement &&
this.acknowledgedAt == other.acknowledgedAt &&
this.additionalProperties == other.additionalProperties
}

override fun hashCode(): Int {
if (hashCode == 0) {
hashCode = Objects.hash(acknowledgedAt, additionalProperties)
}
return hashCode
}

override fun toString() =
"Acknowledgement{acknowledgedAt=$acknowledgedAt, additionalProperties=$additionalProperties}"

companion object {

@JvmStatic fun builder() = Builder()
}

class Builder {

private var acknowledgedAt: JsonField<String> = JsonMissing.of()
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()

@JvmSynthetic
internal fun from(acknowledgement: Acknowledgement) = apply {
this.acknowledgedAt = acknowledgement.acknowledgedAt
additionalProperties(acknowledgement.additionalProperties)
}

/**
* When the Federal Reserve acknowledged the submitted file containing this transfer.
*/
fun acknowledgedAt(acknowledgedAt: String) =
acknowledgedAt(JsonField.of(acknowledgedAt))

/**
* When the Federal Reserve acknowledged the submitted file containing this transfer.
*/
@JsonProperty("acknowledged_at")
@ExcludeMissing
fun acknowledgedAt(acknowledgedAt: JsonField<String>) = apply {
this.acknowledgedAt = acknowledgedAt
}

fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.clear()
this.additionalProperties.putAll(additionalProperties)
}

@JsonAnySetter
fun putAdditionalProperty(key: String, value: JsonValue) = apply {
this.additionalProperties.put(key, value)
}

fun putAllAdditionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
this.additionalProperties.putAll(additionalProperties)
}

fun build(): Acknowledgement =
Acknowledgement(acknowledgedAt, additionalProperties.toUnmodifiable())
}
}

/**
* If your account requires approvals for transfers and the transfer was approved, this will
* contain details of the approval.
Expand Down Expand Up @@ -2687,7 +2851,12 @@ private constructor(
fun asString(): String = _value().asStringOrThrow()
}

/** After the transfer is submitted to FedACH, this will contain supplemental details. */
/**
* After the transfer is submitted to FedACH, this will contain supplemental details. Increase
* batches transfers and submits a file to the Federal Reserve roughly every 30 minutes. The
* Federal Reserve processes ACH transfers during weekdays according to their (posted
* schedule)[https://www.frbservices.org/resources/resource-centers/same-day-ach/fedach-processing-schedule.html].
*/
@JsonDeserialize(builder = Submission.Builder::class)
@NoAutoDetect
class Submission
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ private constructor(

@JvmField val PENDING_SUBMITTING = Status(JsonField.of("pending_submitting"))

@JvmField val SUBMITTED = Status(JsonField.of("submitted"))
@JvmField val ACTIVE = Status(JsonField.of("active"))

@JvmStatic fun of(value: String) = Status(JsonField.of(value))
}
Expand All @@ -970,15 +970,15 @@ private constructor(
REJECTED,
PENDING_REVIEWING,
PENDING_SUBMITTING,
SUBMITTED,
ACTIVE,
}

enum class Value {
NOT_ELIGIBLE,
REJECTED,
PENDING_REVIEWING,
PENDING_SUBMITTING,
SUBMITTED,
ACTIVE,
_UNKNOWN,
}

Expand All @@ -988,7 +988,7 @@ private constructor(
REJECTED -> Value.REJECTED
PENDING_REVIEWING -> Value.PENDING_REVIEWING
PENDING_SUBMITTING -> Value.PENDING_SUBMITTING
SUBMITTED -> Value.SUBMITTED
ACTIVE -> Value.ACTIVE
else -> Value._UNKNOWN
}

Expand All @@ -998,7 +998,7 @@ private constructor(
REJECTED -> Known.REJECTED
PENDING_REVIEWING -> Known.PENDING_REVIEWING
PENDING_SUBMITTING -> Known.PENDING_SUBMITTING
SUBMITTED -> Known.SUBMITTED
ACTIVE -> Known.ACTIVE
else -> throw IncreaseInvalidDataException("Unknown Status: $value")
}

Expand Down
Loading

0 comments on commit af0cae8

Please sign in to comment.