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

Dev #397

Merged
merged 7 commits into from
Nov 13, 2023
Merged

Dev #397

Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update [bodyJson]webhook.js
use zero-decimal-currencies to fix stripe web hook amount inconsistency.
For non zero-decimal-currencies, amount is divided by 100 before insert into database,
otherwise, original paymentIntent.amount is saved
mark-jia authored Oct 28, 2023

Verified

This commit was signed with the committer’s verified signature.
igordanilcenko Igor Danilčenko
commit 0f1dd1fa27c5dc39dffa1c83a95e7116b17d073d
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ const { getConfig } = require('@evershop/evershop/src/lib/util/getConfig');
const { emit } = require('@evershop/evershop/src/lib/event/emitter');
const { debug } = require('@evershop/evershop/src/lib/log/debuger');
const { getSetting } = require('../../../setting/services/setting');
const { display } = require('zero-decimal-currencies');

// eslint-disable-next-line no-unused-vars
module.exports = async (request, response, delegate, next) => {
@@ -56,7 +57,7 @@ module.exports = async (request, response, delegate, next) => {
// Create payment transaction
await insert('payment_transaction')
.given({
amount: parseFloat((paymentIntent.amount/100).toFixed(4)),
amount: parseFloat(display(paymentIntent.amount, paymentIntent.currency)),
payment_transaction_order_id: order.order_id,
transaction_id: paymentIntent.id,
transaction_type: 'online',