Commits

Eugene Veretennikov committed 891e821 Draft Merge

Merge with 1.0.6

Comments (0)

Files changed (11)

as3snapi-core/src/as3snapi/networks/mailru/ModuleMailru.as

 import as3snapi.base.features.asyncinit.IFeatureAsyncInit;
 import as3snapi.base.features.javascript.IFeatureJavaScript;
 import as3snapi.networks.mailru.features.IFeatureMailruApiCore;
+import as3snapi.networks.mailru.features.IFeatureMailruApiUi;
 import as3snapi.networks.mailru.impl.MailruApiImpl;
 import as3snapi.networks.mailru.impl.MailruState;
 import as3snapi.utils.bus.IMutableBus;
 
         var apiCore:MailruApiImpl = new MailruApiImpl(state, context, shortNetworkId);
         bus.addFeature(IFeatureMailruApiCore, apiCore);
+        bus.addFeature(IFeatureMailruApiUi, apiCore);
         SocialFeaturesInstallHelper.installBasicFeatures(bus, apiCore);
         bus.addFeature(IFeatureAsyncInit, apiCore);
     }

as3snapi-core/src/as3snapi/networks/mailru/features/IFeatureMailruApiUi.as

+package as3snapi.networks.mailru.features {
+/**
+ * Специфичное для mail.ru UI API
+ */
+public interface IFeatureMailruApiUi {
+    /**
+     * Показывает пользователю диалог оплаты.
+     * http://api.mail.ru/docs/reference/js/payments.showDialog/
+     *
+     * @param service_id
+     *     Идентификатор услуги (число), выбираемый по вашему усмотрению
+     *     Этот идентификатор понадобится вам в момент оказания услуги для определения
+     *     Для каждой конкретной услуги должен быть постоянным и не 0.
+     * @param service_name
+     *     Название услуги в именительном падеже (не более 40 символов).
+     *     Для каждой услуги нужно определить постоянное название, например:
+     *     "5 золотых", "бутылка вина", "Кожаная броня 2-ого уровня".
+     *     В окне оплаты услуги заголовок будет: "Купить: service_name".
+     *     Название приложения включать в название услуги не нужно.
+     * @param mailiki_price
+     *     Стоимость услуги в мэйликах.
+     *     Минимальное значение 1 мэйлик
+     */
+    function paymentsShowDialog(service_id:int, service_name:String, mailiki_price:int):void;
+}
+}

as3snapi-core/src/as3snapi/networks/mailru/impl/MailruApiImpl.as

 import as3snapi.networks.mailru.ConfigMailru;
 import as3snapi.networks.mailru.features.EventMailru;
 import as3snapi.networks.mailru.features.IFeatureMailruApiCore;
+import as3snapi.networks.mailru.features.IFeatureMailruApiUi;
 
 import flash.events.IEventDispatcher;
 import flash.utils.clearTimeout;
  * Реализация mail.ru API
  */
 public class MailruApiImpl implements IFeatureMailruApiCore,
+        IFeatureMailruApiUi,
         IFeatureNetworkId,
         IFeatureAppId,
         IFeatureUserId,
             }
         }
     }
+
+    public function paymentsShowDialog(service_id:int, service_name:String, mailiki_price:int):void {
+        js.call("mailru.app.payments.showDialog", {
+            service_id:service_id,
+            service_name:service_name,
+            mailiki_price:mailiki_price
+        });
+    }
 }
 }

as3snapi-core/src/as3snapi/networks/vkcom/ModuleVkcom.as

 import as3snapi.networks.vkcom.impl.VkcomState;
 import as3snapi.utils.bus.IMutableBus;
 
