示例#1
0
        private void onPayWithSwish(object sender, EventArgs eventArgs)
        {
            /**
             *  Build the MerchantInfo object with the following parameters:
             *  -merchantId
             *  -testMode
             */
            MerchantInfo merchant = new MerchantInfo("merchant_id", false);

            /**
             *   Build the OrderInfo object with the following parameters:
             *  -amount
             *  -currencyCode
             */
            OrderInfo order = new OrderInfo(1, "SEK");

            /**
             * Put the objects in the bundle; access the keys in the PiaSDK class
             */

            Bundle bundle = new Bundle();

            bundle.PutParcelable(PiaSDK.BundleMerchantInfo, merchant);
            bundle.PutParcelable(PiaSDK.BundleOrderInfo, order);
            PiaSDK.Instance.StartSwishProcess(this, bundle, new SwishHandler());
        }
示例#2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GetPaymentStatusRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 public GetPaymentStatusRequest(
     MerchantInfo merchantInfo,
     string sessionToken)
     : base(merchantInfo, ChecksumOrderMapping.NoChecksumMapping, sessionToken)
 {
     this.RequestUri = this.CreateRequestUri(ApiConstants.GetPaymentStatusUrl);
 }
示例#3
0
        private void onPayWithVipps(object sender, EventArgs eventArgs)
        {
            /**
             *  Build the MerchantInfo object with the following parameters:
             *  -merchantId
             *  -testMode
             */
            MerchantInfo merchant = new MerchantInfo(merchantIdTest, true);

            /**
             *   Build the OrderInfo object with the following parameters:
             *  -amount
             *  -currencyCode
             */
            OrderInfo order = new OrderInfo(1, "NOK");

            /**
             * Put the objects in the bundle; access the keys in the PiaSDK class
             */

            Bundle bundle = new Bundle();

            bundle.PutParcelable(PiaSDK.BundleMerchantInfo, merchant);
            bundle.PutParcelable(PiaSDK.BundleOrderInfo, order);
            PiaSDK.Instance.StartVippsProcess(this, bundle, new Handler(PaymentMode.VIPPS.ToString(), merchantBaseUrlTest, merchantIdTest));
        }
 private void Listener_DeviceReady(MerchantInfo merchantInfo)
 {
     DeviceConnected = true;
     DeviceReady     = true;
     MerchantInfo    = merchantInfo;
     ConnectionState?.Invoke(DeviceConnected, DeviceReady);
 }
示例#5
0
 /// <summary>
 /// Initializes a new instance of the Safecharge wrapper with a configured HttpClient and server information.
 /// </summary>
 /// <param name="configuredHttpClient">httpClient to get the client's properties from</param>
 /// <param name="merchantInfo">Merchant inforamtion</param>
 public Safecharge(
     HttpClient configuredHttpClient,
     MerchantInfo merchantInfo)
 {
     this.merchantInfo = merchantInfo;
     this.safechargeRequestExecutor = new SafechargeRequestExecutor(configuredHttpClient);
     this.sessionToken = this.GetSessionToken();
 }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SafechargeRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="checksumOrderMapping">Type of checksum.</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 public SafechargeRequest(
     MerchantInfo merchantInfo,
     ChecksumOrderMapping checksumOrderMapping,
     string sessionToken = null)
     : base(merchantInfo, checksumOrderMapping, sessionToken)
 {
     this.MerchantId     = merchantInfo.MerchantId;
     this.MerchantSiteId = merchantInfo.MerchantSiteId;
 }
示例#7
0
        public void OnDeviceReady(MerchantInfo merchantInfo)
        {
            CurrentConnectionStatus = "Ready";
            this.MerchantInfo       = merchantInfo;
            OnDeviceReadyMessage message = new OnDeviceReadyMessage();

            message.payload = merchantInfo;
            WebSocket.Send(Serialize(message));
        }
示例#8
0
 public void OnDeviceReady(MerchantInfo merchantInfo)
 {
     uiThread.Send(delegate(object state)
     {
         MessageBox.Show("Device has been connected!!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
         btnUSBConnect.Enabled    = false;
         btnStartRegister.Enabled = true;
     }, null);
 }
示例#9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GetMerchantPaymentMethodsRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="clientRequestId">Use this advanced field to prevent idempotency. Use it to uniquely identify the request you are submitting. If our system receives two calls with the same clientRequestId, it refuses the second call as it will assume idempotency.</param>
 public GetMerchantPaymentMethodsRequest(
     MerchantInfo merchantInfo,
     string sessionToken,
     string clientRequestId)
     : base(merchantInfo, ChecksumOrderMapping.ApiBasicChecksumMapping, sessionToken)
 {
     this.ClientRequestId = clientRequestId;
     this.RequestUri      = this.CreateRequestUri(ApiConstants.GetMerchantPaymentMethodsUrl);
 }
示例#10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OrderRequestWithDetails"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="checksumOrderMapping">Type of checksum.</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 public OrderRequestWithDetails(
     MerchantInfo merchantInfo,
     ChecksumOrderMapping checksumOrderMapping,
     string sessionToken,
     string currency,
     string amount)
     : base(merchantInfo, checksumOrderMapping, sessionToken, currency, amount)
 {
 }
示例#11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OpenOrderRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 public OpenOrderRequest(
     MerchantInfo merchantInfo,
     string sessionToken,
     string currency,
     string amount)
     : base(merchantInfo, ChecksumOrderMapping.ApiGenericChecksumMapping, sessionToken, currency, amount)
 {
     this.RequestUri = this.CreateRequestUri(ApiConstants.OpenOrderUrl);
 }
示例#12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SafechargePaymentRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="checksumOrderMapping">Type of checksum.</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 public SafechargePaymentRequest(
     MerchantInfo merchantInfo,
     ChecksumOrderMapping checksumOrderMapping,
     string sessionToken,
     string currency,
     string amount)
     : base(merchantInfo, checksumOrderMapping, sessionToken, currency, amount)
 {
 }
        public void OnDeviceReady(HttpListenerContext context)
        {
            MerchantInfo merchantInfo = ParseResponse <MerchantInfo>(context);

            if (merchantInfo != null)
            {
                connectorListener.ForEach(listener => listener.OnDeviceReady(merchantInfo));
            }
            SendTextResponse(context, "");
        }
示例#14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PaymentRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 /// <param name="paymentOption">Details about the payment method.</param>
 public PaymentRequest(
     MerchantInfo merchantInfo,
     string sessionToken,
     string currency,
     string amount,
     PaymentOption paymentOption)
     : base(merchantInfo, ChecksumOrderMapping.ApiGenericChecksumMapping, sessionToken, currency, amount, paymentOption)
 {
     this.RequestUri = this.CreateRequestUri(ApiConstants.PaymentUrl);
 }
示例#15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="VoidTransactionRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 /// <param name="relatedTransactionId">The ID of the original transaction.</param>
 public VoidTransactionRequest(
     MerchantInfo merchantInfo,
     string sessionToken,
     string currency,
     string amount,
     string relatedTransactionId)
     : base(merchantInfo, ChecksumOrderMapping.VoidGwTransactionChecksumMapping, sessionToken, currency, amount, relatedTransactionId)
 {
     this.RequestUri = this.CreateRequestUri(ApiConstants.VoidTransactionUrl);
 }
示例#16
0
 /// <summary>
 /// Initializes a new instance of the Safecharge wrapper with a default Safecharge's HttpClient and server information.
 /// </summary>
 /// <param name="merchantKey">The secret merchant key obtained by the Merchant during integration process with Safecharge</param>
 /// <param name="merchantId">Merchant id in the Safecharge's system</param>
 /// <param name="siteId">Merchant site id in the Safecharge's system</param>
 /// <param name="serverHost">The Safecharge's server address to send the request to</param>
 /// <param name="algorithmType">The hashing algorithm used to generate the checksum</param>
 public Safecharge(
     string merchantKey,
     string merchantId,
     string siteId,
     string serverHost,
     HashAlgorithmType algorithmType)
 {
     this.merchantInfo = new MerchantInfo(merchantKey, merchantId, siteId, serverHost, algorithmType);
     this.safechargeRequestExecutor = new SafechargeRequestExecutor();
     this.sessionToken = this.GetSessionToken();
 }
示例#17
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GetCardDetailsRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="clientUniqueId">ID of the transaction in the merchant’s system. This must be sent in order to perform future actions, such as: reconciliation, identifying the transaction in the event of any issues, etc.</param>
 /// <param name="cardNumber">CardNumber or bin to be populated</param>
 public GetCardDetailsRequest(
     MerchantInfo merchantInfo,
     string sessionToken,
     string clientUniqueId,
     string cardNumber)
     : base(merchantInfo, ChecksumOrderMapping.NoChecksumMapping, sessionToken)
 {
     this.ClientUniqueId = clientUniqueId;
     this.CardNumber     = cardNumber;
     this.RequestUri     = this.CreateRequestUri(ApiConstants.GetCardDetailsUrl);
 }
示例#18
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Authorize3dAndPaymentRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="checksumOrderMapping">Type of checksum.</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 /// <param name="paymentOption">Details about the payment method.</param>
 public Authorize3dAndPaymentRequest(
     MerchantInfo merchantInfo,
     ChecksumOrderMapping checksumOrderMapping,
     string sessionToken,
     string currency,
     string amount,
     PaymentOption paymentOption)
     : base(merchantInfo, checksumOrderMapping, sessionToken, currency, amount)
 {
     this.PaymentOption = paymentOption;
 }
示例#19
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SafechargeOrderDetailsRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="checksumOrderMapping">Type of checksum.</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 public SafechargeOrderDetailsRequest(
     MerchantInfo merchantInfo,
     ChecksumOrderMapping checksumOrderMapping,
     string sessionToken,
     string currency,
     string amount)
     : base(merchantInfo, checksumOrderMapping, sessionToken)
 {
     this.Currency = currency;
     this.Amount   = amount;
 }
示例#20
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Authorize3dRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 /// <param name="paymentOption">Details about the payment method.</param>
 /// <param name="relatedTransactionId">The ID of the original transaction.</param>
 public Authorize3dRequest(
     MerchantInfo merchantInfo,
     string sessionToken,
     string currency,
     string amount,
     PaymentOption paymentOption,
     string relatedTransactionId)
     : base(merchantInfo, ChecksumOrderMapping.ApiGenericChecksumMapping, sessionToken, currency, amount, paymentOption)
 {
     this.RelatedTransactionId = relatedTransactionId;
     this.RequestUri           = this.CreateRequestUri(ApiConstants.Authorize3dUrl);
 }
示例#21
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SafechargeBaseRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="checksumOrderMapping">Type of checksum.</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 public SafechargeBaseRequest(
     MerchantInfo merchantInfo,
     ChecksumOrderMapping checksumOrderMapping,
     string sessionToken)
 {
     this.ServerHost           = merchantInfo.ServerHost;
     this.TimeStamp            = DateTime.Now.ToString(Constants.TimeStampFormat);
     this.SessionToken         = sessionToken;
     this.MerchantKey          = merchantInfo.MerchantKey;
     this.HashAlgorithmType    = merchantInfo.HashAlgorithm;
     this.ChecksumOrderMapping = checksumOrderMapping;
 }
示例#22
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InitPaymentRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 /// <param name="paymentOption">Details about the payment method.</param>
 public InitPaymentRequest(
     MerchantInfo merchantInfo,
     string sessionToken,
     string currency,
     string amount,
     InitPaymentPaymentOption paymentOption)
     : base(merchantInfo, ChecksumOrderMapping.ApiGenericChecksumMapping, sessionToken)
 {
     this.Currency      = currency;
     this.Amount        = amount;
     this.PaymentOption = paymentOption;
     this.RequestUri    = this.CreateRequestUri(ApiConstants.InitPaymentUrl);
 }
示例#23
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SafechargeTransactionRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="checksumOrderMapping">Type of checksum.</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 /// <param name="relatedTransactionId"></param>
 public SafechargeTransactionRequest(
     MerchantInfo merchantInfo,
     ChecksumOrderMapping checksumOrderMapping,
     string sessionToken,
     string currency,
     string amount,
     string relatedTransactionId)
     : base(merchantInfo, checksumOrderMapping, sessionToken)
 {
     this.Currency             = currency;
     this.Amount               = amount;
     this.RelatedTransactionId = relatedTransactionId;
 }
示例#24
0
 public Request(Int32 customerID)
 {
     using (var context = new DbContextDataContext())
     {
         merchantInfo = context.MerchantInfos.Where(m => m.CustomerId == customerID).SingleOrDefault();
         LocalIP      = merchantInfo.localIP.Trim();
         Serial       = merchantInfo.Serial.Trim();
         MerchantID   = merchantInfo.merchantID.Trim();
         TerminalID   = merchantInfo.terminalID.Trim();
         Mobile       = merchantInfo.Mobile.Trim();
         CustomerId   = customerID;
         InvoiceNo    = "1001";
     }
 }
