Skip to content

feat(connector): [PEACHPAYMENTS] Refunds, RSync and Cypress added#9850

Merged
likhinbopanna merged 4 commits intomainfrom
peachpayments/refund
Oct 17, 2025
Merged

feat(connector): [PEACHPAYMENTS] Refunds, RSync and Cypress added#9850
likhinbopanna merged 4 commits intomainfrom
peachpayments/refund

Conversation

@swetasharma03
Copy link
Contributor

@swetasharma03 swetasharma03 commented Oct 15, 2025

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

Refunds, RSync and Cypress added for Peachpayments based on their intended API contract.

Additional Changes

  • This PR modifies the API contract
  • This PR modifies the database schema
  • This PR modifies application configuration/environment variables

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.
Screenshot 2025-10-17 at 5 33 43 PM

Checklist

  • I formatted the code cargo +nightly fmt --all
  • I addressed lints thrown by cargo clippy
  • I reviewed the submitted code
  • I added unit tests for my changes where possible

@swetasharma03 swetasharma03 self-assigned this Oct 15, 2025
@swetasharma03 swetasharma03 requested review from a team as code owners October 15, 2025 07:59
@semanticdiff-com
Copy link

semanticdiff-com bot commented Oct 15, 2025

@swetasharma03 swetasharma03 force-pushed the peachpayments/refund branch 3 times, most recently from 262716c to b864b07 Compare October 15, 2025 14:27
req: &RefundsRouterData<Execute>,
_connectors: &Connectors,
) -> CustomResult<RequestContent, errors::ConnectorError> {
let connector_req = peachpayments::PeachpaymentsRefundRequest::try_from(req)?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this none?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an optional field. Right now, we are populating this as None in Authorize as well.

Comment on lines +811 to +819
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,
}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we getting any error message in case refund is failing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@swetasharma03 swetasharma03 force-pushed the peachpayments/refund branch 3 times, most recently from d1af27e to dfd234a Compare October 15, 2025 16:35
Comment on lines +831 to +844
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,
}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How are you handling the case where refund is still in pending state on peach even after rsync?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending status not expected in refunds as we discussed, thanks.

@swetasharma03 swetasharma03 requested a review from a team as a code owner October 16, 2025 10:27
@swetasharma03 swetasharma03 force-pushed the peachpayments/refund branch 2 times, most recently from 361e5b3 to d624fe9 Compare October 16, 2025 10:41
dgeee13
dgeee13 previously approved these changes Oct 16, 2025
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix the lints ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other than that LGTM

@swetasharma03 swetasharma03 dismissed stale reviews from dgeee13 and deepanshu-iiitu via 34acef9 October 17, 2025 11:32
@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 17, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Oct 17, 2025
@likhinbopanna likhinbopanna added this pull request to the merge queue Oct 17, 2025
Merged via the queue into main with commit 820f183 Oct 17, 2025
27 of 29 checks passed
@likhinbopanna likhinbopanna deleted the peachpayments/refund branch October 17, 2025 16:00
drdholu pushed a commit to drdholu/hyperswitch that referenced this pull request Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants