public Transaction(
            // merchant account data
            Przelewy24 parent,
            // transaction data
            SessionIdGenerationMode generationMode,
            string sessionId,
            int amount,
            string currency,
            string description,
            string email,
            string country,
            string urlReturn
            )
        {
            AllConstuctorsInitialOperations();
            this.parent = parent;
            this.AllConstructorsFinalOperations();

            SetUniqueSessionId(generationMode, sessionId);
            this.P24_amount      = amount;
            this.P24_currency    = currency;
            this.P24_description = description;
            this.P24_email       = email;
            this.P24_country     = country;
            this.P24_url_return  = urlReturn;
        }
 public Transaction(Przelewy24 przelewy24)
 {
     AllConstuctorsInitialOperations();
     this.parent = przelewy24;
     SetUniqueSessionId(SessionIdGenerationMode.time, "");
     this.AllConstructorsFinalOperations();
 }
        private void CreateTestMerchant()
        {
            this.p24 = new Przelewy24.Przelewy24(49518, 49518, "d13be93f322c7ec3", true);

            this.textBoxMerchantId.Text  = p24.MerchantId.ToString();
            this.textBoxPosId.Text       = p24.PosId.ToString();
            this.textBoxCrc.Text         = p24.CrcKey;
            this.checkBoxSandBox.Checked = p24.SandboxMode;
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            Przelewy24.Przelewy24 p24 = new Przelewy24.Przelewy24("49518", "49518", "d13be93f322c7ec3", true);



            Console.WriteLine("Press any key...");
            Console.ReadKey();
        }
        public string CalculateRegisterSign()
        {
            string registerSign = Przelewy24.CalculateRegisterSign(
                this.P24_session_id,
                parent.MerchantId,
                this.P24_amount,
                this.P24_currency,
                parent.CrcKey
                );

            return(registerSign);
        }
Beispiel #6
0
        public async Task <string> P24Status(VerifyTransactionHelper vth)
        {
            Przelewy24.Przelewy24 p24 = OnePageClientViewModel.GetInstance().P24;
            var result = await p24.VerifyTransaction(
                vth.p24_merchant_id,
                vth.p24_pos_id,
                vth.p24_session_id,
                vth.p24_amount,
                vth.p24_currency,
                vth.p24_order_id,
                vth.p24_method,
                vth.p24_statent,
                vth.p24_sign);

            return(result.ToString());
        }
        /// <summary>
        /// Register specified Transaction in Przelewy24 for specified mode
        /// Sets transction P24_sign and P24Response
        /// This method uses only parameters from give transaction
        /// </summary>
        /// <param name="transaction">Transaction to register</param>
        /// <param name="sandboxMode">Determine if transaction will be registered for sandbox(true) or production(false)</param>
        /// <returns>P24Response object with data about Token or Errors</returns>
        public static async Task <P24Response> RegisterTransaction(Transaction transaction, Mode mode, string crc)
        {
            transaction.P24_sign = Przelewy24.CalculateRegisterSign
                                   (
                transaction.P24_session_id,
                transaction.P24_merchant_id,
                transaction.P24_amount,
                transaction.P24_currency,
                crc
                                   );
            transaction.SetRegisterSign();
            string responseString = await RegisterTransaction(transaction.GetParameters(), mode);

            P24Response response = new P24Response(responseString);

            transaction.P24Response = response;
            return(response);
        }
        public async Task <string> TestConnection()
        {
            HttpClient client = new HttpClient();

            string[] parameters = new string[2] {
                this.PosId.ToString(), this.CrcKey
            };
            string sign = Przelewy24.CalculateSign(parameters);

            var values = new Dictionary <string, string>()
            {
                { "p24_merchant_id", this.MerchantId.ToString() },
                { "p24_pos_id", this.PosId.ToString() },
                { "p24_sign", sign }
            };

            var content = new FormUrlEncodedContent(values);

            var response = await client.PostAsync(this.UrlTestConnection, content);

            var responseString = await response.Content.ReadAsStringAsync();

            return(responseString);
        }
        public void SetUniqueSessionId(SessionIdGenerationMode mode, string sessionIdAdditionalData)
        {
            this.SessionIdAdditionalData = sessionIdAdditionalData;
            switch (mode)
            {
            case SessionIdGenerationMode.time:
            {
                this.P24_session_id = GetUniqueSessionId();
                break;
            }

            case SessionIdGenerationMode.addPostfix:
            {
                this.P24_session_id = GetUniqueSessionId() + "|" + sessionIdAdditionalData;
                break;
            }

            case SessionIdGenerationMode.addPrefix:
            {
                this.P24_session_id = sessionIdAdditionalData + "|" + GetUniqueSessionId();
                break;
            }

            case SessionIdGenerationMode.md5:
            {
                this.P24_session_id = Przelewy24.CalculateMD5Hash(GetUniqueSessionId());
                break;
            }

            case SessionIdGenerationMode.plain:
            {
                this.P24_session_id = sessionIdAdditionalData;
                break;
            }
            }
        }
 /// <summary>
 /// Register specified Transaction in Przelewy24 for mode specified in this Przelewy24 object
 /// Sets transction P24_sign and P24Response
 /// This method uses only parameters from give transaction
 /// It does not chec if Merchant ID nad POS ID are the same as in this Przelewy24 object
 /// </summary>
 /// <param name="transaction">Transaction to register</param>
 /// <returns>P24Response object with data about Token or Errors</returns>
 public async Task <P24Response> RegisterTransaction(Transaction transaction)
 {
     return(await Przelewy24.RegisterTransaction(transaction, this.P24Mode, this.CrcKey));
 }
 /// <summary>
 /// Register transaction with mode set in this Przelewy24 object
 /// It uses only parameters given in input IEnumerable parameters
 /// Do not check if Merchant ID and POS ID are the same as in this Przelewy24 object
 /// This method do not create transaction object
 /// </summary>
 /// <param name="parameters">Set of parameters</param>
 /// <returns>Response from Przelewy24. String contains TOKEN or list of errors</returns>
 public async Task <string> RegisterTransaction(IEnumerable <IParameter> parameters)
 {
     return(await Przelewy24.RegisterTransaction(parameters, this.P24Mode));
 }
 /// <summary>
 /// Register transaction with mode set in this Przelewy24 object
 /// It uses only parameters given in input IDictionary
 /// Do not check if Merchant ID and POS ID are the same as in this Przelewy24 object
 /// This method do not create Transaction Object
 /// </summary>
 /// <param name="parametares">Set of parameters</param>
 /// <returns>Response from Przelewy24. String contains TOKEN or list of errors</returns>
 public async Task <string> RegisterTransaction(IDictionary <string, string> parameters)
 {
     return(await Przelewy24.RegisterTransaction(parameters, this.P24Mode));
 }
 public async Task <P24Response> RegisterTransaction(Przelewy24.Mode mode, string crc)
 {
     return(await Przelewy24.RegisterTransaction(this, mode, crc));
 }