public void CreatePromoCode(PromoCodeBuilder promoCodeBuilder, Action <PromoCode> onSuccess, Action <GetSocialError> onError)
        {
            var rpcBuilder = promoCodeBuilder.ToRpcModel();

            LogRequest("createPromoCode", rpcBuilder);
            WithHadesClient(client =>
            {
                var response = client.setPromoCode(SessionId, rpcBuilder);
                Ui(() =>
                {
                    LogResponse("createPromoCode", response);
                    onSuccess.SafeCall(response.FromRpcModel());
                });
            }, onError);
        }
        public static THPromoCode ToRpcModel(this PromoCodeBuilder builder)
        {
            var promoCode = new THPromoCode
            {
                Code       = builder._code,
                MaxClaims  = (int)builder._maxClaimCount,
                CustomData = builder._data
            };

            if (builder._startDate != null)
            {
                promoCode.ValidFrom = builder._startDate.Value.ToUnixTimestamp();
            }
            if (builder._endDate != null)
            {
                promoCode.ValidUntil = builder._endDate.Value.ToUnixTimestamp();
            }
            return(promoCode);
        }
 public void CreatePromoCode(PromoCodeBuilder promoCodeBuilder, Action <PromoCode> onSuccess, Action <GetSocialError> onError)
 {
     DebugUtils.LogMethodCall(MethodBase.GetCurrentMethod(), promoCodeBuilder, onSuccess, onError);
 }
Esempio n. 4
0
 public void CreatePromoCode(PromoCodeBuilder promoCodeBuilder, Action <PromoCode> onSuccess, Action <GetSocialError> onError)
 {
     _getSocial.CallStatic("createPromoCode", promoCodeBuilder.ToAjo(), new CallbackProxy <PromoCode>(onSuccess, onError));
 }
Esempio n. 5
0
 public void CreatePromoCode(PromoCodeBuilder promoCodeBuilder, Action <PromoCode> onSuccess, Action <GetSocialError> onError)
 {
     _gs_createPromoCode(promoCodeBuilder.ToJson(),
                         Callbacks.PromoCode, onSuccess.GetPointer(),
                         Callbacks.FailureCallback, onError.GetPointer());
 }