public void PushWithdrawReject(long id)
        {
            var order  = new UserWithdrawalDAC().GetById(id);
            var wallet = new UserWalletDAC().GetById(order.UserWalletId);
            var coin   = new CryptocurrencyDAC().GetById(wallet.CryptoId);

            var regId = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{order.UserAccountId}");

            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{order.UserAccountId}") ?? "en";
            var titleKey    = "WithdrawalRejectTitle";
            var subTitleKey = "WithdrawalRejectSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var content  = ResourceHelper.FiiiPay.GetFormatResource(titleKey, lang, coin.Code);
            var subTitle = ResourceHelper.FiiiPay.GetResource(subTitleKey, lang);

            string noticeId = "";

            //写MongoDB [提币失败]
            MessagesComponent.AddMessage(order.UserAccountId, UserType.User, order.Id.ToString(), FiiiPayPushType.TYPE_WITHDRAWAL_Reject, titleKey, subTitleKey, coin.Code, content, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_WITHDRAWAL_Reject, new List <string> {
                regId
            }, order.Id, content, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{content}----------{subTitle}");
        }
        public void PushConsume(string id)
        {
            var orderId = Guid.Parse(id);
            var order   = new OrderDAC().GetOrderByOrderId(orderId);
            var coin    = new CryptocurrencyDAC().GetById(order.CryptoId);

            var regId = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{order.UserAccountId}");

            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{order.UserAccountId}") ?? "en";
            var titleKey    = "ConsumeTitle";
            var subTitleKey = "ConsumeSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var content  = ResourceHelper.FiiiPay.GetFormatResource(titleKey, lang, coin.Code);
            var subTitle = ResourceHelper.FiiiPay.GetFormatResource(subTitleKey, lang, coin.Code);

            string noticeId = "";

            //写MongoDB [消费(支付成功)]
            MessagesComponent.AddMessage(order.UserAccountId.Value, UserType.User, order.Id.ToString(), FiiiPayPushType.TYPE_CONSUME, titleKey, subTitleKey, coin.Code, content, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_CONSUME, new List <string> {
                regId
            }, order.Id, content, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{content}----------{subTitle}");
        }
        public void PushKYC_LV2_REJECT(long id)
        {
            var record = new VerifyRecordDAC().GetById(id);

            if (record == null)
            {
                return;
            }

            var regId = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{record.AccountId}");

            var lang = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{record.AccountId}") ?? "en";

            var titleKey    = "KYC_LV2_REJECTTitle";
            var subTitleKey = "KYC_LV2_REJECTSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var title    = ResourceHelper.FiiiPay.GetResource("KYC_LV2_REJECTTitle", new CultureInfo(lang));
            var subTitle = ResourceHelper.FiiiPay.GetResource("KYC_LV2_REJECTSubTitle", new CultureInfo(lang));

            string noticeId = "";

            MessagesComponent.AddMessage(record.AccountId, UserType.User, record.Id.ToString(), FiiiPayPushType.TYPE_USER_KYC_LV2_REJECT, titleKey, subTitleKey, null, title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_USER_KYC_LV2_REJECT, new List <string> {
                regId
            }, id, title, subTitle, Guid.NewGuid().ToString());
            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
        public void PushTransferOut(long id)
        {
            var  transfer  = new UserTransferDAC().GetTransfer(id);
            Guid accountId = transfer.FromUserAccountId;

            var regId = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{accountId}");

            var    lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{accountId}") ?? "en";
            string titleKey    = "TransferOutTitle";
            string subTitleKey = "TransferOutSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var title    = ResourceHelper.FiiiPay.GetFormatResource(titleKey, new CultureInfo(lang), transfer.CoinCode);
            var subTitle = ResourceHelper.FiiiPay.GetResource(subTitleKey, new CultureInfo(lang));

            List <string> regIdList = new List <string> {
                regId
            };

            string noticeId = "";

            MessagesComponent.AddMessage(accountId, UserType.User, id.ToString(), FiiiPayPushType.TYPE_USER_TRANSFER_OUT, titleKey, subTitleKey, transfer.CoinCode, title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_USER_TRANSFER_OUT, regIdList, id, title, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
        public void PushInviteSuccess(long id)
        {
            var pfDAC     = new ProfitDetailDAC();
            var accountId = pfDAC.GetAccountId(id);

            var regId = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{accountId}");

            var    lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{accountId}") ?? "en";
            string titleKey    = "奖励FIII";
            string subTitleKey = "奖励子标题";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var title    = ResourceHelper.FiiiPay.GetResource(titleKey, new CultureInfo(lang));
            var subTitle = ResourceHelper.FiiiPay.GetResource(subTitleKey, new CultureInfo(lang));

            string noticeId = "";

            MessagesComponent.AddMessage(accountId, UserType.User, id.ToString(), FiiiPayPushType.TYPE_INVITE_REWARD, titleKey, subTitleKey, "FIII", title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_INVITE_REWARD, new List <string> {
                regId
            }, id, title, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
        public void PushBiller(Guid id)
        {
            var billerOrder = new BillerOrderDAC().GetById(id);
            var regId       = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{billerOrder.AccountId}");

            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{billerOrder.AccountId}") ?? "en";
            var titleKey    = billerOrder.Status == BillerOrderStatus.Complete ? "BillerTitle" : "BillerFailTitle";
            var subTitleKey = billerOrder.Status == BillerOrderStatus.Complete ? "BillerCompleteSubTitle" : "BillerFailSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var content  = ResourceHelper.FiiiPay.GetFormatResource(titleKey, lang, billerOrder.CryptoCode);
            var subTitle = ResourceHelper.FiiiPay.GetFormatResource(subTitleKey, lang);

            string noticeId = "";

            //写MongoDB [消费(支付成功)]
            MessagesComponent.AddMessage(billerOrder.AccountId, UserType.User, billerOrder.Id.ToString(), billerOrder.Status == BillerOrderStatus.Complete ? FiiiPayPushType.TYPE_BILLER_COMPLETE : FiiiPayPushType.TYPE_BILLER_FAIL, titleKey, subTitleKey, billerOrder.CryptoCode, content, subTitle, out noticeId);

            RegPush(billerOrder.Status == BillerOrderStatus.Complete ? FiiiPayPushType.TYPE_BILLER_COMPLETE : FiiiPayPushType.TYPE_BILLER_FAIL, new List <string> {
                regId
            }, billerOrder.Id, content, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{content}----------{subTitle}");
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="tuple">
        /// Guid为fiiipay用户的id,long为POSMerchantBindRecords的主键
        /// </param>
        public void InviteFiiiposSuccess(Tuple <Guid, long> tuple)
        {
            var record    = new POSMerchantBindRecordDAC().GetById(tuple.Item2);
            var accountId = tuple.Item1;
            var merchant  = new MerchantAccountDAC().GetById(record.MerchantId);

            var regId = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{accountId}");
            var lang  = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{accountId}") ?? "en";

            string titleKey    = "InviteFiiiposSuccessTitle";
            string subTitleKey = "InviteFiiiposSuccessSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var title    = ResourceHelper.FiiiPay.GetResource(titleKey, new CultureInfo(lang));
            var subTitle = ResourceHelper.FiiiPay.GetFormatResource(subTitleKey, new CultureInfo(lang), merchant.MerchantName);

            string noticeId = "";

            MessagesComponent.AddMessage(accountId, UserType.User, record.Id.ToString(), FiiiPayPushType.TYPE_INVITE_FIIIPOS_SUCCESS, titleKey, subTitleKey, merchant.MerchantName, title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_INVITE_FIIIPOS_SUCCESS, new List <string> {
                regId
            }, record.Id, title, subTitle, noticeId);

            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
        /// <summary>
        /// 网关支付
        /// </summary>
        /// <param name="tuple">
        /// Guid为fiiipay用户的id,long为POSMerchantBindRecords的主键
        /// </param>
        public void ShopPaymentRefund(Guid id)
        {
            var record         = new GatewayRefundOrderDAC().GetById(id);
            var order          = new GatewayOrderDAC().GetByOrderId(record.OrderId);
            var cryptoCurrency = new CryptocurrencyDAC().GetById(order.CryptoId);
            var regId          = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{order.UserAccountId}");
            var lang           = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{order.UserAccountId}") ?? "en";

            string titleKey    = "GatewayOrderPaymentRefundTitle";
            string subTitleKey = "GatewayOrderPaymentRefundSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var title    = ResourceHelper.FiiiPay.GetFormatResource(titleKey, new CultureInfo(lang), cryptoCurrency.Code);
            var subTitle = ResourceHelper.FiiiPay.GetResource(subTitleKey, new CultureInfo(lang));

            string noticeId = "";

            MessagesComponent.AddMessage(order.UserAccountId.Value, UserType.User, record.Id.ToString(), FiiiPayPushType.TYPE_GATEWAY_ORDER_PAYMENT_REFUND, titleKey, subTitleKey, cryptoCurrency.Code, title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_GATEWAY_ORDER_PAYMENT_REFUND, new List <string> {
                regId
            }, record.Id, title, subTitle, noticeId);

            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
        public void PushTransferInto(long id)
        {
            var  transfer  = new UserTransferDAC().GetTransfer(id);
            Guid accountId = transfer.ToUserAccountId;

            //TODO:
            //var profile = new UserProfileAgent().GetUserProfile(transfer.FromUserAccountId);
            //string showFullname = (string.IsNullOrEmpty(profile.FirstName) ? "" : "* ") + profile.LastName;
            var regId = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{accountId}");

            var    lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{accountId}") ?? "en";
            string titleKey    = "TransferIntoTitle";
            string subTitleKey = "TransferIntoSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var title    = ResourceHelper.FiiiPay.GetFormatResource(titleKey, new CultureInfo(lang), transfer.CoinCode);
            var subTitle = ResourceHelper.FiiiPay.GetFormatResource(subTitleKey, new CultureInfo(lang), "***");

            List <string> regIdList = new List <string> {
                regId
            };

            string noticeId = "";

            MessagesComponent.AddMessage(accountId, UserType.User, id.ToString(), FiiiPayPushType.TYPE_USER_TRANSFER_INTO, titleKey, subTitleKey, transfer.CoinCode, title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_USER_TRANSFER_INTO, regIdList, id, title, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
Esempio n. 10
0
        public void PushTransferToEx(long id)
        {
            var order  = new UserExTransferOrderDAC().GetById(id);
            var crypto = new CryptocurrencyDAC().GetById(order.CryptoId);

            var regId = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{order.AccountId}");

            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{order.AccountId}") ?? "en";
            var titleKey    = "TransferToFiiiExTitle";
            var subTitleKey = "TransferToFiiiExSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var title    = ResourceHelper.FiiiPay.GetFormatResource(titleKey, new CultureInfo(lang), crypto.Code);
            var subTitle = ResourceHelper.FiiiPay.GetFormatResource(subTitleKey, new CultureInfo(lang), crypto.Code);

            string noticeId = "";

            //写MongoDB []
            MessagesComponent.AddMessage(order.AccountId, UserType.User, id.ToString(), FiiiPayPushType.TYPE_TRANSFER_TO_EX, titleKey, subTitleKey, crypto.Code, title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_TRANSFER_TO_EX, new List <string> {
                regId
            }, id, title, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
Esempio n. 11
0
        public void BackOfficeRefundOrder(string orderno)
        {
            var order = new OrderDAC().GetByOrderNo(orderno);
            var coin  = new CryptocurrencyDAC().GetById(order.CryptoId);

            var regId = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{order.UserAccountId}");

            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{order.UserAccountId}") ?? "en";
            var titleKey    = "BackOfficeRefundOrderTitle";
            var subTitleKey = "BackOfficeRefundOrderSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            //var content = string.Format(Resources.ResourceHelper.GetString(titleKey, new System.Globalization.CultureInfo(lang)), coin.Code);
            //var subTitle = string.Format(Resources.ResourceHelper.GetString(subTitleKey, new System.Globalization.CultureInfo(lang)), coin.Code);
            var content  = ResourceHelper.FiiiPay.GetFormatResource(titleKey, lang, coin.Code);
            var subTitle = ResourceHelper.FiiiPay.GetFormatResource(subTitleKey, lang, coin.Code);

            string noticeId = "";

            //写MongoDB [退款]
            MessagesComponent.AddMessage(order.UserAccountId.Value, UserType.User, order.Id.ToString(), FiiiPayPushType.TYPE_REFUND_ORDER, titleKey, subTitleKey, coin.Code, content, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_REFUND_ORDER, new List <string> {
                regId
            }, order.Id, content, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{content}----------{subTitle}");
        }
        public static void AddPromotionApplied(this MessagesComponent messageComponent, CommerceContext commerceContext,
                                               string awardingBlock)
        {
            var    propertiesModel = commerceContext.GetObject <PropertiesModel>();
            object promotionName   = propertiesModel?.GetPropertyValue("PromotionId") ?? awardingBlock;

            messageComponent.AddMessage(commerceContext.GetPolicy <KnownMessageCodePolicy>().Promotions,
                                        $"PromotionApplied: {promotionName}");
        }
Esempio n. 13
0
        private void PushStoreOrderConsume(StoreOrderMessage order)
        {
            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{order.UserAccountId}") ?? "en";
            var titleKey    = "StoreOrderConsumeTitle";
            var subTitleKey = "StoreOrderConsumeSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var content  = ResourceHelper.FiiiPay.GetFormatResource(titleKey, lang, order.CryptoCode);
            var subTitle = ResourceHelper.FiiiPay.GetFormatResource(subTitleKey, lang, order.CryptoCode);

            MessagesComponent.AddMessage(order.UserAccountId, UserType.User, order.Id.ToString(), FiiiPayPushType.TYPE_STOREORDER_CONSUME, titleKey, subTitleKey, order.CryptoCode, content, subTitle, out string noticeId);
        }
Esempio n. 14
0
        public void PushOrderPayed(Guid orderId)
        {
            var order       = new OrderDAC().GetOrderByOrderId(orderId);
            var coin        = new CryptocurrencyDAC().GetById(order.CryptoId);
            var agent       = new JPushAgent();
            var regId       = RedisHelper.StringGet($"{FiiiPOS_APP_Notice_MerchantId}:{order.MerchantAccountId}");
            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"{FiiiPOS_APP_Language_MerchantId}:{order.MerchantAccountId}") ?? "en";
            var titleKey    = "ReceiptTitle";
            var subTitleKey = "ReceiptSubTitle";

            var content  = ResourceHelper.FiiiPos.GetFormatResource(titleKey, lang, coin.Code);
            var subTitle = ResourceHelper.FiiiPos.GetResource(subTitleKey, lang);

            string noticeId = "";

            //写MongoDB [收款成功]
            MessagesComponent.AddMessage(order.MerchantAccountId, UserType.Merchant, order.Id.ToString(), FiiiPayPushType.TYPE_RECEIPT, titleKey, subTitleKey, coin.Code, content, subTitle, out noticeId);

            var result = agent.Push(new PushPayload
            {
                Audience = new { registration_id = new List <string> {
                                     regId
                                 } },
                Platform     = "all",
                Notification = new Notification
                {
                    Alert   = content,
                    Android = new Android
                    {
                        Alert  = subTitle,
                        Title  = content,
                        Extras = PushHelper.GetNewExtras(FiiiPayPushType.TYPE_RECEIPT, orderId, content, subTitle, noticeId)
                    }
                },
                Message = new Message
                {
                    Content = content,
                    Extras  = PushHelper.GetNewExtras(FiiiPayPushType.TYPE_RECEIPT, orderId, content, subTitle, noticeId)
                },
                Options = new Options {
                    IsApnsProduction = IsPushProduction
                }
            });

            LogHelper.Info($"--------{lang}------{content}----------{subTitle}");
        }
Esempio n. 15
0
        public void MerchantLv2Verified(long id)
        {
            var record = new VerifyRecordDAC().GetById(id);

            var    regId       = RedisHelper.StringGet($"{FiiiPOS_APP_Notice_MerchantId}:{record.AccountId}");
            var    lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"{FiiiPOS_APP_Language_MerchantId}:{record.AccountId}") ?? "en";
            var    titleKey    = "MerchantLv2Verified";
            var    subTitleKey = "MerchantLv2VerifiedSubTitle";
            var    title       = ResourceHelper.FiiiPos.GetResource(titleKey, lang);
            var    subTitle    = ResourceHelper.FiiiPos.GetResource(subTitleKey, lang);
            string noticeId    = "";

            MessagesComponent.AddMessage(record.AccountId, UserType.Merchant, record.Id.ToString(), FiiiPayPushType.TYPE_Merchant_KYC_LV2_VERIFIED, titleKey, subTitleKey, null, title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_Merchant_KYC_LV2_VERIFIED, new List <string> {
                regId
            }, id, title, subTitle, Guid.NewGuid().ToString());
            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
Esempio n. 16
0
        public void PushInviteSuccess(long id)
        {
            var pfDAC     = new ProfitDetailDAC();
            var accountId = pfDAC.GetAccountId(id);

            var    regId       = RedisHelper.StringGet($"{FiiiPOS_APP_Notice_MerchantId}:{accountId}");
            var    lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"{FiiiPOS_APP_Language_MerchantId}:{accountId}") ?? "en";
            string titleKey    = "奖励FIII";
            string subTitleKey = "奖励子标题";
            var    title       = ResourceHelper.FiiiPos.GetResource(titleKey, new CultureInfo(lang));
            var    subTitle    = ResourceHelper.FiiiPos.GetResource(subTitleKey, new CultureInfo(lang));

            string noticeId = "";

            MessagesComponent.AddMessage(accountId, UserType.User, id.ToString(), FiiiPayPushType.TYPE_INVITE_REWARD, titleKey, subTitleKey, "FIII", title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_INVITE_REWARD, new List <string> {
                regId
            }, id, title, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
Esempio n. 17
0
        public void FiiipayMerchantProfileVerified(FiiiPayMerchantProfileVerified profileMessage)
        {
            var    regId = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{profileMessage.AccountId}");
            var    lang = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{profileMessage.AccountId}") ?? "en";
            string titleKey = "", subTitleKey = "";
            int    pushType;

            if (profileMessage.VerifyResult == Entities.Enums.VerifyStatus.Certified)
            {
                titleKey    = "FiiipayMerchantCertifiedTitle";
                subTitleKey = "FiiipayMerchantCertifiedSubTitle";
                pushType    = FiiiPayPushType.FIIIPAY_MERCHANT_VERIFIED;
            }
            else if (profileMessage.VerifyResult == Entities.Enums.VerifyStatus.Disapproval)
            {
                titleKey    = "FiiipayMerchantDisapprovalTitle";
                subTitleKey = "FiiipayMerchantDisapprovalSubTitle";
                pushType    = FiiiPayPushType.FIIIPAY_MERCHANT_DISAPPROVED;
            }
            else
            {
                return;
            }
            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception($"没有找到资源:{titleKey},{subTitleKey}");
            }
            var content  = ResourceHelper.FiiiPay.GetFormatResource(titleKey, lang);
            var subTitle = ResourceHelper.FiiiPay.GetFormatResource(subTitleKey, lang);

            string noticeId = "";

            LogHelper.Info($"--------{lang}------{content}----------{subTitle}");

            MessagesComponent.AddMessage(profileMessage.AccountId, UserType.User, profileMessage.VerifyRecordId.ToString(), pushType, titleKey, subTitleKey, null, content, subTitle, out noticeId);

            RegPush(pushType, new List <string> {
                regId
            }, profileMessage.VerifyRecordId, content, subTitle, noticeId);
        }
Esempio n. 18
0
        public void PushTransferToEx(long id)
        {
            var order  = new MerchantExTransferOrderDAC().GetById(id);
            var crypto = new CryptocurrencyDAC().GetById(order.CryptoId);

            var regId       = RedisHelper.StringGet($"{FiiiPOS_APP_Notice_MerchantId}:{order.AccountId}");
            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"{FiiiPOS_APP_Language_MerchantId}:{order.AccountId}") ?? "en";
            var titleKey    = "TransferToFiiiExTitle";
            var subTitleKey = "TransferToFiiiExSubTitle";
            var title       = ResourceHelper.FiiiPos.GetFormatResource(titleKey, lang, crypto.Code);
            var subTitle    = ResourceHelper.FiiiPos.GetFormatResource(subTitleKey, lang, crypto.Code);

            string noticeId = "";

            //写MongoDB []
            MessagesComponent.AddMessage(order.AccountId, UserType.Merchant, id.ToString(), FiiiPayPushType.TYPE_TRANSFER_TO_EX, titleKey, subTitleKey, crypto.Code, title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_TRANSFER_TO_EX, new List <string> {
                regId
            }, id, title, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
Esempio n. 19
0
        public void PushWithdrawReject(long id)
        {
            var withdraw = new MerchantWithdrawalDAC().GetById(id);
            var wallet   = new MerchantWalletDAC().GetById(withdraw.MerchantWalletId);
            var crypto   = new CryptocurrencyDAC().GetById(wallet.CryptoId);

            var regId       = RedisHelper.StringGet($"{FiiiPOS_APP_Notice_MerchantId}:{withdraw.MerchantAccountId}");
            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"{FiiiPOS_APP_Language_MerchantId}:{withdraw.MerchantAccountId}") ?? "en";
            var titleKey    = "WithdrawalRejectTitle";
            var subTitleKey = "WithdrawalRejectSubTitle";
            var title       = ResourceHelper.FiiiPos.GetFormatResource(titleKey, lang, crypto.Code);
            var subTitle    = ResourceHelper.FiiiPos.GetResource(subTitleKey, lang);

            string noticeId = "";

            //写MongoDB [提币失败]
            MessagesComponent.AddMessage(withdraw.MerchantAccountId, UserType.Merchant, id.ToString(), FiiiPayPushType.TYPE_WITHDRAWAL_Reject, titleKey, subTitleKey, crypto.Code, title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_WITHDRAWAL_Reject, new List <string> {
                regId
            }, id, title, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
Esempio n. 20
0
        public void PushRefundOrder(string orderno)
        {
            var order = new OrderDAC().GetByOrderNo(orderno);
            var coin  = new CryptocurrencyDAC().GetById(order.CryptoId);

            var regId       = RedisHelper.StringGet($"{FiiiPOS_APP_Notice_MerchantId}:{order.MerchantAccountId}");
            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"{FiiiPOS_APP_Language_MerchantId}:{order.MerchantAccountId}") ?? "en";
            var titleKey    = "BackOfficeRefundOrderTitle";
            var subTitleKey = "BackOfficeRefundOrderSubTitle";
            var content     = ResourceHelper.FiiiPos.GetFormatResource(titleKey, lang, coin.Code);
            var subTitle    = ResourceHelper.FiiiPos.GetFormatResource(subTitleKey, lang, coin.Code);

            string noticeId = "";

            //写MongoDB [提币成功]
            MessagesComponent.AddMessage(order.MerchantAccountId, UserType.Merchant, order.Id.ToString(), FiiiPayPushType.TYPE_REFUND_ORDER, titleKey, subTitleKey, coin.Code, content, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_REFUND_ORDER, new List <string> {
                regId
            }, order.Id, content, subTitle, noticeId);

            LogHelper.Info($"--------{lang}------{content}----------{subTitle}");
        }
Esempio n. 21
0
        public void PushDepositCancel(long id)
        {
            var deposit = new MerchantDepositDAC().GetById(id);
            var wallet  = new MerchantWalletDAC().GetById(deposit.MerchantWalletId);
            var crypto  = new CryptocurrencyDAC().GetById(wallet.CryptoId);

            var regId       = RedisHelper.StringGet($"{FiiiPOS_APP_Notice_MerchantId}:{deposit.MerchantAccountId}");
            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"{FiiiPOS_APP_Language_MerchantId}:{deposit.MerchantAccountId}") ?? "en";
            var titleKey    = "DepositCancelTitle";
            var subTitleKey = "DepositCancelSubTitle";
            var title       = ResourceHelper.FiiiPos.GetFormatResource(titleKey, lang, crypto.Code);
            var subTitle    = ResourceHelper.FiiiPos.GetFormatResource(subTitleKey, lang, crypto.Code);

            string noticeId = "";

            //写MongoDB [充币失败]
            MessagesComponent.AddMessage(deposit.MerchantAccountId, UserType.Merchant, id.ToString(), FiiiPayPushType.TYPE_DEPOSIT_CANCEL, titleKey, subTitleKey, crypto.Code, title, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_DEPOSIT_CANCEL, new List <string> {
                regId
            }, id, title, subTitle, noticeId);
            LogHelper.Info($"--------{lang}------{title}----------{subTitle}");
        }
Esempio n. 22
0
        private void PushStoreOrderIncome(StoreOrderMessage order)
        {
            var regId       = RedisHelper.StringGet($"FiiiPay:Notice:UserId:{order.MerchantInfoId}");
            var lang        = RedisHelper.StringGet(REDIS_LANGUAGE_DBINDEX, $"FiiiPay:Language:{order.MerchantInfoId}") ?? "en";
            var titleKey    = "StoreOrderIncomeTitle";
            var subTitleKey = "StoreOrderIncomeSubTitle";

            if (!(_resourcePropertyNames.Contains(titleKey) && _resourcePropertyNames.Contains(subTitleKey)))
            {
                throw new Exception("没有找到资源");
            }
            var content  = ResourceHelper.FiiiPay.GetFormatResource(titleKey, lang, order.CryptoCode);
            var subTitle = ResourceHelper.FiiiPay.GetFormatResource(subTitleKey, lang, order.CryptoCode);

            string noticeId = "";

            LogHelper.Info($"--------{lang}------{content}----------{subTitle}");

            MessagesComponent.AddMessage(order.MerchantInfoId, UserType.User, order.Id.ToString(), FiiiPayPushType.TYPE_STOREORDER_INCOME, titleKey, subTitleKey, order.CryptoCode, content, subTitle, out noticeId);

            RegPush(FiiiPayPushType.TYPE_STOREORDER_INCOME, new List <string> {
                regId
            }, order.Id, content, subTitle, noticeId);
        }
Esempio n. 23
0
        private async Task <bool?> CalculateCartLinePrice(
            CartLineComponent arg,
            CommercePipelineExecutionContext context)
        {
            ProductArgument productArgument = ProductArgument.FromItemId(arg.ItemId);
            SellableItem    sellableItem    = null;

            if (productArgument.IsValid())
            {
                sellableItem = context.CommerceContext.GetEntity((Func <SellableItem, bool>)(s => s.ProductId.Equals(productArgument.ProductId, StringComparison.OrdinalIgnoreCase)));

                if (sellableItem == null)
                {
                    string simpleName = productArgument.ProductId.SimplifyEntityName();
                    sellableItem = context.CommerceContext.GetEntity((Func <SellableItem, bool>)(s => s.ProductId.Equals(simpleName, StringComparison.OrdinalIgnoreCase)));

                    if (sellableItem != null)
                    {
                        sellableItem.ProductId = simpleName;
                    }
                }
            }
            if (sellableItem == null)
            {
                CommercePipelineExecutionContext executionContext = context;
                CommerceContext commerceContext = context.CommerceContext;
                string          error           = context.GetPolicy <KnownResultCodes>().Error;
                object[]        args            = new object[] { arg.ItemId };
                string          defaultMessage  = "Item '" + arg.ItemId + "' is not purchasable.";
                executionContext.Abort(await commerceContext.AddMessage(error, "LineIsNotPurchasable", args, defaultMessage), context);
                executionContext = null;
                return(new bool?());
            }

            MessagesComponent messagesComponent = arg.GetComponent <MessagesComponent>();

            messagesComponent.Clear(context.GetPolicy <KnownMessageCodePolicy>().Pricing);

            if (sellableItem.HasComponent <MessagesComponent>())
            {
                List <MessageModel> messages = sellableItem.GetComponent <MessagesComponent>().GetMessages(context.GetPolicy <KnownMessageCodePolicy>().Pricing);
                messagesComponent.AddMessages(messages);
            }
            arg.UnitListPrice = sellableItem.ListPrice;
            string listPriceMessage = "CartItem.ListPrice<=SellableItem.ListPrice: Price=" + arg.UnitListPrice.AsCurrency(false, null);
            string sellPriceMessage = string.Empty;
            PurchaseOptionMoneyPolicy optionMoneyPolicy = new PurchaseOptionMoneyPolicy();

            if (sellableItem.HasPolicy <PurchaseOptionMoneyPolicy>())
            {
                optionMoneyPolicy.SellPrice = sellableItem.GetPolicy <PurchaseOptionMoneyPolicy>().SellPrice;
                sellPriceMessage            = "CartItem.SellPrice<=SellableItem.SellPrice: Price=" + optionMoneyPolicy.SellPrice.AsCurrency(false, null);
            }

            PriceSnapshotComponent snapshotComponent;

            if (sellableItem.HasComponent <ItemVariationsComponent>())
            {
                ItemVariationSelectedComponent lineVariant             = arg.ChildComponents.OfType <ItemVariationSelectedComponent>().FirstOrDefault();
                ItemVariationsComponent        itemVariationsComponent = sellableItem.GetComponent <ItemVariationsComponent>();
                ItemVariationComponent         itemVariationComponent;

                if (itemVariationsComponent == null)
                {
                    itemVariationComponent = null;
                }
                else
                {
                    IList <Component> childComponents = itemVariationsComponent.ChildComponents;
                    itemVariationComponent = childComponents?.OfType <ItemVariationComponent>().FirstOrDefault(v =>
                    {
                        return(!string.IsNullOrEmpty(v.Id) ? v.Id.Equals(lineVariant?.VariationId, StringComparison.OrdinalIgnoreCase) : false);
                    });
                }

                if (itemVariationComponent != null)
                {
                    if (itemVariationComponent.HasComponent <MessagesComponent>())
                    {
                        List <MessageModel> messages = itemVariationComponent.GetComponent <MessagesComponent>().GetMessages(context.GetPolicy <KnownMessageCodePolicy>().Pricing);
                        messagesComponent.AddMessages(messages);
                    }

                    arg.UnitListPrice = itemVariationComponent.ListPrice;
                    listPriceMessage  = "CartItem.ListPrice<=SellableItem.Variation.ListPrice: Price=" + arg.UnitListPrice.AsCurrency(false, null);

                    if (itemVariationComponent.HasPolicy <PurchaseOptionMoneyPolicy>())
                    {
                        optionMoneyPolicy.SellPrice = itemVariationComponent.GetPolicy <PurchaseOptionMoneyPolicy>().SellPrice;
                        sellPriceMessage            = "CartItem.SellPrice<=SellableItem.Variation.SellPrice: Price=" + optionMoneyPolicy.SellPrice.AsCurrency(false, null);
                    }
                }
                snapshotComponent = itemVariationComponent != null?itemVariationComponent.ChildComponents.OfType <PriceSnapshotComponent>().FirstOrDefault() : null;
            }
            else
            {
                snapshotComponent = sellableItem.Components.OfType <PriceSnapshotComponent>().FirstOrDefault();
            }

            string currentCurrency = context.CommerceContext.CurrentCurrency();

            PriceTier priceTier = snapshotComponent?.Tiers.OrderByDescending(t => t.Quantity).FirstOrDefault(t =>
            {
                return(t.Currency.Equals(currentCurrency, StringComparison.OrdinalIgnoreCase) ? t.Quantity <= arg.Quantity : false);
            });

            Customer customer = await _findEntityPipeline.Run(new FindEntityArgument(typeof(Customer), context.CommerceContext.CurrentCustomerId(), false), context) as Customer;

            bool isMembershipLevelPrice = false;

            if (customer != null && customer.HasComponent <MembershipSubscriptionComponent>())
            {
                var membershipSubscriptionComponent = customer.GetComponent <MembershipSubscriptionComponent>();
                var membershipLevel = membershipSubscriptionComponent.MemerbshipLevelName;

                if (snapshotComponent != null && snapshotComponent.HasComponent <MembershipTiersComponent>())
                {
                    var membershipTiersComponent = snapshotComponent.GetComponent <MembershipTiersComponent>();
                    var membershipPriceTier      = membershipTiersComponent.Tiers.FirstOrDefault(x => x.MembershipLevel == membershipLevel);

                    if (membershipPriceTier != null)
                    {
                        optionMoneyPolicy.SellPrice = new Money(membershipPriceTier.Currency, membershipPriceTier.Price);
                        isMembershipLevelPrice      = true;

                        sellPriceMessage = string.Format("CartItem.SellPrice<=PriceCard.ActiveSnapshot: MembershipLevel={0}|Price={1}|Qty={2}", membershipSubscriptionComponent.MemerbshipLevelName, optionMoneyPolicy.SellPrice.AsCurrency(false, null), membershipPriceTier.Quantity);
                    }
                }
            }

            if (!isMembershipLevelPrice && priceTier != null)
            {
                optionMoneyPolicy.SellPrice = new Money(priceTier.Currency, priceTier.Price);
                sellPriceMessage            = string.Format("CartItem.SellPrice<=PriceCard.ActiveSnapshot: Price={0}|Qty={1}", optionMoneyPolicy.SellPrice.AsCurrency(false, null), priceTier.Quantity);
            }

            arg.Policies.Remove(arg.Policies.OfType <PurchaseOptionMoneyPolicy>().FirstOrDefault());

            if (optionMoneyPolicy.SellPrice == null)
            {
                return(false);
            }

            arg.SetPolicy(optionMoneyPolicy);

            if (!string.IsNullOrEmpty(sellPriceMessage))
            {
                messagesComponent.AddMessage(context.GetPolicy <KnownMessageCodePolicy>().Pricing, sellPriceMessage);
            }

            if (!string.IsNullOrEmpty(listPriceMessage))
            {
                messagesComponent.AddMessage(context.GetPolicy <KnownMessageCodePolicy>().Pricing, listPriceMessage);
            }

            return(true);
        }
Esempio n. 24
0
        public override async Task <SellableItem> Run(
            SellableItem arg,
            CommercePipelineExecutionContext context)
        {
            if (arg == null)
            {
                return(null);
            }

            if (arg.HasPolicy <PurchaseOptionMoneyPolicy>() && arg.GetPolicy <PurchaseOptionMoneyPolicy>().Expires > DateTimeOffset.UtcNow && arg.GetPolicy <PurchaseOptionMoneyPolicy>().SellPrice.CurrencyCode.Equals(context.CommerceContext.CurrentCurrency(), StringComparison.OrdinalIgnoreCase))
            {
                return(arg);
            }

            if (arg.HasComponent <PriceSnapshotComponent>())
            {
                arg.Components.Remove(arg.GetComponent <PriceSnapshotComponent>());
            }

            string                 currentCurrency   = context.CommerceContext.CurrentCurrency();
            MessagesComponent      messagesComponent = arg.GetComponent <MessagesComponent>();
            Money                  sellPrice         = null;
            PriceCardPolicy        priceCardPolicy   = arg.Policies.OfType <PriceCardPolicy>().FirstOrDefault();
            PriceSnapshotComponent snapshotComponent = null;
            bool pricingByTags = false;

            if (!string.IsNullOrEmpty(priceCardPolicy?.PriceCardName))
            {
                snapshotComponent = await _resolveSnapshotByCardPipeline.Run(priceCardPolicy.PriceCardName, context);
            }
            else if (arg.Tags.Any())
            {
                snapshotComponent = await _resolveSnapshotByTagsPipeline.Run(arg.Tags, context);

                pricingByTags = true;
            }

            PriceTier priceTier = snapshotComponent?.Tiers.FirstOrDefault(t =>
            {
                return(t.Currency.Equals(currentCurrency, StringComparison.OrdinalIgnoreCase) ? t.Quantity == decimal.One : false);
            });

            Customer customer = await _findEntityPipeline.Run(new FindEntityArgument(typeof(Customer), context.CommerceContext.CurrentCustomerId(), false), context) as Customer;

            bool isMembershipLevelPrice = false;

            if (customer != null && customer.HasComponent <MembershipSubscriptionComponent>())
            {
                var membershipSubscriptionComponent = customer.GetComponent <MembershipSubscriptionComponent>();
                var customerMemerbshipLevelName     = membershipSubscriptionComponent.MemerbshipLevelName;
                var memerbshipLevelName             = membershipSubscriptionComponent.MemerbshipLevelName;

                if (snapshotComponent != null && snapshotComponent.HasComponent <MembershipTiersComponent>())
                {
                    var membershipTiersComponent = snapshotComponent.GetComponent <MembershipTiersComponent>();
                    var membershipPriceTier      = membershipTiersComponent.Tiers.FirstOrDefault(x => x.MembershipLevel == memerbshipLevelName);

                    if (membershipPriceTier != null)
                    {
                        sellPrice = new Money(membershipPriceTier.Currency, membershipPriceTier.Price);
                        isMembershipLevelPrice = true;
                        messagesComponent.AddMessage(context.GetPolicy <KnownMessageCodePolicy>().Pricing, pricingByTags
                            ? string.Format("SellPrice<=Tags.Snapshot: MembershipLevel={0}|Price={1}|Qty={2}|Tags='{3}'", customerMemerbshipLevelName, sellPrice.AsCurrency(false, null), membershipPriceTier.Quantity, string.Join(", ", snapshotComponent.Tags.Select(c => c.Name)))
                            : string.Format("SellPrice<=PriceCard.Snapshot: MembershipLevel={0}|Price={1}|Qty={2}|PriceCard={3}", customerMemerbshipLevelName, sellPrice.AsCurrency(false, null), membershipPriceTier.Quantity, priceCardPolicy.PriceCardName));
                    }
                }
            }

            if (!isMembershipLevelPrice && priceTier != null)
            {
                sellPrice = new Money(priceTier.Currency, priceTier.Price);
                messagesComponent.AddMessage(context.GetPolicy <KnownMessageCodePolicy>().Pricing, pricingByTags ? string.Format("SellPrice<=Tags.Snapshot: Price={0}|Qty={1}|Tags='{2}'", sellPrice.AsCurrency(false, null), priceTier.Quantity, string.Join(", ", snapshotComponent.Tags.Select(c => c.Name))) : string.Format("SellPrice<=PriceCard.Snapshot: Price={0}|Qty={1}|PriceCard={2}", sellPrice.AsCurrency(false, null), priceTier.Quantity, priceCardPolicy.PriceCardName));
            }

            if (snapshotComponent != null)
            {
                arg.SetComponent(snapshotComponent);
            }

            if (sellPrice != null)
            {
                arg.SetPolicy(new PurchaseOptionMoneyPolicy()
                {
                    SellPrice = sellPrice
                });
            }

            return(arg);
        }