@@ -204,12 +204,20 @@ impl TryFrom<&Option<pii::SecretSerdeValue>> for BraintreeMeta {
204
204
}
205
205
}
206
206
207
+ #[ derive( Debug , Serialize ) ]
208
+ #[ serde( rename_all = "camelCase" ) ]
209
+ pub struct CustomerBody {
210
+ email : pii:: Email ,
211
+ }
212
+
207
213
#[ derive( Debug , Serialize ) ]
208
214
#[ serde( rename_all = "camelCase" ) ]
209
215
pub struct RegularTransactionBody {
210
216
amount : StringMajorUnit ,
211
217
merchant_account_id : Secret < String > ,
212
218
channel : String ,
219
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
220
+ customer_details : Option < CustomerBody > ,
213
221
}
214
222
215
223
#[ derive( Debug , Serialize ) ]
@@ -218,6 +226,8 @@ pub struct VaultTransactionBody {
218
226
amount : StringMajorUnit ,
219
227
merchant_account_id : Secret < String > ,
220
228
vault_payment_method_after_transacting : TransactionTiming ,
229
+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
230
+ customer_details : Option < CustomerBody > ,
221
231
}
222
232
223
233
#[ derive( Debug , Serialize ) ]
257
267
amount : item. amount . to_owned ( ) ,
258
268
merchant_account_id : metadata. merchant_account_id ,
259
269
channel : CHANNEL_CODE . to_string ( ) ,
270
+ customer_details : None ,
260
271
} ) ,
261
272
) ;
262
273
Ok ( Self {
@@ -1745,6 +1756,11 @@ impl
1745
1756
vault_payment_method_after_transacting : TransactionTiming {
1746
1757
when : "ALWAYS" . to_string ( ) ,
1747
1758
} ,
1759
+ customer_details : item
1760
+ . router_data
1761
+ . get_billing_email ( )
1762
+ . ok ( )
1763
+ . map ( |email| CustomerBody { email } ) ,
1748
1764
} ) ,
1749
1765
)
1750
1766
} else {
@@ -1757,6 +1773,11 @@ impl
1757
1773
amount : item. amount . to_owned ( ) ,
1758
1774
merchant_account_id : metadata. merchant_account_id ,
1759
1775
channel : CHANNEL_CODE . to_string ( ) ,
1776
+ customer_details : item
1777
+ . router_data
1778
+ . get_billing_email ( )
1779
+ . ok ( )
1780
+ . map ( |email| CustomerBody { email } ) ,
1760
1781
} ) ,
1761
1782
)
1762
1783
} ;
@@ -1844,6 +1865,11 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsCompleteAuthorizeRouterData>>
1844
1865
vault_payment_method_after_transacting : TransactionTiming {
1845
1866
when : "ALWAYS" . to_string ( ) ,
1846
1867
} ,
1868
+ customer_details : item
1869
+ . router_data
1870
+ . get_billing_email ( )
1871
+ . ok ( )
1872
+ . map ( |email| CustomerBody { email } ) ,
1847
1873
} ) ,
1848
1874
)
1849
1875
} else {
@@ -1856,6 +1882,11 @@ impl TryFrom<&BraintreeRouterData<&types::PaymentsCompleteAuthorizeRouterData>>
1856
1882
amount : item. amount . to_owned ( ) ,
1857
1883
merchant_account_id : metadata. merchant_account_id ,
1858
1884
channel : CHANNEL_CODE . to_string ( ) ,
1885
+ customer_details : item
1886
+ . router_data
1887
+ . get_billing_email ( )
1888
+ . ok ( )
1889
+ . map ( |email| CustomerBody { email } ) ,
1859
1890
} ) ,
1860
1891
)
1861
1892
} ;
0 commit comments