Add idempotency key to invoices
This commit is contained in:
parent
59a4306722
commit
e649a0c3b1
|
|
@ -253,6 +253,10 @@ abstract class InvoiceEntity extends Object
|
||||||
@memoized
|
@memoized
|
||||||
int get hashCode;
|
int get hashCode;
|
||||||
|
|
||||||
|
@nullable
|
||||||
|
@BuiltValueField(wireName: 'idempotency_key')
|
||||||
|
String get idempotencyKey;
|
||||||
|
|
||||||
InvoiceEntity moveLineItem(int oldIndex, int newIndex) {
|
InvoiceEntity moveLineItem(int oldIndex, int newIndex) {
|
||||||
final lineItem = lineItems[oldIndex];
|
final lineItem = lineItems[oldIndex];
|
||||||
InvoiceEntity invoice = rebuild((b) => b..lineItems.removeAt(oldIndex));
|
InvoiceEntity invoice = rebuild((b) => b..lineItems.removeAt(oldIndex));
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,13 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
|
||||||
serializers.serialize(object.id, specifiedType: const FullType(String)),
|
serializers.serialize(object.id, specifiedType: const FullType(String)),
|
||||||
];
|
];
|
||||||
Object value;
|
Object value;
|
||||||
|
value = object.idempotencyKey;
|
||||||
|
if (value != null) {
|
||||||
|
result
|
||||||
|
..add('idempotency_key')
|
||||||
|
..add(serializers.serialize(value,
|
||||||
|
specifiedType: const FullType(String)));
|
||||||
|
}
|
||||||
value = object.autoBill;
|
value = object.autoBill;
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
result
|
result
|
||||||
|
|
@ -432,6 +439,10 @@ class _$InvoiceEntitySerializer implements StructuredSerializer<InvoiceEntity> {
|
||||||
iterator.moveNext();
|
iterator.moveNext();
|
||||||
final Object value = iterator.current;
|
final Object value = iterator.current;
|
||||||
switch (key) {
|
switch (key) {
|
||||||
|
case 'idempotency_key':
|
||||||
|
result.idempotencyKey = serializers.deserialize(value,
|
||||||
|
specifiedType: const FullType(String)) as String;
|
||||||
|
break;
|
||||||
case 'amount':
|
case 'amount':
|
||||||
result.amount = serializers.deserialize(value,
|
result.amount = serializers.deserialize(value,
|
||||||
specifiedType: const FullType(double)) as double;
|
specifiedType: const FullType(double)) as double;
|
||||||
|
|
@ -1406,6 +1417,8 @@ class InvoiceItemResponseBuilder
|
||||||
}
|
}
|
||||||
|
|
||||||
class _$InvoiceEntity extends InvoiceEntity {
|
class _$InvoiceEntity extends InvoiceEntity {
|
||||||
|
@override
|
||||||
|
final String idempotencyKey;
|
||||||
@override
|
@override
|
||||||
final double amount;
|
final double amount;
|
||||||
@override
|
@override
|
||||||
|
|
@ -1559,7 +1572,8 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
(new InvoiceEntityBuilder()..update(updates)).build();
|
(new InvoiceEntityBuilder()..update(updates)).build();
|
||||||
|
|
||||||
_$InvoiceEntity._(
|
_$InvoiceEntity._(
|
||||||
{this.amount,
|
{this.idempotencyKey,
|
||||||
|
this.amount,
|
||||||
this.balance,
|
this.balance,
|
||||||
this.paidToDate,
|
this.paidToDate,
|
||||||
this.clientId,
|
this.clientId,
|
||||||
|
|
@ -1750,6 +1764,7 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
if (identical(other, this)) return true;
|
if (identical(other, this)) return true;
|
||||||
return other is InvoiceEntity &&
|
return other is InvoiceEntity &&
|
||||||
|
idempotencyKey == other.idempotencyKey &&
|
||||||
amount == other.amount &&
|
amount == other.amount &&
|
||||||
balance == other.balance &&
|
balance == other.balance &&
|
||||||
paidToDate == other.paidToDate &&
|
paidToDate == other.paidToDate &&
|
||||||
|
|
@ -1845,7 +1860,7 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc(
|
$jc(
|
||||||
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, amount.hashCode), balance.hashCode), paidToDate.hashCode), clientId.hashCode), projectId.hashCode), expenseId.hashCode), vendorId.hashCode), subscriptionId.hashCode), statusId.hashCode), number.hashCode), discount.hashCode), poNumber.hashCode), date.hashCode), dueDate.hashCode), publicNotes.hashCode), privateNotes.hashCode), terms.hashCode), footer.hashCode), designId.hashCode), usesInclusiveTaxes.hashCode), taxName1.hashCode), taxRate1.hashCode), taxName2.hashCode), taxRate2.hashCode), taxName3.hashCode), taxRate3.hashCode), isAmountDiscount.hashCode), partial.hashCode), taxAmount.hashCode), partialDueDate.hashCode), autoBill.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), customSurcharge1.hashCode), customSurcharge2.hashCode), customSurcharge3.hashCode), customSurcharge4.hashCode), customTaxes1.hashCode), customTaxes2.hashCode), customTaxes3.hashCode), customTaxes4.hashCode), exchangeRate.hashCode), reminder1Sent.hashCode), reminder2Sent.hashCode), reminder3Sent.hashCode), reminderLastSent.hashCode), frequencyId.hashCode), lastSentDate.hashCode), nextSendDate.hashCode), remainingCycles.hashCode), dueDateDays.hashCode),
|
$jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc($jc(0, idempotencyKey.hashCode), amount.hashCode), balance.hashCode), paidToDate.hashCode), clientId.hashCode), projectId.hashCode), expenseId.hashCode), vendorId.hashCode), subscriptionId.hashCode), statusId.hashCode), number.hashCode), discount.hashCode), poNumber.hashCode), date.hashCode), dueDate.hashCode), publicNotes.hashCode), privateNotes.hashCode), terms.hashCode), footer.hashCode), designId.hashCode), usesInclusiveTaxes.hashCode), taxName1.hashCode), taxRate1.hashCode), taxName2.hashCode), taxRate2.hashCode), taxName3.hashCode), taxRate3.hashCode), isAmountDiscount.hashCode), partial.hashCode), taxAmount.hashCode), partialDueDate.hashCode), autoBill.hashCode), customValue1.hashCode), customValue2.hashCode), customValue3.hashCode), customValue4.hashCode), customSurcharge1.hashCode), customSurcharge2.hashCode), customSurcharge3.hashCode), customSurcharge4.hashCode), customTaxes1.hashCode), customTaxes2.hashCode), customTaxes3.hashCode), customTaxes4.hashCode), exchangeRate.hashCode), reminder1Sent.hashCode), reminder2Sent.hashCode), reminder3Sent.hashCode), reminderLastSent.hashCode), frequencyId.hashCode), lastSentDate.hashCode), nextSendDate.hashCode), remainingCycles.hashCode), dueDateDays.hashCode),
|
||||||
invoiceId.hashCode),
|
invoiceId.hashCode),
|
||||||
recurringId.hashCode),
|
recurringId.hashCode),
|
||||||
autoBillEnabled.hashCode),
|
autoBillEnabled.hashCode),
|
||||||
|
|
@ -1870,6 +1885,7 @@ class _$InvoiceEntity extends InvoiceEntity {
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return (newBuiltValueToStringHelper('InvoiceEntity')
|
return (newBuiltValueToStringHelper('InvoiceEntity')
|
||||||
|
..add('idempotencyKey', idempotencyKey)
|
||||||
..add('amount', amount)
|
..add('amount', amount)
|
||||||
..add('balance', balance)
|
..add('balance', balance)
|
||||||
..add('paidToDate', paidToDate)
|
..add('paidToDate', paidToDate)
|
||||||
|
|
@ -1952,6 +1968,11 @@ class InvoiceEntityBuilder
|
||||||
implements Builder<InvoiceEntity, InvoiceEntityBuilder> {
|
implements Builder<InvoiceEntity, InvoiceEntityBuilder> {
|
||||||
_$InvoiceEntity _$v;
|
_$InvoiceEntity _$v;
|
||||||
|
|
||||||
|
String _idempotencyKey;
|
||||||
|
String get idempotencyKey => _$this._idempotencyKey;
|
||||||
|
set idempotencyKey(String idempotencyKey) =>
|
||||||
|
_$this._idempotencyKey = idempotencyKey;
|
||||||
|
|
||||||
double _amount;
|
double _amount;
|
||||||
double get amount => _$this._amount;
|
double get amount => _$this._amount;
|
||||||
set amount(double amount) => _$this._amount = amount;
|
set amount(double amount) => _$this._amount = amount;
|
||||||
|
|
@ -2283,6 +2304,7 @@ class InvoiceEntityBuilder
|
||||||
InvoiceEntityBuilder get _$this {
|
InvoiceEntityBuilder get _$this {
|
||||||
final $v = _$v;
|
final $v = _$v;
|
||||||
if ($v != null) {
|
if ($v != null) {
|
||||||
|
_idempotencyKey = $v.idempotencyKey;
|
||||||
_amount = $v.amount;
|
_amount = $v.amount;
|
||||||
_balance = $v.balance;
|
_balance = $v.balance;
|
||||||
_paidToDate = $v.paidToDate;
|
_paidToDate = $v.paidToDate;
|
||||||
|
|
@ -2379,6 +2401,7 @@ class InvoiceEntityBuilder
|
||||||
try {
|
try {
|
||||||
_$result = _$v ??
|
_$result = _$v ??
|
||||||
new _$InvoiceEntity._(
|
new _$InvoiceEntity._(
|
||||||
|
idempotencyKey: idempotencyKey,
|
||||||
amount: BuiltValueNullFieldError.checkNotNull(
|
amount: BuiltValueNullFieldError.checkNotNull(
|
||||||
amount, 'InvoiceEntity', 'amount'),
|
amount, 'InvoiceEntity', 'amount'),
|
||||||
balance: BuiltValueNullFieldError.checkNotNull(
|
balance: BuiltValueNullFieldError.checkNotNull(
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,8 @@ InvoiceEntity _clearEditing(InvoiceEntity invoice, dynamic action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceEntity _updateEditing(InvoiceEntity invoice, dynamic action) {
|
InvoiceEntity _updateEditing(InvoiceEntity invoice, dynamic action) {
|
||||||
return action.invoice;
|
return (action.invoice as InvoiceEntity)
|
||||||
|
.rebuild((b) => b..idempotencyKey = BaseEntity.nextIdempotencyKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
InvoiceEntity _addInvoiceItem(InvoiceEntity invoice, AddInvoiceItem action) {
|
InvoiceEntity _addInvoiceItem(InvoiceEntity invoice, AddInvoiceItem action) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue