Skip to content

Commit

Permalink
fix: payment_method_data and description null during payment confirm (#…
Browse files Browse the repository at this point in the history
…2618)

Co-authored-by: Abhishek Marrivagu <[email protected]>
  • Loading branch information
dracarys18 and Abhicodes-crypto authored Oct 19, 2023
1 parent cc0b422 commit 6765a1c
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
32 changes: 28 additions & 4 deletions crates/diesel_models/src/payment_attempt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,23 +289,47 @@ impl PaymentAttemptUpdate {
amount: pa_update.amount.unwrap_or(source.amount),
currency: pa_update.currency.or(source.currency),
status: pa_update.status.unwrap_or(source.status),
connector: pa_update.connector.or(source.connector),
connector_transaction_id: source
connector_transaction_id: pa_update
.connector_transaction_id
.or(pa_update.connector_transaction_id),
.or(source.connector_transaction_id),
amount_to_capture: pa_update.amount_to_capture.or(source.amount_to_capture),
connector: pa_update.connector.or(source.connector),
authentication_type: pa_update.authentication_type.or(source.authentication_type),
payment_method: pa_update.payment_method.or(source.payment_method),
error_message: pa_update.error_message.unwrap_or(source.error_message),
payment_method_id: pa_update
.payment_method_id
.unwrap_or(source.payment_method_id),
browser_info: pa_update.browser_info.or(source.browser_info),
cancellation_reason: pa_update.cancellation_reason.or(source.cancellation_reason),
modified_at: common_utils::date_time::now(),
mandate_id: pa_update.mandate_id.or(source.mandate_id),
browser_info: pa_update.browser_info.or(source.browser_info),
payment_token: pa_update.payment_token.or(source.payment_token),
error_code: pa_update.error_code.unwrap_or(source.error_code),
connector_metadata: pa_update.connector_metadata.or(source.connector_metadata),
payment_method_data: pa_update.payment_method_data.or(source.payment_method_data),
payment_method_type: pa_update.payment_method_type.or(source.payment_method_type),
payment_experience: pa_update.payment_experience.or(source.payment_experience),
business_sub_label: pa_update.business_sub_label.or(source.business_sub_label),
straight_through_algorithm: pa_update
.straight_through_algorithm
.or(source.straight_through_algorithm),
preprocessing_step_id: pa_update
.preprocessing_step_id
.or(source.preprocessing_step_id),
error_reason: pa_update.error_reason.unwrap_or(source.error_reason),
capture_method: pa_update.capture_method.or(source.capture_method),
connector_response_reference_id: pa_update
.connector_response_reference_id
.or(source.connector_response_reference_id),
multiple_capture_count: pa_update
.multiple_capture_count
.or(source.multiple_capture_count),
surcharge_amount: pa_update.surcharge_amount.or(source.surcharge_amount),
tax_amount: pa_update.tax_amount.or(source.tax_amount),
amount_capturable: pa_update
.amount_capturable
.unwrap_or(source.amount_capturable),
surcharge_metadata: pa_update.surcharge_metadata.or(source.surcharge_metadata),
updated_by: pa_update.updated_by,
..source
Expand Down
23 changes: 23 additions & 0 deletions crates/diesel_models/src/payment_intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,30 @@ impl PaymentIntentUpdate {
.shipping_address_id
.or(source.shipping_address_id),
modified_at: common_utils::date_time::now(),
active_attempt_id: internal_update
.active_attempt_id
.unwrap_or(source.active_attempt_id),
business_country: internal_update.business_country.or(source.business_country),
business_label: internal_update.business_label.or(source.business_label),
description: internal_update.description.or(source.description),
statement_descriptor_name: internal_update
.statement_descriptor_name
.or(source.statement_descriptor_name),
statement_descriptor_suffix: internal_update
.statement_descriptor_suffix
.or(source.statement_descriptor_suffix),
order_details: internal_update.order_details.or(source.order_details),
attempt_count: internal_update
.attempt_count
.unwrap_or(source.attempt_count),
profile_id: internal_update.profile_id.or(source.profile_id),
merchant_decision: internal_update
.merchant_decision
.or(source.merchant_decision),
payment_confirm_source: internal_update
.payment_confirm_source
.or(source.payment_confirm_source),
updated_by: internal_update.updated_by,
..source
}
}
Expand Down

0 comments on commit 6765a1c

Please sign in to comment.