Skip to content

Commit 1df179d

Browse files
Added missing references to MA payment and to external payment
1 parent 01cc479 commit 1df179d

File tree

9 files changed

+35
-8
lines changed

9 files changed

+35
-8
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ let res = tl
8383
beneficiary: Beneficiary::MerchantAccount {
8484
merchant_account_id: "some-merchant-account-id".to_string(),
8585
account_holder_name: None,
86+
reference: None,
87+
statement_reference: None,
8688
},
8789
},
8890
user: User {

examples/create_payment.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ async fn run() -> anyhow::Result<()> {
7676
beneficiary: Beneficiary::MerchantAccount {
7777
merchant_account_id: merchant_account.id,
7878
account_holder_name: None,
79+
reference: None,
80+
statement_reference: None,
7981
},
8082
},
8183
user: CreatePaymentUserRequest::NewUser {

src/apis/merchant_accounts/api.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ mod tests {
263263
SweepingFrequency, TransactionPayinStatus, TransactionPayoutContextCode,
264264
TransactionPayoutStatus, TransactionType,
265265
},
266-
payments::{AccountIdentifier, Currency, Remitter},
266+
payments::{AccountIdentifier, Currency, ExternalPaymentRemitter},
267267
payouts::PayoutBeneficiary,
268268
},
269269
authenticator::Authenticator,
@@ -745,7 +745,8 @@ mod tests {
745745
"sort_code": "sort-code",
746746
"account_number": "account-number"
747747
},
748-
"account_holder_name": "Mr. Holder"
748+
"account_holder_name": "Mr. Holder",
749+
"reference": "ext-payment-ref"
749750
}
750751
},
751752
{
@@ -832,12 +833,13 @@ mod tests {
832833
r#type: TransactionType::ExternalPayment {
833834
status: TransactionPayinStatus::Settled,
834835
settled_at: now,
835-
remitter: Remitter {
836+
remitter: ExternalPaymentRemitter {
836837
account_holder_name: Some("Mr. Holder".into()),
837838
account_identifier: Some(AccountIdentifier::SortCodeAccountNumber {
838839
sort_code: "sort-code".to_string(),
839840
account_number: "account-number".to_string()
840-
})
841+
}),
842+
reference: Some("ext-payment-ref".to_string())
841843
}
842844
}
843845
},

src/apis/merchant_accounts/model.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::apis::{
2-
payments::{AccountIdentifier, Currency, PaymentSource, Remitter},
2+
payments::{AccountIdentifier, Currency, ExternalPaymentRemitter, PaymentSource},
33
payouts::PayoutBeneficiary,
44
};
55
use chrono::{DateTime, SecondsFormat, Utc};
@@ -80,7 +80,7 @@ pub enum TransactionType {
8080
ExternalPayment {
8181
status: TransactionPayinStatus,
8282
settled_at: DateTime<Utc>,
83-
remitter: Remitter,
83+
remitter: ExternalPaymentRemitter,
8484
},
8585
Payout {
8686
#[serde(flatten)]

src/apis/payments/api.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ mod tests {
476476
},
477477
"beneficiary": {
478478
"type": "merchant_account",
479-
"merchant_account_id": "merchant-account-id"
479+
"merchant_account_id": "merchant-account-id",
480480
},
481481
},
482482
"user": {
@@ -509,6 +509,8 @@ mod tests {
509509
beneficiary: Beneficiary::MerchantAccount {
510510
merchant_account_id: "merchant-account-id".to_string(),
511511
account_holder_name: None,
512+
reference: None,
513+
statement_reference: None,
512514
},
513515
},
514516
user: CreatePaymentUserRequest::ExistingUser {
@@ -897,7 +899,9 @@ mod tests {
897899
},
898900
beneficiary: Beneficiary::MerchantAccount {
899901
merchant_account_id: "merchant-account-id".to_string(),
900-
account_holder_name: None
902+
account_holder_name: None,
903+
reference: None,
904+
statement_reference: None
901905
}
902906
}
903907
);

src/apis/payments/model.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ pub enum Beneficiary {
251251
MerchantAccount {
252252
merchant_account_id: String,
253253
account_holder_name: Option<String>,
254+
reference: Option<String>,
255+
statement_reference: Option<String>,
254256
},
255257
ExternalAccount {
256258
account_holder_name: String,
@@ -311,6 +313,13 @@ pub struct Remitter {
311313
pub account_identifier: Option<AccountIdentifier>,
312314
}
313315

316+
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
317+
pub struct ExternalPaymentRemitter {
318+
pub account_holder_name: Option<String>,
319+
pub account_identifier: Option<AccountIdentifier>,
320+
pub reference: Option<String>,
321+
}
322+
314323
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
315324
pub struct ProviderFilter {
316325
pub countries: Option<Vec<CountryCode>>,

src/lib.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
//! beneficiary: Beneficiary::MerchantAccount {
6565
//! merchant_account_id: "some-merchant-account-id".to_string(),
6666
//! account_holder_name: None,
67+
//! reference: None,
68+
//! statement_reference: None,
6769
//! },
6870
//! },
6971
//! user: CreatePaymentUserRequest::NewUser {

tests/integration_tests/helpers.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ pub async fn create_closed_loop_payment(
3434
beneficiary: Beneficiary::MerchantAccount {
3535
merchant_account_id: ctx.merchant_account_gbp_id.clone(),
3636
account_holder_name: None,
37+
reference: None,
38+
statement_reference: None,
3739
},
3840
},
3941
user: CreatePaymentUserRequest::NewUser {

tests/integration_tests/payments.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ async fn hpp_link_returns_200() {
6161
beneficiary: Beneficiary::MerchantAccount {
6262
merchant_account_id: ctx.merchant_account_gbp_id.clone(),
6363
account_holder_name: None,
64+
reference: None,
65+
statement_reference: None,
6466
},
6567
},
6668
user: CreatePaymentUserRequest::NewUser {
@@ -193,6 +195,8 @@ impl CreatePaymentScenario {
193195
ScenarioBeneficiary::ClosedLoop => Beneficiary::MerchantAccount {
194196
merchant_account_id: ctx.merchant_account_gbp_id.clone(),
195197
account_holder_name: None,
198+
reference: Some("Reference".to_string()),
199+
statement_reference: Some("StReference".to_string()),
196200
},
197201
ScenarioBeneficiary::OpenLoop {
198202
ref account_identifier,

0 commit comments

Comments
 (0)