public void RegisterNotification(JObject data) { string PROC_NOTIFY = "spu_insert_mobiera_payment_notification"; fullDateFormat = "yyyy-MM-dd HH:mm:ss"; shortDateFormat = "yyyy-MM-dd HH:mm"; JObject joAmountTransaction = JsonUtil.AsJObject(data, "amountTransaction"); msisdn = JsonUtil.AsString(joAmountTransaction, "endUserId", ""); msisdn = msisdn.Substring(8, msisdn.Length - 8); endUserId = JsonUtil.AsString(joAmountTransaction, "endUserId", ""); mandate_id = JsonUtil.AsInteger64(joAmountTransaction, "mandateId"); identifier_id = JsonUtil.AsInteger64(joAmountTransaction, "identifierId"); identifier_label = JsonUtil.AsString(joAmountTransaction, "identifierLabel", ""); identifier_class = JsonUtil.AsString(joAmountTransaction, "identifierClass", ""); service_identifier_id = JsonUtil.AsInteger(joAmountTransaction, "serviceIdentifierId"); JObject joPaymentAmount = JsonUtil.AsJObject(joAmountTransaction, "paymentAmount"); JObject joChargingInformation = JsonUtil.AsJObject(joPaymentAmount, "chargingInformation"); amount = JsonUtil.AsDouble(joChargingInformation, "amount"); currency = JsonUtil.AsString(joChargingInformation, "currency", ""); charging_description = JsonUtil.AsString(joChargingInformation, "description", ""); total_amount_charged = JsonUtil.AsDouble(joPaymentAmount, "totalAmountCharged"); JObject joCchargingMetaData = JsonUtil.AsJObject(joPaymentAmount, "chargingMetaData"); channel = JsonUtil.AsString(joCchargingMetaData, "channel", ""); tax_amount = JsonUtil.AsDouble(joCchargingMetaData, "taxAmount"); charging_event = JsonUtil.AsString(joCchargingMetaData, "chargingEvent", ""); server_reference_code = JsonUtil.AsInteger64(joAmountTransaction, "serverReferenceCode"); resource_url = JsonUtil.AsString(joAmountTransaction, "resourceURL", ""); transaction_operation_status = JsonUtil.AsString(joAmountTransaction, "transactionOperationStatus", ""); charging_service_exception = JsonUtil.AsString(joAmountTransaction, "chargingServiceException", ""); charging_policy_exception = JsonUtil.AsString(joAmountTransaction, "chargingPolicyException", ""); try { SqlParameter[] parameters = new SqlParameter[21]; parameters[0] = new SqlParameter("@mobiera_payment_notification_id", DbType.Int64); parameters[0].Direction = ParameterDirection.Output; parameters[1] = new SqlParameter("@endUserId", DbType.String); parameters[1].Value = endUserId; parameters[2] = new SqlParameter("@msisdn", DbType.String); parameters[2].Value = msisdn; parameters[3] = new SqlParameter("@mandate_id", DbType.Int64); parameters[3].Value = mandate_id; parameters[4] = new SqlParameter("@identifier_id", DbType.Int64); parameters[4].Value = identifier_id; parameters[5] = new SqlParameter("@identifier_label", DbType.String); parameters[5].Value = identifier_label; parameters[6] = new SqlParameter("@identifier_class", DbType.String); parameters[6].Value = identifier_class; parameters[7] = new SqlParameter("@service_identifier_id", DbType.Int32); parameters[7].Value = service_identifier_id; parameters[8] = new SqlParameter("@amount", DbType.Decimal); parameters[8].Value = amount; parameters[9] = new SqlParameter("@currency", DbType.String); parameters[9].Value = currency; parameters[10] = new SqlParameter("@charging_description", DbType.String); parameters[10].Value = charging_description; parameters[11] = new SqlParameter("@total_amount_charged", DbType.Decimal); parameters[11].Value = total_amount_charged; parameters[12] = new SqlParameter("@channel", DbType.String); parameters[12].Value = channel; parameters[13] = new SqlParameter("@tax_amount", DbType.Decimal); parameters[13].Value = tax_amount; parameters[14] = new SqlParameter("@charging_event", DbType.String); parameters[14].Value = charging_event; parameters[15] = new SqlParameter("@server_reference_code", DbType.Int64); parameters[15].Value = server_reference_code; parameters[16] = new SqlParameter("@resource_url", DbType.String); parameters[16].Value = resource_url; parameters[17] = new SqlParameter("@transaction_operation_status", DbType.String); parameters[17].Value = transaction_operation_status; parameters[18] = new SqlParameter("@created_by", DbType.Int32); parameters[18].Value = 1; parameters[19] = new SqlParameter("@charging_service_exception", DbType.String); parameters[19].Value = charging_service_exception; parameters[20] = new SqlParameter("@charging_policy_exception", DbType.String); parameters[20].Value = charging_policy_exception; ExecuteNonQuery(InstanceName, CommandType.StoredProcedure, PROC_NOTIFY, parameters); mobiera_payment_notification_id = DataUtil.AsInteger64(parameters[0].Value, false); } catch (Exception ex) { ErrorAssignation(ERROR_CODE.GENR_NewIDNotGenerated, ex.Message, ex.StackTrace, url); throw ex; } finally { if (errorCode != ERROR_CODE.OK) { Insert_Error_log(); } } //return mobiera_payment_notification_id; }
public long RegisterSubscriptionNotification(JObject data) { PROC_NOTIFY = "spu_insert_mobiera_subscription_notification"; fullDateFormat = "yyyy-MM-dd HH:mm:ss"; shortDateFormat = "yyyy-MM-dd HH:mm"; JObject subscription = JsonUtil.AsJObject(data, "subscription"); operator_service_id = JsonUtil.AsString(subscription, "serviceId", ""); service_identifier_id = JsonUtil.AsString(subscription, "serviceIdentifierId", ""); msisdn = JsonUtil.AsString(subscription, "endUserId", ""); msisdn = msisdn.Substring(8, msisdn.Length - 8); endUserId = JsonUtil.AsString(subscription, "endUserId", ""); identifier_id = JsonUtil.AsString(subscription, "identifierId", ""); identifier_label = JsonUtil.AsString(subscription, "identifierLabel", ""); identifier_class = JsonUtil.AsString(subscription, "identifierClass", ""); landing_id = JsonUtil.AsString(subscription, "landingId", ""); reference_code = JsonUtil.AsString(subscription, "referenceCode", ""); tracking_param = JsonUtil.AsString(subscription, "trackingParam", ""); periodicity = JsonUtil.AsString(subscription, "subscriptionPeriodicity", ""); string str_start_on = JsonUtil.AsString(subscription, "subscriptionStartDateTime"); str_start_on = str_start_on.Substring(0, 19); str_start_on = str_start_on.Replace("T", " "); start_on = DataUtil.AsDateTime(str_start_on, fullDateFormat, DataUtil.AsDateTime(str_start_on, shortDateFormat, DateTime.MinValue, false), false); string str_expire_on = JsonUtil.AsString(subscription, "subscriptionValidUntilDateTime"); str_expire_on = str_expire_on.Substring(0, 19); str_expire_on = str_expire_on.Replace("T", " "); expire_on = DataUtil.AsDateTime(str_expire_on, fullDateFormat, DataUtil.AsDateTime(str_expire_on, shortDateFormat, DateTime.MinValue, false), false); operator_subscription_id = JsonUtil.AsString(subscription, "subscriptionId", ""); resource_url = JsonUtil.AsString(subscription, "resourceURL", ""); string str_created_on = JsonUtil.AsString(subscription, "subscriptionStartDateTime"); str_created_on = str_created_on.Substring(0, 19); str_created_on = str_created_on.Replace("T", " "); created_on = DataUtil.AsDateTime(str_created_on, fullDateFormat, DataUtil.AsDateTime(str_created_on, shortDateFormat, DateTime.MinValue, false), false); subscription_operation_status = JsonUtil.AsString(subscription, "subscriptionOperationStatus", ""); campaign_id = JsonUtil.AsString(subscription, "campaignId", ""); try { SqlParameter[] parameters = new SqlParameter[19]; parameters[0] = new SqlParameter("@mobiera_subscription_notification_id", DbType.Int64); parameters[0].Value = mobiera_subscription_notification_id; parameters[1] = new SqlParameter("@operator_service_id", DbType.String); parameters[1].Value = operator_service_id; parameters[2] = new SqlParameter("@service_identifier_id", DbType.String); parameters[2].Value = service_identifier_id; parameters[3] = new SqlParameter("@msisdn", DbType.String); parameters[3].Value = msisdn; parameters[4] = new SqlParameter("@endUserId", DbType.String); parameters[4].Value = endUserId; parameters[5] = new SqlParameter("@identifier_id", DbType.String); parameters[5].Value = identifier_id; parameters[6] = new SqlParameter("@identifier_label", DbType.String); parameters[6].Value = identifier_label; parameters[7] = new SqlParameter("@identifier_class", DbType.String); parameters[7].Value = identifier_class; parameters[8] = new SqlParameter("@landing_id", DbType.String); parameters[8].Value = landing_id; parameters[9] = new SqlParameter("@reference_code", DbType.String); parameters[9].Value = reference_code; parameters[10] = new SqlParameter("@tracking_param", DbType.String); parameters[10].Value = tracking_param; parameters[11] = new SqlParameter("@periodicity", DbType.String); parameters[11].Value = periodicity; parameters[12] = new SqlParameter("@start_on", DbType.DateTime); parameters[12].Value = start_on; parameters[13] = new SqlParameter("@expire_on", DbType.DateTime); parameters[13].Value = expire_on; parameters[14] = new SqlParameter("@operator_subscription_id", DbType.Int64); parameters[14].Value = operator_subscription_id; parameters[15] = new SqlParameter("@resource_url", DbType.String); parameters[15].Value = resource_url; parameters[16] = new SqlParameter("@created_by", DbType.Int32); parameters[16].Value = 1; parameters[17] = new SqlParameter("@created_on", DbType.DateTime); parameters[17].Value = created_on; parameters[18] = new SqlParameter("@campaign_id", DbType.String); parameters[18].Value = campaign_id; ExecuteNonQuery(InstanceName, CommandType.StoredProcedure, PROC_NOTIFY, parameters); } catch (Exception ex) { ErrorAssignation(ERROR_CODE.GENR_ServerConnectionError, ex.Message, ex.StackTrace, data.ToString()); throw ex; } return(mobiera_subscription_notification_id); }