Skip to content

Commit 6f98a4a

Browse files
committed
chore: make changes to diesel models
1 parent dc282ff commit 6f98a4a

File tree

6 files changed

+25
-25
lines changed

6 files changed

+25
-25
lines changed

crates/diesel_models/src/customers.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl From<CustomerNew> for Customer {
114114
default_shipping_address: customer_new.default_shipping_address,
115115
id: customer_new.id,
116116
version: customer_new.version,
117-
status: customer_new.status,
117+
status: Some(customer_new.status),
118118
}
119119
}
120120
}
@@ -164,7 +164,7 @@ pub struct Customer {
164164
pub merchant_reference_id: Option<common_utils::id_type::CustomerId>,
165165
pub default_billing_address: Option<Encryption>,
166166
pub default_shipping_address: Option<Encryption>,
167-
pub status: DeleteStatus,
167+
pub status: Option<DeleteStatus>,
168168
pub id: common_utils::id_type::GlobalCustomerId,
169169
}
170170

@@ -276,7 +276,7 @@ impl CustomerUpdateInternal {
276276
.map_or(source.default_billing_address, Some),
277277
default_shipping_address: default_shipping_address
278278
.map_or(source.default_shipping_address, Some),
279-
status: status.unwrap_or(source.status),
279+
status: status.or(source.status),
280280
..source
281281
}
282282
}

