Skip to content

Commit

Permalink
payment result callback with banking method
Browse files Browse the repository at this point in the history
  • Loading branch information
mister-teddy committed Apr 12, 2024
1 parent 13c4f26 commit 511b98e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"react-router-dom": "^6.8.2",
"recoil": "^0.7.7",
"swiper": "^9.1.0",
"zmp-sdk": "^2.35.3",
"zmp-sdk": "^2.37.1",
"zmp-ui": "^1.6.0-rc.6"
},
"devDependencies": {
Expand Down
7 changes: 4 additions & 3 deletions src/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,11 @@ export const useHandlePayment = () => {
}
});

events.on(EventName.OnDataCallback, (data) => {
if (data.appTransID) {
events.on(EventName.OnDataCallback, (resp) => {
const { appTransID, eventType } = resp;
if (appTransID || eventType === "PAY_BY_CUSTOM_METHOD") {
navigate("/result", {
state: data,
state: resp,
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/pages/result.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const CheckoutResultPage: FC = () => {

const check = () => {
Payment.checkTransaction({
data: state && "path" in state ? state.path : state,
data: state && "path" in state ? state.path : state.data,
success: (rs) => {
// Kết quả giao dịch khi gọi api thành công
setPaymentResult(rs);
Expand Down

0 comments on commit 511b98e

Please sign in to comment.