Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
momo-payment-gateway
Advanced tools
Readme
The plugin will make it easier to integrate Momo Wallet payments via QR code.
It's currently using for Reebok, Thefaceshop, BeautyBox,...
We also wrote other payment gateway:
The first, Momo partner must be successfully registered. Use the package manager npm to install.
npm i momo-payment-gateway
import { MomoPayment } from 'momo-payment-gateway';
/* HOST_WEBHOOK => Partner API. Used by MoMo to submit payment results by IPN method (server-to-server) method */
const HOST_WEBHOOK = process.env.HOST_WEBHOOK;
/* constructor: partnerCode, accessKey, secretKey ,apiEndpoint=> provided by Momo
apiEndpoint:
sandbox: https://test-payment.momo.vn
live: https://payment.momo.vn
*/
class MomoPaymentService {
constructor( partnerCode, accessKey, secretKey, endpoint) {
this.momoPayment = new MomoPayment({
partnerCode,
accessKey,
secretKey,
apiEndpoint,
});
}
/* The payment method payUrl is returned */
async createPayment({
orderId,
amount,
orderInfo = 'Your message',
returnUrl = 'https://your-website.com',
}) {
try {
if (!orderId || !amount || !message || !orderInfo) {
throw new Error('invalid input');
}
const result = await this.momoPayment.createPayment({
requestId: `ID-${orderId}-${Math.round(Date.now() / 1000)}`, // Help for re-create payment
orderId: `${orderId}-${Math.round(Date.now() / 1000)}`,
amount,
orderInfo,
returnUrl,
ipnUrl: HOST_WEBHOOK,
});
return result;
} catch (error) {
console.error(error)
throw error;
}
}
/* Proceed the refund payment */
async refundPayment({ requestId, orderId, amount, transId }) {
try {
if (!orderId || !amount || !transId) {
throw new Error('invalid input');
}
const result = await this.momoPayment.refundPayment({
requestId,
orderId,
amount,
transId,
});
return result.data;
} catch (error) {
console.error(error)
throw error;
}
}
/* The function for verify webhook request and payment */
verifySignature({
signature,
requestId,
orderId,
amount,
orderInfo,
orderType,
transId,
message,
localMessage,
responseTime,
errorCode,
payType,
}) {
try {
const result = this.momoPayment.verifySignature({
signature,
requestId,
orderId,
amount,
orderInfo,
orderType,
transId,
message,
localMessage,
responseTime,
errorCode,
payType,
});
return result;
} catch (error) {
console.error(error)
throw error;
}
}
}
Pull requests are welcome
Mail: thao.pamt@gmail.com Skype: phamanmaithao10@gmail.com Documentation: https://developers.momo.vn/
FAQs
Payment with Momo Wallet via QR code
The npm package momo-payment-gateway receives a total of 6 weekly downloads. As such, momo-payment-gateway popularity was classified as not popular.
We found that momo-payment-gateway demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.