electron_sys/module/
in_app_purchase.rs

1use js_sys::{JsString, Promise};
2use node_sys::EventEmitter;
3use wasm_bindgen::prelude::*;
4
5#[wasm_bindgen(module = "electron")]
6extern {
7    #[wasm_bindgen(extends = EventEmitter)]
8    pub type InAppPurchase;
9
10    #[wasm_bindgen(js_name = "inAppPurchase")]
11    pub static in_app_purchase: InAppPurchase;
12
13    // FIXME: event overloads
14
15    //******************//
16    // Instance Methods //
17    //******************//
18
19    #[wasm_bindgen(method, js_name = "canMakePayments")]
20    pub fn can_make_payments(this: &InAppPurchase) -> bool;
21
22    #[wasm_bindgen(method, js_name = "finishAllTransactions")]
23    pub fn finish_all_transactions(this: &InAppPurchase);
24
25    #[wasm_bindgen(method, js_name = "finishTransactionsByDate")]
26    pub fn finish_transactions_by_date(this: &InAppPurchase, date: &str);
27
28    #[must_use]
29    #[wasm_bindgen(method, js_name = "getProducts")]
30    pub fn get_products(this: &InAppPurchase, product_ids: Box<[JsValue]>) -> Promise;
31
32    #[wasm_bindgen(method, js_name = "getReceiptsURL")]
33    pub fn get_receipts_url(this: &InAppPurchase) -> JsString;
34
35    #[must_use]
36    #[wasm_bindgen(method, js_name = "purchaseProduct")]
37    pub fn purchaseProduct(this: &InAppPurchase, product_id: &str, quantity: Option<u32>) -> Promise;
38}