intent reference generation + propagation
This commit is contained in:
@@ -114,6 +114,7 @@ void main() {
|
||||
'idempotencyKey': 'idem-1',
|
||||
'quote': {
|
||||
'quoteRef': 'q-1',
|
||||
'intentRef': 'intent-1',
|
||||
'amounts': {
|
||||
'sourcePrincipal': {'amount': '10', 'currency': 'USDT'},
|
||||
'sourceDebitTotal': {'amount': '10.75', 'currency': 'USDT'},
|
||||
@@ -148,6 +149,7 @@ void main() {
|
||||
});
|
||||
|
||||
expect(response.quote.fxQuote?.pricedAtUnixMs, equals(1771945907000));
|
||||
expect(response.quote.intentRef, equals('intent-1'));
|
||||
expect(response.quote.amounts?.sourceDebitTotal?.amount, equals('10.75'));
|
||||
expect(response.quote.fees?.lines?.length, equals(1));
|
||||
});
|
||||
@@ -174,16 +176,35 @@ void main() {
|
||||
final request = InitiatePaymentsRequest(
|
||||
idempotencyKey: 'idem-3',
|
||||
quoteRef: 'q-2',
|
||||
intentRefs: const ['intent-a', 'intent-b'],
|
||||
metadata: const {'client_payment_ref': 'cp-1'},
|
||||
);
|
||||
|
||||
final json = request.toJson();
|
||||
expect(json['idempotencyKey'], equals('idem-3'));
|
||||
expect(json['quoteRef'], equals('q-2'));
|
||||
expect(json['intentRefs'], equals(const ['intent-a', 'intent-b']));
|
||||
expect(
|
||||
(json['metadata'] as Map<String, dynamic>)['client_payment_ref'],
|
||||
equals('cp-1'),
|
||||
);
|
||||
});
|
||||
|
||||
test(
|
||||
'initiate multi payments request supports single intentRef selector',
|
||||
() {
|
||||
final request = InitiatePaymentsRequest(
|
||||
idempotencyKey: 'idem-4',
|
||||
quoteRef: 'q-2',
|
||||
intentRef: 'intent-single',
|
||||
);
|
||||
|
||||
final json = request.toJson();
|
||||
expect(json['idempotencyKey'], equals('idem-4'));
|
||||
expect(json['quoteRef'], equals('q-2'));
|
||||
expect(json['intentRef'], equals('intent-single'));
|
||||
expect(json.containsKey('intentRefs'), isFalse);
|
||||
},
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user