crates/diesel_models/src/merchant_connector_account.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub struct MerchantConnectorAccount {
9191
pub connector_webhook_details: Option<pii::SecretSerdeValue>,
9292
#[diesel(deserialize_as = super::OptionalDieselArray<pii::SecretSerdeValue>)]
9393
pub frm_config: Option<Vec<pii::SecretSerdeValue>>,
94-
pub profile_id: id_type::ProfileId,
94+
pub profile_id: Option<id_type::ProfileId>,
9595
#[diesel(deserialize_as = super::OptionalDieselArray<String>)]
9696
pub applepay_verified_domains: Option<Vec<String>>,
9797
pub pm_auth_config: Option<pii::SecretSerdeValue>,

crates/diesel_models/src/payment_attempt.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ pub struct PaymentAttempt {
4848
pub error_message: Option<String>,
4949
pub surcharge_amount: Option<MinorUnit>,
5050
pub payment_method_id: Option<id_type::GlobalPaymentMethodId>,
51-
pub authentication_type: storage_enums::AuthenticationType,
51+
pub authentication_type: Option<storage_enums::AuthenticationType>,
5252
#[serde(with = "common_utils::custom_serde::iso8601")]
5353
pub created_at: PrimitiveDateTime,
5454
#[serde(with = "common_utils::custom_serde::iso8601")]
@@ -73,7 +73,7 @@ pub struct PaymentAttempt {
7373
pub encoded_data: Option<masking::Secret<String>>,
7474
pub unified_code: Option<String>,
7575
pub unified_message: Option<String>,
76-
pub net_amount: MinorUnit,
76+
pub net_amount: Option<MinorUnit>,
7777
pub external_three_ds_authentication_attempted: Option<bool>,
7878
pub authentication_connector: Option<String>,
7979
pub authentication_id: Option<id_type::AuthenticationId>,
@@ -94,7 +94,7 @@ pub struct PaymentAttempt {
9494
pub processor_merchant_id: Option<id_type::MerchantId>,
9595
pub created_by: Option<String>,
9696
pub connector_request_reference_id: Option<String>,
97-
pub payment_method_type_v2: storage_enums::PaymentMethod,
97+
pub payment_method_type_v2: Option<storage_enums::PaymentMethod>,
9898
pub connector_payment_id: Option<ConnectorTransactionId>,
9999
pub payment_method_subtype: storage_enums::PaymentMethodType,
100100
pub routing_result: Option<serde_json::Value>,
@@ -892,8 +892,8 @@ impl PaymentAttemptUpdateInternal {
892892
status,
893893
authentication_type,
894894
error_message,
895-
connector_payment_id,
896-
modified_at,
895+
connector_payment_id: _,
896+
modified_at: _,
897897
browser_info,
898898
error_code,
899899
connector_metadata,
@@ -924,7 +924,7 @@ impl PaymentAttemptUpdateInternal {
924924
error_message: error_message.or(source.error_message),
925925
surcharge_amount: source.surcharge_amount,
926926
payment_method_id: payment_method_id.or(source.payment_method_id),
927-
authentication_type: authentication_type.unwrap_or(source.authentication_type),
927+
authentication_type: authentication_type.or(source.authentication_type),
928928
created_at: source.created_at,
929929
modified_at: common_utils::date_time::now(),
930930
last_synced: source.last_synced,

crates/diesel_models/src/payment_intent.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub struct PaymentIntent {
2020
pub merchant_id: common_utils::id_type::MerchantId,
2121
pub status: storage_enums::IntentStatus,
2222
pub amount: MinorUnit,
23-
pub currency: storage_enums::Currency,
23+
pub currency: Option<storage_enums::Currency>,
2424
pub amount_captured: Option<MinorUnit>,
2525
pub customer_id: Option<common_utils::id_type::GlobalCustomerId>,
2626
pub description: Option<common_utils::types::Description>,
@@ -40,13 +40,13 @@ pub struct PaymentIntent {
4040
pub connector_metadata: Option<pii::SecretSerdeValue>,
4141
pub feature_metadata: Option<FeatureMetadata>,
4242
pub attempt_count: i16,
43-
pub profile_id: common_utils::id_type::ProfileId,
43+
pub profile_id: Option<common_utils::id_type::ProfileId>,
4444
pub payment_link_id: Option<String>,
4545
pub updated_by: String,
4646
pub surcharge_applicable: Option<bool>,
4747
pub request_incremental_authorization: Option<RequestIncrementalAuthorization>,
4848
pub authorization_count: Option<i32>,
49-
pub session_expiry: PrimitiveDateTime,
49+
pub session_expiry: Option<PrimitiveDateTime>,
5050
pub request_external_three_ds_authentication: Option<bool>,
5151
pub frm_metadata: Option<pii::SecretSerdeValue>,
5252
pub customer_details: Option<Encryption>,
@@ -689,7 +689,7 @@ impl PaymentIntentUpdateInternal {
689689
None => source.active_attempt_id,
690690
},
691691
amount: amount.unwrap_or(source.amount),
692-
currency: currency.unwrap_or(source.currency),
692+
currency: currency.or(source.currency),
693693
shipping_cost: shipping_cost.or(source.shipping_cost),
694694
tax_details: tax_details.or(source.tax_details),
695695
skip_external_tax_calculation: skip_external_tax_calculation
@@ -717,7 +717,7 @@ impl PaymentIntentUpdateInternal {
717717
payment_link_config: payment_link_config.or(source.payment_link_config),
718718
request_incremental_authorization: request_incremental_authorization
719719
.or(source.request_incremental_authorization),
720-
session_expiry: session_expiry.unwrap_or(source.session_expiry),
720+
session_expiry: session_expiry.or(source.session_expiry),
721721
frm_metadata: frm_metadata.or(source.frm_metadata),
722722
request_external_three_ds_authentication: request_external_three_ds_authentication
723723
.or(source.request_external_three_ds_authentication),

crates/diesel_models/src/refund.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub struct Refund {
115115
pub processor_refund_data: Option<String>,
116116
pub processor_transaction_data: Option<String>,
117117
pub id: common_utils::id_type::GlobalRefundId,
118-
pub merchant_reference_id: common_utils::id_type::RefundReferenceId,
118+
pub merchant_reference_id: Option<common_utils::id_type::RefundReferenceId>,
119119
pub connector_id: Option<common_utils::id_type::MerchantConnectorAccountId>,
120120
}
121121

crates/diesel_models/src/schema_v2.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ diesel::table! {
369369
merchant_reference_id -> Nullable<Varchar>,
370370
default_billing_address -> Nullable<Bytea>,
371371
default_shipping_address -> Nullable<Bytea>,
372-
status -> DeleteStatus,
372+
status -> Nullable<DeleteStatus>,
373373
#[max_length = 64]
374374
id -> Varchar,
375375
}
@@ -781,7 +781,7 @@ diesel::table! {
781781
connector_webhook_details -> Nullable<Jsonb>,
782782
frm_config -> Nullable<Array<Nullable<Jsonb>>>,
783783
#[max_length = 64]
784-
profile_id -> Varchar,
784+
profile_id -> Nullable<Varchar>,
785785
applepay_verified_domains -> Nullable<Array<Nullable<Text>>>,
786786
pm_auth_config -> Nullable<Jsonb>,
787787
status -> ConnectorStatus,
@@ -842,7 +842,7 @@ diesel::table! {
842842
surcharge_amount -> Nullable<Int8>,
843843
#[max_length = 64]
844844
payment_method_id -> Nullable<Varchar>,
845-
authentication_type -> AuthenticationType,
845+
authentication_type -> Nullable<AuthenticationType>,
846846
created_at -> Timestamp,
847847
modified_at -> Timestamp,
848848
last_synced -> Nullable<Timestamp>,
@@ -873,7 +873,7 @@ diesel::table! {
873873
unified_code -> Nullable<Varchar>,
874874
#[max_length = 1024]
875875
unified_message -> Nullable<Varchar>,
876-
net_amount -> Int8,
876+
net_amount -> Nullable<Int8>,
877877
external_three_ds_authentication_attempted -> Nullable<Bool>,
878878
#[max_length = 64]
879879
authentication_connector -> Nullable<Varchar>,
@@ -905,7 +905,7 @@ diesel::table! {
905905
created_by -> Nullable<Varchar>,
906906
#[max_length = 255]
907907
connector_request_reference_id -> Nullable<Varchar>,
908-
payment_method_type_v2 -> Varchar,
908+
payment_method_type_v2 -> Nullable<Varchar>,
909909
#[max_length = 128]
910910
connector_payment_id -> Nullable<Varchar>,
911911
#[max_length = 64]
@@ -939,7 +939,7 @@ diesel::table! {
939939
merchant_id -> Varchar,
940940
status -> IntentStatus,
941941
amount -> Int8,
942-
currency -> Currency,
942+
currency -> Nullable<Currency>,
943943
amount_captured -> Nullable<Int8>,
944944
#[max_length = 64]
945945
customer_id -> Nullable<Varchar>,
@@ -960,15 +960,15 @@ diesel::table! {
960960
feature_metadata -> Nullable<Json>,
961961
attempt_count -> Int2,
962962
#[max_length = 64]
963-
profile_id -> Varchar,
963+
profile_id -> Nullable<Varchar>,
964964
#[max_length = 255]
965965
payment_link_id -> Nullable<Varchar>,
966966
#[max_length = 32]
967967
updated_by -> Varchar,
968968
surcharge_applicable -> Nullable<Bool>,
969969
request_incremental_authorization -> Nullable<RequestIncrementalAuthorization>,
970970
authorization_count -> Nullable<Int4>,
971-
session_expiry -> Timestamp,
971+
session_expiry -> Nullable<Timestamp>,
972972
request_external_three_ds_authentication -> Nullable<Bool>,
973973
frm_metadata -> Nullable<Jsonb>,
974974
customer_details -> Nullable<Bytea>,
@@ -1259,7 +1259,7 @@ diesel::table! {
12591259
#[max_length = 64]
12601260
id -> Varchar,
12611261
#[max_length = 64]
1262-
merchant_reference_id -> Varchar,
1262+
merchant_reference_id -> Nullable<Varchar>,
12631263
#[max_length = 64]
12641264
connector_id -> Nullable<Varchar>,
12651265
}

0 commit comments

Comments
 (0)