Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Player registration payments #379

Merged
merged 15 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,5 @@ cython_debug/
/.envrc
/secrets
/cron/
/.vscode
/.DS_STORE
1 change: 1 addition & 0 deletions frontend/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
static/bundle.js
/.DS_STORE
25 changes: 16 additions & 9 deletions frontend/src/components/RazorpayPayment.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ const RazorpayPayment = props => {
props.setStatus(
"Razorpay SDK failed to load. please check are you online?"
);
if (props.failureCallback) {
props.failureCallback(
"Razorpay SDK failed to load. please check are you online?"
);
}
}
});

Expand All @@ -24,7 +29,9 @@ const RazorpayPayment = props => {
const event_id = props.event?.id;
const team_id = props.team?.id;
const data = team_id
? { team_id, event_id } // Team Registration
? player_ids
? { team_id, event_id, player_ids } // Player Registration
: { team_id, event_id } // Team Registration
: props.annual
? player_ids
? { player_ids, season_id } // Group Membership
Expand Down Expand Up @@ -70,11 +77,11 @@ const RazorpayPayment = props => {
</span>
);
} else {
if (response.status === 422) {
if (response.status >= 400 && response.status < 500) {
const error = await response.json();
props.setStatus(`Error: ${error.message}`);
if (props.failureCallback) {
props.failureCallback(`Error: ${error.message}`);
props.failureCallback(error.message);
}
} else {
const body = await response.text();
Expand All @@ -83,7 +90,7 @@ const RazorpayPayment = props => {
);
if (props.failureCallback) {
props.failureCallback(
`Error: ${response.statusText} (${response.status}) — ${body}`
`${response.statusText} (${response.status}) — ${body}`
);
}
}
Expand All @@ -97,19 +104,19 @@ const RazorpayPayment = props => {
);
if (props.failureCallback) {
props.failureCallback(
`Error: ${response.error.code}: ${response.error.description}`
`${response.error.code}: ${response.error.description}`
);
}
});
paymentObject.open();

// window.location = data.redirect_url;
} else {
if (response.status === 422) {
if (response.status >= 400 && response.status < 500) {
const error = await response.json();
props.setStatus(`Error: ${error.message}`);
if (props.failureCallback) {
props.failureCallback(`Error: ${error.message}`);
props.failureCallback(`${error.message}`);
}
} else {
const body = await response.text();
Expand All @@ -118,7 +125,7 @@ const RazorpayPayment = props => {
);
if (props.failureCallback) {
props.failureCallback(
`Error: ${response.statusText} (${response.status}) — ${body}`
`${response.statusText} (${response.status}) — ${body}`
);
}
}
Expand All @@ -129,7 +136,7 @@ const RazorpayPayment = props => {
setLoading(false);
props.setStatus(`Error: ${error}`);
if (props.failureCallback) {
props.failureCallback(`Error: ${error}`);
props.failureCallback(`${error}`);
}
});
};
Expand Down
Loading
Loading