@@ -5375,7 +5375,6 @@ export class WalletService {
53755375 this . _handleSendSuccesMerchantOrder (
53765376 amountCoinUserSentToServer ,
53775377 amountElps ,
5378- txId ,
53795378 merchantOrder ,
53805379 merchant . name
53815380 ) ;
@@ -5418,7 +5417,6 @@ export class WalletService {
54185417 this . _handleSendSuccesMerchantOrder (
54195418 amountCoinUserSentToServer ,
54205419 amountElps ,
5421- txId ,
54225420 merchantOrder ,
54235421 merchant . name
54245422 ) ;
@@ -5464,9 +5462,9 @@ export class WalletService {
54645462 async _handleSendSuccesMerchantOrder (
54655463 amountCoinUserSentToServer ,
54665464 amountElps ,
5467- txId ,
54685465 merchantOrder : MerchantOrder ,
5469- merchantName
5466+ merchantName ,
5467+ isPaidByUser = false
54705468 ) {
54715469 if ( amountCoinUserSentToServer > 0 ) {
54725470 bot . sendMessage (
@@ -5504,8 +5502,13 @@ export class WalletService {
55045502 config . conversion . tokenCodeUnit +
55055503 ' to ' +
55065504 merchantName +
5505+ ( isPaidByUser ? ' :: is Paid by user' : '' ) +
55075506 '\n\n' +
5508- this . _addExplorerLinkIntoTxIdWithCoin ( merchantOrder . txIdMerchantPayment , 'xec' , 'View tx on the Explorer' ) ,
5507+ this . _addExplorerLinkIntoTxIdWithCoin (
5508+ isPaidByUser ? merchantOrder . txIdFromUser : merchantOrder . txIdMerchantPayment ,
5509+ 'xec' ,
5510+ 'View tx on the Explorer'
5511+ ) ,
55095512 { parse_mode : 'HTML' }
55105513 ) ;
55115514 }
@@ -6265,21 +6268,31 @@ export class WalletService {
62656268 return cb ( new Error ( 'Can not find config for conversion' ) ) ;
62666269 }
62676270 const merchantOrder = MerchantOrder . create ( opts ) ;
6271+ const listMerchant = this . getListMerchantInfo ( ) ;
6272+ if ( ! listMerchant || listMerchant . length < 1 ) {
6273+ return cb ( 'Can not find list merchant on server' ) ;
6274+ }
6275+ const merchantSelected = listMerchant . find ( merchant => merchant . code === merchantOrder . merchantCode ) ;
6276+ if ( ! merchantSelected ) {
6277+ return cb ( 'Can not find selected merchant on server' ) ;
6278+ }
62686279 if ( merchantOrder . isPaidByUser ) {
62696280 merchantOrder . paymentType = PaymentType . SEND ;
62706281 this . storage . storeMerchantOrder ( merchantOrder , async ( err , result ) => {
62716282 if ( err ) return cb ( err ) ;
62726283 // let order into queue
62736284 try {
6274- await this . _handleEmailNotificationForMerchantOrder ( merchantOrder ) ;
6285+ const amountToken =
6286+ merchantOrder . qpayInfoForEmail . amountToken === 0
6287+ ? merchantOrder . qpayInfoForEmail . amountPay
6288+ : merchantOrder . qpayInfoForEmail . amountToken ;
6289+ await this . _handleSendSuccesMerchantOrder ( 0 , amountToken , merchantOrder , merchantSelected . name , true ) ;
62756290 } catch ( e ) {
62766291 logger . debug ( 'email sent to user error: ' , e ) ;
62776292 }
62786293 return cb ( null , true ) ;
62796294 } ) ;
62806295 } else {
6281- const listMerchant = this . getListMerchantInfo ( ) ;
6282- const merchantSelected = listMerchant . find ( merchant => merchant . code === merchantOrder . merchantCode ) ;
62836296 if ( ! merchantSelected . isElpsAccepted ) {
62846297 merchantOrder . paymentType = PaymentType . BURN ;
62856298 if ( ! opts . signature ) {
@@ -6359,7 +6372,7 @@ export class WalletService {
63596372 await googleSheets . spreadsheets . values . append ( {
63606373 auth,
63616374 spreadsheetId,
6362- range : sheetName + '!A:M ' ,
6375+ range : sheetName + '!A:R ' ,
63636376 valueInputOption : 'USER_ENTERED' ,
63646377 resource : {
63656378 values : [
@@ -6368,6 +6381,7 @@ export class WalletService {
63686381 merchantOrder . userAddress ,
63696382 merchantOrder . userEmailAddress ,
63706383 merchantOrder . qpayInfoForEmail . taxId || '' ,
6384+ merchantOrder . qpayInfoForEmail . idNumber || '' ,
63716385 merchantOrder . qpayInfoForEmail . street || '' ,
63726386 merchantOrder . qpayInfoForEmail . unitNumber || '' ,
63736387 merchantOrder . qpayInfoForEmail . paymentReason || '' ,
0 commit comments