GetOffer() public method

public GetOffer ( ) : Offer
return Offer
コード例 #1
0
        public void OnRedeemAutomaticOffer(string response)
        {
            try
            {
                Response answer = new Response(response);

                // Treat the offer.
                Offer offer = answer.GetOffer();
                if (offer == null)
                {
                    throw new NullReferenceException("The returned offer is null.");
                }

                if (RedeemAutomaticOffer != null)
                {
                    RedeemAutomaticOffer(offer);
                }
            }
            catch (Exception e)
            {
                Logger.Error(true, "onRedeemAutomaticOffer", e);
            }
        }
コード例 #2
0
        public void OnRedeemURLSuccess(string response)
        {
            try
            {
                Response answer = new Response(response);

                // Treat the offer.
                Offer offer = answer.GetOffer();
                if (offer == null)
                {
                    throw new NullReferenceException("The returned offer is null.");
                }

                string code = answer.GetCode();
                if (code == null)
                {
                    throw new NullReferenceException("The returned code is null.");
                }

                if (RedeemURLSuccess != null)
                {
                    RedeemURLSuccess(code, offer);
                }
            }
            catch (Exception e)
            {
                Logger.Error(true, "onRedeemURLSuccess", e);
                if (RedeemURLFailed != null)
                {
                    RedeemURLFailed(null, FailReason.UNEXPECTED_ERROR, null);
                }
            }
        }