feat(connector): [PEACHPAYMENTS] Refunds, RSync and Cypress added#9850
feat(connector): [PEACHPAYMENTS] Refunds, RSync and Cypress added#9850likhinbopanna merged 4 commits intomainfrom
Conversation
Changed Files |
262716c to
b864b07
Compare
| req: &RefundsRouterData<Execute>, | ||
| _connectors: &Connectors, | ||
| ) -> CustomResult<RequestContent, errors::ConnectorError> { | ||
| let connector_req = peachpayments::PeachpaymentsRefundRequest::try_from(req)?; |
There was a problem hiding this comment.
if partial refunds are not allowed then add a check in the try from which stope partial refunds from being triggered. throw a bad request error
There was a problem hiding this comment.
Partial refunds are allowed in peachpayments, thanks.
| fn try_from(item: &RefundsRouterData<Execute>) -> Result<Self, Self::Error> { | ||
| Ok(Self { | ||
| reference_id: item.request.refund_id.clone(), | ||
| pos_data: None, |
There was a problem hiding this comment.
This is an optional field. Right now, we are populating this as None in Authorize as well.
| None => Ok(RefundsResponseData { | ||
| connector_refund_id: item | ||
| .data | ||
| .request | ||
| .connector_refund_id | ||
| .clone() | ||
| .unwrap_or_else(|| item.data.request.refund_id.clone()), | ||
| refund_status: common_enums::RefundStatus::Failure, | ||
| }), |
There was a problem hiding this comment.
are we getting any error message in case refund is failing?
There was a problem hiding this comment.
In RSync, we are not getting any detail regarding status or error_message. It only lists out refundHistory and refundBalanceData. So, if the refund corresponding to refund_txn_id is present in the refundHistory, I am marking it as succeeded, else failed.
d1af27e to
dfd234a
Compare
dfd234a to
3b5bd1c
Compare
| let response = match refund_info { | ||
| Some(refund) => Ok(RefundsResponseData { | ||
| connector_refund_id: refund.transaction_id.clone(), | ||
| refund_status: common_enums::RefundStatus::Success, | ||
| }), | ||
| None => Ok(RefundsResponseData { | ||
| connector_refund_id: item | ||
| .data | ||
| .request | ||
| .connector_refund_id | ||
| .clone() | ||
| .unwrap_or_else(|| item.data.request.refund_id.clone()), | ||
| refund_status: common_enums::RefundStatus::Failure, | ||
| }), |
There was a problem hiding this comment.
How are you handling the case where refund is still in pending state on peach even after rsync?
There was a problem hiding this comment.
Pending status not expected in refunds as we discussed, thanks.
361e5b3 to
d624fe9
Compare
d624fe9 to
af75f98
Compare
There was a problem hiding this comment.
Can you fix the lints ?
There was a problem hiding this comment.
other than that LGTM
34acef9
Type of Change
Description
Refunds, RSync and Cypress added for Peachpayments based on their intended API contract.
Additional Changes
Motivation and Context
How did you test it?
Required
RefundsAPI contract is not currently deployed on connector's end, dev is done based on documentation (need to get this merged as a merchant requirement). So no need to test refunds API.Refunds are failing in cypress also because of the above reason.

Checklist
cargo +nightly fmt --allcargo clippy