first commit
This commit is contained in:
8
.dockerignore
Normal file
8
.dockerignore
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
README.md
|
||||||
|
.env
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
130
.gitignore
vendored
Normal file
130
.gitignore
vendored
Normal file
@@ -0,0 +1,130 @@
|
|||||||
|
# Logs
|
||||||
|
logs
|
||||||
|
*.log
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
lerna-debug.log*
|
||||||
|
.pnpm-debug.log*
|
||||||
|
|
||||||
|
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||||
|
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
||||||
|
|
||||||
|
# Runtime data
|
||||||
|
pids
|
||||||
|
*.pid
|
||||||
|
*.seed
|
||||||
|
*.pid.lock
|
||||||
|
|
||||||
|
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||||
|
lib-cov
|
||||||
|
|
||||||
|
# Coverage directory used by tools like istanbul
|
||||||
|
coverage
|
||||||
|
*.lcov
|
||||||
|
|
||||||
|
# nyc test coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||||
|
.grunt
|
||||||
|
|
||||||
|
# Bower dependency directory (https://bower.io/)
|
||||||
|
bower_components
|
||||||
|
|
||||||
|
# node-waf configuration
|
||||||
|
.lock-wscript
|
||||||
|
|
||||||
|
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||||
|
build/Release
|
||||||
|
|
||||||
|
# Dependency directories
|
||||||
|
node_modules/
|
||||||
|
jspm_packages/
|
||||||
|
|
||||||
|
# Snowpack dependency directory (https://snowpack.dev/)
|
||||||
|
web_modules/
|
||||||
|
|
||||||
|
# TypeScript cache
|
||||||
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# Optional npm cache directory
|
||||||
|
.npm
|
||||||
|
|
||||||
|
# Optional eslint cache
|
||||||
|
.eslintcache
|
||||||
|
|
||||||
|
# Optional stylelint cache
|
||||||
|
.stylelintcache
|
||||||
|
|
||||||
|
# Microbundle cache
|
||||||
|
.rpt2_cache/
|
||||||
|
.rts2_cache_cjs/
|
||||||
|
.rts2_cache_es/
|
||||||
|
.rts2_cache_umd/
|
||||||
|
|
||||||
|
# Optional REPL history
|
||||||
|
.node_repl_history
|
||||||
|
|
||||||
|
# Output of 'npm pack'
|
||||||
|
*.tgz
|
||||||
|
|
||||||
|
# Yarn Integrity file
|
||||||
|
.yarn-integrity
|
||||||
|
|
||||||
|
# dotenv environment variable files
|
||||||
|
.env
|
||||||
|
.env.development.local
|
||||||
|
.env.test.local
|
||||||
|
.env.production.local
|
||||||
|
.env.local
|
||||||
|
|
||||||
|
# parcel-bundler cache (https://parceljs.org/)
|
||||||
|
.cache
|
||||||
|
.parcel-cache
|
||||||
|
|
||||||
|
# Next.js build output
|
||||||
|
.next
|
||||||
|
out
|
||||||
|
|
||||||
|
# Nuxt.js build / generate output
|
||||||
|
.nuxt
|
||||||
|
dist
|
||||||
|
|
||||||
|
# Gatsby files
|
||||||
|
.cache/
|
||||||
|
# Comment in the public line in if your project uses Gatsby and not Next.js
|
||||||
|
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||||
|
# public
|
||||||
|
|
||||||
|
# vuepress build output
|
||||||
|
.vuepress/dist
|
||||||
|
|
||||||
|
# vuepress v2.x temp and cache directory
|
||||||
|
.temp
|
||||||
|
.cache
|
||||||
|
|
||||||
|
# Docusaurus cache and generated files
|
||||||
|
.docusaurus
|
||||||
|
|
||||||
|
# Serverless directories
|
||||||
|
.serverless/
|
||||||
|
|
||||||
|
# FuseBox cache
|
||||||
|
.fusebox/
|
||||||
|
|
||||||
|
# DynamoDB Local files
|
||||||
|
.dynamodb/
|
||||||
|
|
||||||
|
# TernJS port file
|
||||||
|
.tern-port
|
||||||
|
|
||||||
|
# Stores VSCode versions used for testing VSCode extensions
|
||||||
|
.vscode-test
|
||||||
|
|
||||||
|
# yarn v2
|
||||||
|
.yarn/cache
|
||||||
|
.yarn/unplugged
|
||||||
|
.yarn/build-state.yml
|
||||||
|
.yarn/install-state.gz
|
||||||
|
.pnp.*
|
||||||
14
Dockerfile
Normal file
14
Dockerfile
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
FROM node:18-alpine
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
EXPOSE 3000
|
||||||
|
|
||||||
|
CMD ["node", "index.js"]
|
||||||
|
|
||||||
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
version: "3.8"
|
||||||
|
|
||||||
|
services:
|
||||||
|
payment:
|
||||||
|
build: .
|
||||||
|
image: wixarm/rasadyar-payment
|
||||||
|
ports:
|
||||||
|
- "3000:3000"
|
||||||
|
restart: unless-stopped
|
||||||
78
lib/asan-pardakht-config.js
Normal file
78
lib/asan-pardakht-config.js
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
const crypto = require("crypto");
|
||||||
|
const soap = require("soap");
|
||||||
|
|
||||||
|
const config = {
|
||||||
|
KEY: "Your KEY",
|
||||||
|
IV: "Your IV",
|
||||||
|
username: "Your username",
|
||||||
|
password: "Your password",
|
||||||
|
WebServiceUrl:
|
||||||
|
"https://services.asanpardakht.net/paygate/merchantservices.asmx?WSDL",
|
||||||
|
merchantConfigurationID: "YourConfigurationID",
|
||||||
|
};
|
||||||
|
|
||||||
|
function addPadding(string, blocksize = 32) {
|
||||||
|
const pad = blocksize - (string.length % blocksize);
|
||||||
|
return string + String.fromCharCode(pad).repeat(pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
function stripPadding(string) {
|
||||||
|
const pad = string.charCodeAt(string.length - 1);
|
||||||
|
return string.slice(0, -pad);
|
||||||
|
}
|
||||||
|
|
||||||
|
function encrypt(string = "") {
|
||||||
|
const key = Buffer.from(config.KEY, "base64");
|
||||||
|
const iv = Buffer.from(config.IV, "base64");
|
||||||
|
const cipher = crypto.createCipheriv("aes-256-cbc", key, iv);
|
||||||
|
let encrypted = cipher.update(addPadding(string), "utf8", "base64");
|
||||||
|
encrypted += cipher.final("base64");
|
||||||
|
return encrypted;
|
||||||
|
}
|
||||||
|
|
||||||
|
function decrypt(string = "") {
|
||||||
|
const key = Buffer.from(config.KEY, "base64");
|
||||||
|
const iv = Buffer.from(config.IV, "base64");
|
||||||
|
const decipher = crypto.createDecipheriv("aes-256-cbc", key, iv);
|
||||||
|
let decrypted = decipher.update(string, "base64", "utf8");
|
||||||
|
decrypted += decipher.final("utf8");
|
||||||
|
return stripPadding(decrypted);
|
||||||
|
}
|
||||||
|
|
||||||
|
async function encryptWS(string = "") {
|
||||||
|
try {
|
||||||
|
const client = await soap.createClientAsync(
|
||||||
|
"https://services.asanpardakht.net/paygate/internalutils.asmx?WSDL"
|
||||||
|
);
|
||||||
|
const args = {
|
||||||
|
aesKey: config.KEY,
|
||||||
|
aesVector: config.IV,
|
||||||
|
toBeEncrypted: string,
|
||||||
|
};
|
||||||
|
const result = await client.EncryptInAESAsync(args);
|
||||||
|
return result[0].EncryptInAESResult;
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Error in EncryptWS:", err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function decryptWS(string = "") {
|
||||||
|
try {
|
||||||
|
const client = await soap.createClientAsync(
|
||||||
|
"https://services.asanpardakht.net/paygate/internalutils.asmx?WSDL"
|
||||||
|
);
|
||||||
|
const args = {
|
||||||
|
aesKey: config.KEY,
|
||||||
|
aesVector: config.IV,
|
||||||
|
toBeDecrypted: string,
|
||||||
|
};
|
||||||
|
const result = await client.DecryptInAESAsync(args);
|
||||||
|
return result[0].DecryptInAESResult;
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Error in DecryptWS:", err);
|
||||||
|
throw err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { config, encrypt, decrypt, encryptWS, decryptWS };
|
||||||
44
lib/bp-cumulative-dynamic-pay-request.js
Normal file
44
lib/bp-cumulative-dynamic-pay-request.js
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
const moment = require("moment");
|
||||||
|
const soap = require("soap");
|
||||||
|
const { TERMINALID, USERNAME, USERPASSWORD, MELLATWSDL } = require("./data");
|
||||||
|
|
||||||
|
function bpCumulativeDynamicPayRequest(
|
||||||
|
orderId,
|
||||||
|
priceAmount,
|
||||||
|
additionalText,
|
||||||
|
callbackUrl
|
||||||
|
) {
|
||||||
|
const localDate = moment().format("YYYYMMDD");
|
||||||
|
const localTime = moment().format("HHmmss");
|
||||||
|
const args = {
|
||||||
|
terminalId: TERMINALID,
|
||||||
|
userName: USERNAME,
|
||||||
|
userPassword: USERPASSWORD,
|
||||||
|
orderId: orderId,
|
||||||
|
amount: priceAmount,
|
||||||
|
localDate: localDate,
|
||||||
|
localTime: localTime,
|
||||||
|
additionalData: additionalText,
|
||||||
|
callBackUrl: callbackUrl,
|
||||||
|
};
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
overrideRootElement: {
|
||||||
|
namespace: "ns1",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
soap.createClient(MELLATWSDL, options, (err, client) => {
|
||||||
|
client.bpCumulativeDynamicPayRequest(args, (err, result, body) => {
|
||||||
|
if (err) {
|
||||||
|
//console.log(err);
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
return resolve(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { bpCumulativeDynamicPayRequest };
|
||||||
33
lib/bp-inquiry-request.js
Normal file
33
lib/bp-inquiry-request.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
const soap = require("soap");
|
||||||
|
const { TERMINALID, USERNAME, USERPASSWORD, MELLATWSDL } = require("./data");
|
||||||
|
|
||||||
|
function bpInquiryRequest(orderId, saleOrderId, saleReferenceId) {
|
||||||
|
const args = {
|
||||||
|
terminalId: TERMINALID,
|
||||||
|
userName: USERNAME,
|
||||||
|
userPassword: USERPASSWORD,
|
||||||
|
orderId: orderId,
|
||||||
|
saleOrderId: saleOrderId,
|
||||||
|
saleReferenceId: saleReferenceId,
|
||||||
|
};
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
overrideRootElement: {
|
||||||
|
namespace: "ns1",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
soap.createClient(MELLATWSDL, options, (err, client) => {
|
||||||
|
client.bpInquiryRequest(args, (err, result, body) => {
|
||||||
|
if (err) {
|
||||||
|
//console.log(err);
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
return resolve(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { bpInquiryRequest };
|
||||||
40
lib/bp-pay-request.js
Normal file
40
lib/bp-pay-request.js
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
const moment = require("moment");
|
||||||
|
const soap = require("soap");
|
||||||
|
const { TERMINALID, USERNAME, USERPASSWORD, MELLATWSDL } = require("./data");
|
||||||
|
|
||||||
|
function bpPayRequest(orderId, priceAmount, additionalText, callbackUrl) {
|
||||||
|
const localDate = moment().format("YYYYMMDD");
|
||||||
|
const localTime = moment().format("HHmmss");
|
||||||
|
const args = {
|
||||||
|
terminalId: TERMINALID,
|
||||||
|
userName: USERNAME,
|
||||||
|
userPassword: USERPASSWORD,
|
||||||
|
orderId: orderId,
|
||||||
|
amount: priceAmount,
|
||||||
|
localDate: localDate,
|
||||||
|
localTime: localTime,
|
||||||
|
additionalData: additionalText,
|
||||||
|
callBackUrl: callbackUrl,
|
||||||
|
payerId: 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
overrideRootElement: {
|
||||||
|
namespace: "ns1",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
soap.createClient(MELLATWSDL, options, (err, client) => {
|
||||||
|
client.bpPayRequest(args, (err, result, body) => {
|
||||||
|
if (err) {
|
||||||
|
//console.log(err);
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
return resolve(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { bpPayRequest };
|
||||||
33
lib/bp-reversal-request.js
Normal file
33
lib/bp-reversal-request.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
const soap = require("soap");
|
||||||
|
const { TERMINALID, USERNAME, USERPASSWORD, MELLATWSDL } = require("./data");
|
||||||
|
|
||||||
|
function bpReversalRequest(orderId, saleOrderId, saleReferenceId) {
|
||||||
|
const args = {
|
||||||
|
terminalId: TERMINALID,
|
||||||
|
userName: USERNAME,
|
||||||
|
userPassword: USERPASSWORD,
|
||||||
|
orderId: orderId,
|
||||||
|
saleOrderId: saleOrderId,
|
||||||
|
saleReferenceId: saleReferenceId,
|
||||||
|
};
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
overrideRootElement: {
|
||||||
|
namespace: "ns1",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
soap.createClient(MELLATWSDL, options, (err, client) => {
|
||||||
|
client.bpReversalRequest(args, (err, result, body) => {
|
||||||
|
if (err) {
|
||||||
|
//console.log(err);
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
return resolve(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { bpReversalRequest };
|
||||||
33
lib/bp-settle-request.js
Normal file
33
lib/bp-settle-request.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
const soap = require("soap");
|
||||||
|
const { TERMINALID, USERNAME, USERPASSWORD, MELLATWSDL } = require("./data");
|
||||||
|
|
||||||
|
function bpSettleRequest(orderId, saleOrderId, saleReferenceId) {
|
||||||
|
const args = {
|
||||||
|
terminalId: TERMINALID,
|
||||||
|
userName: USERNAME,
|
||||||
|
userPassword: USERPASSWORD,
|
||||||
|
orderId: orderId,
|
||||||
|
saleOrderId: saleOrderId,
|
||||||
|
saleReferenceId: saleReferenceId,
|
||||||
|
};
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
overrideRootElement: {
|
||||||
|
namespace: "ns1",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
soap.createClient(MELLATWSDL, options, (err, client) => {
|
||||||
|
client.bpSettleRequest(args, (err, result, body) => {
|
||||||
|
if (err) {
|
||||||
|
//console.log(err);
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
return resolve(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { bpSettleRequest };
|
||||||
33
lib/bp-verify-request.js
Normal file
33
lib/bp-verify-request.js
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
const soap = require("soap");
|
||||||
|
const { TERMINALID, USERNAME, USERPASSWORD, MELLATWSDL } = require("./data");
|
||||||
|
|
||||||
|
function bpVerifyRequest(orderId, saleOrderId, saleReferenceId) {
|
||||||
|
const args = {
|
||||||
|
terminalId: TERMINALID,
|
||||||
|
userName: USERNAME,
|
||||||
|
userPassword: USERPASSWORD,
|
||||||
|
orderId: orderId,
|
||||||
|
saleOrderId: saleOrderId,
|
||||||
|
saleReferenceId: saleReferenceId,
|
||||||
|
};
|
||||||
|
|
||||||
|
var options = {
|
||||||
|
overrideRootElement: {
|
||||||
|
namespace: "ns1",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
soap.createClient(MELLATWSDL, options, (err, client) => {
|
||||||
|
client.bpVerifyRequest(args, (err, result, body) => {
|
||||||
|
if (err) {
|
||||||
|
//console.log(err);
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
return resolve(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { bpVerifyRequest };
|
||||||
5
lib/data.js
Normal file
5
lib/data.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
const TERMINALID = 7269507;
|
||||||
|
const USERNAME = "7269507";
|
||||||
|
const USERPASSWORD = "66506956";
|
||||||
|
const MELLATWSDL = "https://bpm.shaparak.ir/pgwchannel/services/pgw?wsdl";
|
||||||
|
module.exports = { TERMINALID, USERNAME, USERPASSWORD, MELLATWSDL };
|
||||||
2416
lib/getAllCities.js
Normal file
2416
lib/getAllCities.js
Normal file
File diff suppressed because it is too large
Load Diff
134
lib/getAllProvinces.js
Normal file
134
lib/getAllProvinces.js
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
const getAllProvinces = () => {
|
||||||
|
return [
|
||||||
|
{
|
||||||
|
name: "همدان",
|
||||||
|
id: "65550",
|
||||||
|
address: "https://habackend.rasadyaar.ir/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "مرکزی",
|
||||||
|
id: "65548",
|
||||||
|
address: "https://mabackend.rasadyaar.ir/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "بوشهر",
|
||||||
|
id: "65527",
|
||||||
|
address: "https://bubackend.rasadyaar.ir/",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "آذربایجان شرقی",
|
||||||
|
id: "65521",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "آذربایجان غربی",
|
||||||
|
id: "65522",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "اردبیل",
|
||||||
|
id: "65523",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "اصفهان",
|
||||||
|
id: "65524",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "البرز",
|
||||||
|
id: "65525",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "ایلام",
|
||||||
|
id: "65526",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "تهران",
|
||||||
|
id: "65528",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "چهارمحال و بختیاری",
|
||||||
|
id: "65529",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "خراسان جنوبی",
|
||||||
|
id: "65530",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "خراسان رضوی",
|
||||||
|
id: "65531",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "خراسان شمالی",
|
||||||
|
id: "65532",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "خوزستان",
|
||||||
|
id: "65533",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "زنجان",
|
||||||
|
id: "65534",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "سمنان",
|
||||||
|
id: "65535",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "سیستان و بلوچستان",
|
||||||
|
id: "65536",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "فارس",
|
||||||
|
id: "65537",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "قزوین",
|
||||||
|
id: "65538",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "قم",
|
||||||
|
id: "65539",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "کردستان",
|
||||||
|
id: "65540",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "کرمان",
|
||||||
|
id: "65541",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "کرمانشاه",
|
||||||
|
id: "65542",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "کهکیلویه و بویراحمد",
|
||||||
|
id: "65543",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "گلستان",
|
||||||
|
id: "65544",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "گیلان",
|
||||||
|
id: "65545",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "لرستان",
|
||||||
|
id: "65546",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "مازندران",
|
||||||
|
id: "65547",
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
name: "هرمزگان",
|
||||||
|
id: "65549",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "یزد",
|
||||||
|
id: "65551",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = { getAllProvinces };
|
||||||
101
lib/taavon-send-data.js
Normal file
101
lib/taavon-send-data.js
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
const taavonSendData = async (saleOrderId, data) => {
|
||||||
|
// let redirectUrl = "";
|
||||||
|
let subDomain = "test";
|
||||||
|
const provinceCode = saleOrderId.toString().substring(0, 2);
|
||||||
|
console.log({ data, provinceCode });
|
||||||
|
|
||||||
|
if (provinceCode === "10") {
|
||||||
|
subDomain = "test";
|
||||||
|
// redirectUrl = `https://mid.rasadyar.net/payment?finalAmount=${finalAmount}&saleOrderId=${saleOrderId}&cardHolderPan=${cardHolderPan}&date=${data.date}&saleReferenceId=${saleReferenceId}`;
|
||||||
|
} else if (provinceCode === "15") {
|
||||||
|
subDomain = "sha";
|
||||||
|
// redirectUrl = `https://sha.rasadyar.net/payment?finalAmount=${finalAmount}&saleOrderId=${saleOrderId}&cardHolderPan=${cardHolderPan}&date=${data.date}&saleReferenceId=${saleReferenceId}`;
|
||||||
|
} else if (provinceCode === "18") {
|
||||||
|
subDomain = "ha";
|
||||||
|
// redirectUrl = `https://ha.rasadyar.net/payment?finalAmount=${finalAmount}&saleOrderId=${saleOrderId}&cardHolderPan=${cardHolderPan}&date=${data.date}&saleReferenceId=${saleReferenceId}`;
|
||||||
|
} else if (provinceCode === "91") {
|
||||||
|
subDomain = "ar";
|
||||||
|
// redirectUrl = `https://ar.rasadyar.net/payment?finalAmount=${finalAmount}&saleOrderId=${saleOrderId}&cardHolderPan=${cardHolderPan}&date=${data.date}&saleReferenceId=${saleReferenceId}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
//save success payment into db
|
||||||
|
const url = `https://${subDomain}backend.rasadyar.com/wage_payment_final_step/`;
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
await fetch(url, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
const taavonSendDataZarinPal = async (provinceCode, data) => {
|
||||||
|
// let redirectUrl = "";
|
||||||
|
let subDomain = "test";
|
||||||
|
const province = provinceCode.toString().substring(0, 2);
|
||||||
|
|
||||||
|
if (province === "10") {
|
||||||
|
subDomain = "test";
|
||||||
|
} else if (province === "15") {
|
||||||
|
subDomain = "sha";
|
||||||
|
} else if (province === "18") {
|
||||||
|
subDomain = "ha";
|
||||||
|
} else if (province === "91") {
|
||||||
|
subDomain = "ar";
|
||||||
|
} else if (province === "47") {
|
||||||
|
subDomain = "ma";
|
||||||
|
}
|
||||||
|
|
||||||
|
//save success payment into db
|
||||||
|
const url = `https://${subDomain}backend.rasadyar.com/wage_payment_final_step_zarin_pal/`;
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
await fetch(url, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
const taavonSendDataZarinPalLink = async (provinceCode, data) => {
|
||||||
|
// let redirectUrl = "";
|
||||||
|
let subDomain = "test";
|
||||||
|
const province = provinceCode.toString().substring(0, 2);
|
||||||
|
|
||||||
|
if (province === "10") {
|
||||||
|
subDomain = "test";
|
||||||
|
} else if (province === "15") {
|
||||||
|
subDomain = "sha";
|
||||||
|
} else if (province === "18") {
|
||||||
|
subDomain = "ha";
|
||||||
|
} else if (province === "91") {
|
||||||
|
subDomain = "ar";
|
||||||
|
} else if (province === "47") {
|
||||||
|
subDomain = "ma";
|
||||||
|
}
|
||||||
|
|
||||||
|
//save success payment into db
|
||||||
|
const url = `https://${subDomain}backend.rasadyar.com/wage_payment_with_link_final_step/`;
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify(data),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
await fetch(url, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
taavonSendData,
|
||||||
|
taavonSendDataZarinPal,
|
||||||
|
taavonSendDataZarinPalLink,
|
||||||
|
};
|
||||||
2401
package-lock.json
generated
Normal file
2401
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
package.json
Normal file
23
package.json
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"name": "behpardakht",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"start": "node index.js",
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"axios": "^1.7.2",
|
||||||
|
"body-parser": "^1.20.2",
|
||||||
|
"cors": "^2.8.5",
|
||||||
|
"crypto-js": "^4.2.0",
|
||||||
|
"express": "^4.18.2",
|
||||||
|
"jalaali-js": "^1.2.7",
|
||||||
|
"moment": "^2.29.4",
|
||||||
|
"soap": "^0.16.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user