refactor(ext_traits): simplify the signatures of some methods in Encode extension trait (#3687)

This commit is contained in:
Sanchith Hegde
2024-02-19 15:24:09 +05:30
committed by GitHub
parent 8038b48a54
commit 11fc9b3986
44 changed files with 392 additions and 416 deletions

View File

@ -1,5 +1,5 @@
use api_models::webhooks;
use common_utils::{crypto::SignMessage, ext_traits};
use common_utils::{crypto::SignMessage, ext_traits::Encode};
use error_stack::ResultExt;
use serde::Serialize;
@ -21,10 +21,10 @@ impl OutgoingWebhookType for webhooks::OutgoingWebhook {
&self,
payment_response_hash_key: Option<String>,
) -> errors::CustomResult<Option<String>, errors::WebhooksFlowError> {
let webhook_signature_payload =
ext_traits::Encode::<serde_json::Value>::encode_to_string_of_json(self)
.change_context(errors::WebhooksFlowError::OutgoingWebhookEncodingFailed)
.attach_printable("failed encoding outgoing webhook payload")?;
let webhook_signature_payload = self
.encode_to_string_of_json()
.change_context(errors::WebhooksFlowError::OutgoingWebhookEncodingFailed)
.attach_printable("failed encoding outgoing webhook payload")?;
Ok(payment_response_hash_key
.map(|key| {