示例#25
0
        public IActionResult UpdMerchant(MerchantInfo m)
        {
            int h = 0;

            try
            {
                h = bll.UpdMerchant(m);
            }
            catch (Exception ex)
            {
                log.Error(ex.Message);
            }
            return(Ok(new { state = h > 0 ? true : false, msg = h > 0 ? "修改成功" : "修改失败" }));
        }
        public void TestCreatingInvalidServerHost()
        {
            var merchantInfo = new MerchantInfo(
                MerchantKeyValue,
                MerchantIdValue,
                MerchantSiteIdValue,
                ApiConstants.IntegrationHost + "invalid",
                HashAlgorithmType.SHA256);
            var getSessionTokenRequest = new GetSessionTokenRequest(merchantInfo);

            ActualValueDelegate <object> getSessionTokenRequestDelegate =
                () => requestExecutor.GetSessionToken(getSessionTokenRequest).GetAwaiter().GetResult();

            Assert.That(getSessionTokenRequestDelegate, Throws.TypeOf <SafechargeException>());
        }
        public virtual void Setup()
        {
            requestExecutor = new SafechargeRequestExecutor();
            merchantInfo    = new MerchantInfo(
                MerchantKeyValue,
                MerchantIdValue,
                MerchantSiteIdValue,
                ServerHostValue,
                HashAlgorithmType.SHA256);
            var getSessionTokenRequest = new GetSessionTokenRequest(merchantInfo);

            var response = requestExecutor.GetSessionToken(getSessionTokenRequest).GetAwaiter().GetResult();

            sessionToken = response.SessionToken;
        }
示例#28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Verify3dRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 /// <param name="paymentOption">Details about the payment method.</param>
 /// <param name="relatedTransactionId">The ID of the original transaction.</param>
 public Verify3dRequest(
     MerchantInfo merchantInfo,
     string sessionToken,
     string currency,
     string amount,
     Verify3dPaymentOption paymentOption,
     string relatedTransactionId)
     : base(merchantInfo, ChecksumOrderMapping.ApiGenericChecksumMapping, sessionToken)
 {
     this.Currency             = currency;
     this.Amount               = amount;
     this.PaymentOption        = paymentOption;
     this.RelatedTransactionId = relatedTransactionId;
     this.RequestUri           = this.CreateRequestUri(ApiConstants.Verify3dUrl);
 }
示例#29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PayoutRequest"/> with the required parameters.
 /// </summary>
 /// <param name="merchantInfo">Merchant's data (E.g. secret key, the merchant id, the merchant site id, etc.)</param>
 /// <param name="sessionToken">The session identifier returned by /getSessionToken.</param>
 /// <param name="userTokenId">ID of the user in merchant system.</param>
 /// <<param name="clientUniqueId">ID of the transaction in the merchant’s system. This must be sent in order to perform future actions, such as: reconciliation, identifying the transaction in the event of any issues, etc.</param>
 /// <param name="amount">The transaction amount. (E.g. 1, 101.10 - decimal representation of the amount as <see cref="string"/>.</param>
 /// <param name="currency">The three character ISO currency code of the transaction.</param>
 /// <param name="userPaymentOption">User payment option data.</param>
 public PayoutRequest(
     MerchantInfo merchantInfo,
     string sessionToken,
     string userTokenId,
     string clientUniqueId,
     string amount,
     string currency,
     UserPaymentOption userPaymentOption)
     : base(merchantInfo, ChecksumOrderMapping.ApiGenericChecksumMapping, sessionToken)
 {
     this.UserTokenId       = userTokenId;
     this.ClientUniqueId    = clientUniqueId;
     this.Amount            = amount;
     this.Currency          = currency;
     this.UserPaymentOption = userPaymentOption;
     this.RequestUri        = this.CreateRequestUri(ApiConstants.PayoutUrl);
 }
示例#30
0
        public void TestGetPaymentStatusSuccess()
        {
            var request      = new SafechargeRequestExecutor();
            var merchentInfo = new MerchantInfo()
            {
                MerchantId     = MerchantIdValue,
                MerchantSiteId = MerchantSiteIdValue,
                ServerHost     = ServerHostValue
            };
            var getMerchantPaymentMethodsRequest = new GetMerchantPaymentMethodsRequest(merchentInfo, sessionToken, "1234578");

            var response = request.GetMerchantPaymentMethods(getMerchantPaymentMethodsRequest).GetAwaiter().GetResult();

            Assert.IsNotNull(response);
            Assert.IsEmpty(response.Reason);
            Assert.AreEqual(ResponseStatus.Success, response.Status);
        }