package com.unity3d.player; import android.util.Log; import org.json.JSONArray; import org.json.JSONObject; import java.util.Locale; public class RustoreAdapter extends ChannelAdapterBase { private static final String TAG = "RustoreAdapter"; @Override public String normalizeSkuList(String msg) { if (msg == null || msg.isEmpty()) { return msg; } try { JSONArray products = new JSONArray(msg); for (int i = 0; i < products.length(); i++) { JSONObject p = products.getJSONObject(i); String price = p.optString("price", "0"); long micros = Long.parseLong(price) * 10000; p.put("price_amount_micros", String.valueOf(micros)); String currency = p.optString("currency", ""); if (!currency.isEmpty()) { p.put("price_currency_code", currency); } float rubles = Float.parseFloat(price) / 100; p.put("price", String.format(Locale.US, "RUB %.2f", rubles)); } return products.toString(); } catch (Exception e) { Log.e(TAG, "normalizeSkuList error: " + e.getMessage()); return msg; } } private static class Config { public String SDK_CLIENTID = "Android_5.00_tyGuest,facebook.googleplay.0-hall20587.rustore.FishingTravel"; } }