-import flash.utils.getTimer;
-
 /**
  * Модуль поддержки API vk.com
  * {@link:http://vk.com/developers.php}

as3snapi-core/src/as3snapi/networks/vkcom/features/EventVkcom.as

     public static const ON_WINDOW_FOCUS:String = "onWindowFocus";
     public static const ON_BALANCE_CHANGED:String = "onBalanceChanged";
     public static const ON_WINDOW_BLUR:String = "onWindowBlur";
+
+    //http://vk.com/developers.php?oid=-1&p=%D0%94%D0%B8%D0%B0%D0%BB%D0%BE%D0%B3%D0%BE%D0%B2%D0%BE%D0%B5_%D0%BE%D0%BA%D0%BD%D0%BE_%D0%BF%D0%BB%D0%B0%D1%82%D0%B5%D0%B6%D0%B5%D0%B9_
+    public static const ON_ORDER_CANCEL:String = "onOrderCancel";
+    public static const ON_ORDER_SUCCESS:String = "onOrderSuccess";
+    public static const ON_ORDER_FAIL:String = "onOrderFail";
+
     //TODO http://vk.com/developers.php?oid=-1&p=IFrame-%D0%BF%D1%80%D0%B8%D0%BB%D0%BE%D0%B6%D0%B5%D0%BD%D0%B8%D1%8F
 
     public var data:Object;

as3snapi-core/src/as3snapi/networks/vkcom/features/IFeatureVkcomApiCore.as

  * Запросы к сети.
  */
 public interface IFeatureVkcomApiCore {
-    function getUserBalance(onSuccess:Function, onError:Function):void;
 }
 }

as3snapi-core/src/as3snapi/networks/vkcom/features/IFeatureVkcomApiUi.as

 public interface IFeatureVkcomApiUi {
     function showInviteBox():void ;
 
-    function showPaymentBox(votes:int):void ;
+    /**
+     * http://vk.com/developers.php?oid=-1&p=%D0%94%D0%B8%D0%B0%D0%BB%D0%BE%D0%B3%D0%BE%D0%B2%D0%BE%D0%B5_%D0%BE%D0%BA%D0%BD%D0%BE_%D0%BF%D0%BB%D0%B0%D1%82%D0%B5%D0%B6%D0%B5%D0%B9_
+     * @param type
+     * @param votes
+     * @param offer_id
+     * @param item
+     */
+    function showOrderBox(params:Object):void ;
+
+    function showOrderBoxVotes(votes:int):void ;
+
+    function showOrderBoxOffers(offer_id:int):void ;
+
+    function showOrderBoxItem(item:String):void ;
 }
 }

as3snapi-core/src/as3snapi/networks/vkcom/impl/VkcomApiCore.as

             handler.onFail(r);
         }
     }
-
-    public function getUserBalance(onSuccess:Function, onFail:Function):void {
-        requester.apiCall("getUserBalance", null, onSuccess2, onFail2);
-        function onSuccess2(r:Object):void {
-            onSuccess(r.response);
-        }
-
-        function onFail2(r:Object):void {
-            onFail(r);
-        }
-    }
 }
 }

as3snapi-core/src/as3snapi/networks/vkcom/impl/VkcomApiUi.as

         methods.callMethod("showInviteBox");
     }
 
-    public function showPaymentBox(votes:int):void {
-        methods.callMethod("showPaymentBox", votes);
+    public function showOrderBox(params:Object):void {
+        methods.callMethod("showOrderBox", params);
+    }
+
+    public function showOrderBoxVotes(votes:int):void {
+        showOrderBox({"type":"votes", "votes":votes});
+    }
+
+    public function showOrderBoxOffers(offer_id:int):void {
+        showOrderBox({"type":"offers", "offer_id":offer_id});
+    }
+
+    public function showOrderBoxItem(item:String):void {
+        showOrderBox({"type":"item", "item":item});
     }
 }
 }

as3snapi-core/src/as3snapi/networks/vkcom/impl/VkcomDriverLC.as

         event("onMerchantPaymentSuccess");
         event("onMerchantPaymentCancel");
         event("onMerchantPaymentFail");
+        event("onOrderCancel");
+        event("onOrderSuccess");
+        event("onOrderFail");
 
         try {
             receivingLC.connect("_out_" + connectionName);

as3snapi-core/src/as3snapi/networks/vkcom/impl/VkcomMethodsJs.as

         event("onScrollTop");
         event("onScroll");
         event("onToggleFlash");
+        event("onOrderCancel");
+        event("onOrderSuccess");
+        event("onOrderFail");
 
         function event(event:String):void {
             jsUtils.callSmart("VK.addCallback", event, jsUtils.permanent(eventProxy));