Skip to content

Instantly share code, notes, and snippets.

@ms314006
Last active January 29, 2023 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ms314006/c5b9a89a32b1c57e15e7a3be91f507e4 to your computer and use it in GitHub Desktop.
Save ms314006/c5b9a89a32b1c57e15e7a3be91f507e4 to your computer and use it in GitHub Desktop.
const getTransactionInfo = () => {
switch (transaction.status) {
case 'SUCCESS':
return {
statusString: '成功',
isNonRefundable: false,
};
case 'FAIL':
return {
statusString: '失敗',
isNonRefundable: true,
};
case 'PENDING':
return {
statusString: '處理中',
isNonRefundable: true,
};
default:
throw new Error(`Have no transaction status: ${transaction.status}`);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment