Showing
9 changed files
with
249 additions
and
63 deletions
... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
2 | 2 | ||
3 | ext { | 3 | ext { |
4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
5 | - PUBLISH_VERSION = '4.5.4-cosbeta34' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta35i' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -179,17 +179,18 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -179,17 +179,18 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
179 | try { | 179 | try { |
180 | JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()); | 180 | JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()); |
181 | if (extraFields != null) { | 181 | if (extraFields != null) { |
182 | -// if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 182 | + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { |
183 | -// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 183 | + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
184 | -// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 184 | + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { |
185 | -// Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); | 185 | + Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); |
186 | -// intent.putExtra("ccms", ccms); | 186 | + intent.putExtra("ccms", ccms); |
187 | -// startActivity(intent); | 187 | + intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); |
188 | -// break; | 188 | + startActivity(intent); |
189 | -// } | 189 | + break; |
190 | -// } | 190 | + } |
191 | -// return; | 191 | + } |
192 | -// } | 192 | + return; |
193 | + } | ||
193 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { | 194 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { |
194 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 195 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
195 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 196 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { |
... | @@ -271,17 +272,18 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -271,17 +272,18 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
271 | try { | 272 | try { |
272 | JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()); | 273 | JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()); |
273 | if (extraFields != null) { | 274 | if (extraFields != null) { |
274 | -// if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 275 | + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { |
275 | -// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 276 | + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
276 | -// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 277 | + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { |
277 | -// Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); | 278 | + Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); |
278 | -// intent.putExtra("ccms", ccms); | 279 | + intent.putExtra("ccms", ccms); |
279 | -// startActivity(intent); | 280 | + intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); |
280 | -// break; | 281 | + startActivity(intent); |
281 | -// } | 282 | + break; |
282 | -// } | 283 | + } |
283 | -// return; | 284 | + } |
284 | -// } | 285 | + return; |
286 | + } | ||
285 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { | 287 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { |
286 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 288 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
287 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 289 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | ... | ... |
... | @@ -3,6 +3,7 @@ package ly.warp.sdk.activities; | ... | @@ -3,6 +3,7 @@ package ly.warp.sdk.activities; |
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.content.Intent; | 4 | import android.content.Intent; |
5 | import android.os.Bundle; | 5 | import android.os.Bundle; |
6 | +import android.os.Parcelable; | ||
6 | import android.util.Log; | 7 | import android.util.Log; |
7 | import android.view.View; | 8 | import android.view.View; |
8 | import android.widget.ImageView; | 9 | import android.widget.ImageView; |
... | @@ -16,6 +17,7 @@ import org.greenrobot.eventbus.EventBus; | ... | @@ -16,6 +17,7 @@ import org.greenrobot.eventbus.EventBus; |
16 | import org.greenrobot.eventbus.Subscribe; | 17 | import org.greenrobot.eventbus.Subscribe; |
17 | import org.json.JSONObject; | 18 | import org.json.JSONObject; |
18 | 19 | ||
20 | +import java.io.Serializable; | ||
19 | import java.util.ArrayList; | 21 | import java.util.ArrayList; |
20 | import java.util.HashSet; | 22 | import java.util.HashSet; |
21 | 23 | ||
... | @@ -123,17 +125,18 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -123,17 +125,18 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
123 | try { | 125 | try { |
124 | JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields()); | 126 | JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields()); |
125 | if (extraFields != null) { | 127 | if (extraFields != null) { |
126 | -// if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 128 | + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { |
127 | -// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 129 | + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
128 | -// if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { | 130 | + if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { |
129 | -// Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class); | 131 | + Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class); |
130 | -// intent.putExtra("ccms", ccms); | 132 | + intent.putExtra("ccms", ccms); |
131 | -// startActivity(intent); | 133 | + intent.putExtra("loyalty", (Serializable) gift); |
132 | -// break; | 134 | + startActivity(intent); |
133 | -// } | 135 | + break; |
134 | -// } | 136 | + } |
135 | -// return; | 137 | + } |
136 | -// } | 138 | + return; |
139 | + } | ||
137 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { | 140 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { |
138 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 141 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
139 | if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { | 142 | if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { |
... | @@ -184,17 +187,18 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -184,17 +187,18 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
184 | try { | 187 | try { |
185 | JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields()); | 188 | JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields()); |
186 | if (extraFields != null) { | 189 | if (extraFields != null) { |
187 | -// if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 190 | + if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { |
188 | -// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 191 | + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
189 | -// if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { | 192 | + if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { |
190 | -// Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class); | 193 | + Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class); |
191 | -// intent.putExtra("ccms", ccms); | 194 | + intent.putExtra("ccms", ccms); |
192 | -// startActivity(intent); | 195 | + intent.putExtra("loyalty", (Serializable) gift); |
193 | -// break; | 196 | + startActivity(intent); |
194 | -// } | 197 | + break; |
195 | -// } | 198 | + } |
196 | -// return; | 199 | + } |
197 | -// } | 200 | + return; |
201 | + } | ||
198 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { | 202 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { |
199 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 203 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
200 | if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { | 204 | if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { | ... | ... |
1 | package ly.warp.sdk.activities; | 1 | package ly.warp.sdk.activities; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | +import android.content.Context; | ||
4 | import android.os.Bundle; | 5 | import android.os.Bundle; |
5 | import android.text.TextUtils; | 6 | import android.text.TextUtils; |
7 | +import android.util.Log; | ||
8 | +import android.view.LayoutInflater; | ||
6 | import android.view.View; | 9 | import android.view.View; |
10 | +import android.view.ViewGroup; | ||
7 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
8 | import android.widget.LinearLayout; | 12 | import android.widget.LinearLayout; |
9 | import android.widget.TextView; | 13 | import android.widget.TextView; |
10 | 14 | ||
15 | +import androidx.appcompat.app.AlertDialog; | ||
16 | + | ||
11 | import com.bumptech.glide.Glide; | 17 | import com.bumptech.glide.Glide; |
12 | import com.bumptech.glide.load.engine.DiskCacheStrategy; | 18 | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
19 | +import com.google.android.material.bottomsheet.BottomSheetDialog; | ||
20 | + | ||
21 | +import org.json.JSONArray; | ||
22 | +import org.json.JSONException; | ||
23 | +import org.json.JSONObject; | ||
13 | 24 | ||
14 | import ly.warp.sdk.R; | 25 | import ly.warp.sdk.R; |
26 | +import ly.warp.sdk.io.callbacks.CallbackReceiver; | ||
27 | +import ly.warp.sdk.io.models.Campaign; | ||
28 | +import ly.warp.sdk.io.models.Consumer; | ||
15 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 29 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; |
30 | +import ly.warp.sdk.io.request.CosmoteSubmitOrderRequest; | ||
31 | +import ly.warp.sdk.io.request.WarplyConsumerRequest; | ||
32 | +import ly.warp.sdk.utils.managers.WarplyManager; | ||
16 | 33 | ||
17 | 34 | ||
18 | public class TelcoActivity extends Activity implements View.OnClickListener { | 35 | public class TelcoActivity extends Activity implements View.OnClickListener { |
... | @@ -21,14 +38,20 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -21,14 +38,20 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
21 | // Constants | 38 | // Constants |
22 | // =========================================================== | 39 | // =========================================================== |
23 | 40 | ||
41 | + private final String MSISDN_LIST = "msisdnList"; | ||
42 | + | ||
24 | // =========================================================== | 43 | // =========================================================== |
25 | // Fields | 44 | // Fields |
26 | // =========================================================== | 45 | // =========================================================== |
27 | 46 | ||
28 | private ImageView mIvBack, mIvCampaignPhoto; | 47 | private ImageView mIvBack, mIvCampaignPhoto; |
29 | private TextView mTvCampaignTitle, mTvCampaignSubtitle; | 48 | private TextView mTvCampaignTitle, mTvCampaignSubtitle; |
30 | - private LoyaltyContextualOfferModel mCCMS; | 49 | + private LoyaltyContextualOfferModel mCCMS = new LoyaltyContextualOfferModel(); |
50 | + private Campaign mLoyalty = new Campaign(); | ||
31 | private LinearLayout mLlActivateOffer; | 51 | private LinearLayout mLlActivateOffer; |
52 | + private Consumer mConsumer; | ||
53 | + private String mSender = ""; | ||
54 | + private AlertDialog mAlertDialogAskActivate, mAlertDialogErrorActivating, mAlertDialogSuccessActivating; | ||
32 | 55 | ||
33 | // =========================================================== | 56 | // =========================================================== |
34 | // Methods for/from SuperClass/Interfaces | 57 | // Methods for/from SuperClass/Interfaces |
... | @@ -40,6 +63,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -40,6 +63,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
40 | setContentView(R.layout.activity_telco); | 63 | setContentView(R.layout.activity_telco); |
41 | 64 | ||
42 | mCCMS = (LoyaltyContextualOfferModel) getIntent().getSerializableExtra("ccms"); | 65 | mCCMS = (LoyaltyContextualOfferModel) getIntent().getSerializableExtra("ccms"); |
66 | + mLoyalty = (Campaign) getIntent().getSerializableExtra("loyalty"); | ||
43 | 67 | ||
44 | mIvBack = findViewById(R.id.iv_telco_back); | 68 | mIvBack = findViewById(R.id.iv_telco_back); |
45 | mTvCampaignTitle = findViewById(R.id.textView13); | 69 | mTvCampaignTitle = findViewById(R.id.textView13); |
... | @@ -53,6 +77,14 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -53,6 +77,14 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
53 | @Override | 77 | @Override |
54 | public void onResume() { | 78 | public void onResume() { |
55 | super.onResume(); | 79 | super.onResume(); |
80 | + | ||
81 | + new Thread(() -> { | ||
82 | + if (!Thread.currentThread().isInterrupted()) { | ||
83 | + WarplyManager.getConsumer(new WarplyConsumerRequest() | ||
84 | + , mConsumerCallback); | ||
85 | + } | ||
86 | + Thread.currentThread().interrupt(); | ||
87 | + }).start(); | ||
56 | } | 88 | } |
57 | 89 | ||
58 | @Override | 90 | @Override |
... | @@ -62,7 +94,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -62,7 +94,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
62 | return; | 94 | return; |
63 | } | 95 | } |
64 | if (view.getId() == R.id.ll_activate_button) { | 96 | if (view.getId() == R.id.ll_activate_button) { |
65 | - //TODO: make submitOrder | 97 | + showActivationDialog(); |
66 | } | 98 | } |
67 | } | 99 | } |
68 | 100 | ||
... | @@ -92,8 +124,134 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -92,8 +124,134 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
92 | mLlActivateOffer.setOnClickListener(this); | 124 | mLlActivateOffer.setOnClickListener(this); |
93 | } | 125 | } |
94 | 126 | ||
127 | + private void showActivationDialog() { | ||
128 | + final BottomSheetDialog bottomSheetDialog = new BottomSheetDialog(this); | ||
129 | + bottomSheetDialog.setContentView(R.layout.dl_share); | ||
130 | + LinearLayout parent = bottomSheetDialog.findViewById(R.id.ll_share_dialog_view_inner); | ||
131 | + | ||
132 | + ImageView dialogClose = (ImageView) bottomSheetDialog.findViewById(R.id.iv_sender_list_close); | ||
133 | + dialogClose.setOnClickListener(view -> bottomSheetDialog.dismiss()); | ||
134 | + | ||
135 | + if (mConsumer != null) { | ||
136 | + try { | ||
137 | + JSONObject profMeta = new JSONObject(mConsumer.getProfileMetadata()); | ||
138 | + if (profMeta != null) { | ||
139 | + JSONArray msisdnList = new JSONArray(); | ||
140 | + msisdnList = profMeta.optJSONArray(MSISDN_LIST); | ||
141 | + if (msisdnList != null && msisdnList.length() > 0) { | ||
142 | + for (int i = 0; i < msisdnList.length(); i++) { | ||
143 | + LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); | ||
144 | + LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_share, null); | ||
145 | + TextView textView = (TextView) v.findViewById(R.id.tv_phone_share); | ||
146 | + textView.setText(msisdnList.optString(i)); | ||
147 | + textView.setOnClickListener(view -> { | ||
148 | + TextView tv = (TextView) view; | ||
149 | + mSender = tv.getText().toString(); | ||
150 | + bottomSheetDialog.dismiss(); | ||
151 | + askActivateDialog(); | ||
152 | + }); | ||
153 | + parent.addView(v, 0, new ViewGroup.LayoutParams( | ||
154 | + ViewGroup.LayoutParams.MATCH_PARENT, | ||
155 | + ViewGroup.LayoutParams.WRAP_CONTENT)); | ||
156 | + } | ||
157 | + } | ||
158 | + } | ||
159 | + } catch (JSONException e) { | ||
160 | + e.printStackTrace(); | ||
161 | + } | ||
162 | + } | ||
163 | + | ||
164 | + bottomSheetDialog.show(); | ||
165 | + } | ||
166 | + | ||
167 | + private void activateGift() { | ||
168 | + new Thread(() -> { | ||
169 | + if (!Thread.currentThread().isInterrupted()) { | ||
170 | + WarplyManager.submitOrder(new CosmoteSubmitOrderRequest() | ||
171 | + .setCommunicationUuid(mLoyalty.getSessionUUID()) | ||
172 | + .setUserMsisdn(mSender) | ||
173 | + .setBusinessService(mCCMS.getBusinessService()) | ||
174 | + .setOfferName(mCCMS.getOfferName()) | ||
175 | + .setProductType(mCCMS.getProductType()) | ||
176 | + .setProvDuration(mCCMS.getProvDuration()) | ||
177 | + .setNoOfRecurrance(mCCMS.getNoOfRecurrance()) | ||
178 | + .setPrice(mCCMS.getPrice()) | ||
179 | + .setDiscount(mCCMS.getDiscount()) | ||
180 | + .setVoiceCategory(mCCMS.getVoiceCategory()) | ||
181 | + .setDataCategory(mCCMS.getDataCategory()) | ||
182 | + .setMinsValue(mCCMS.getMinsValue()) | ||
183 | + .setDataValue(mCCMS.getDataValue()) | ||
184 | + .setProvStepValueMins(mCCMS.getProvStepValueMins()), | ||
185 | + mSubmitCallback); | ||
186 | + } | ||
187 | + Thread.currentThread().interrupt(); | ||
188 | + }).start(); | ||
189 | + } | ||
190 | + | ||
191 | + private void askActivateDialog() { | ||
192 | + mAlertDialogAskActivate = new AlertDialog.Builder(this) | ||
193 | + .setTitle(R.string.cos_dlg_activate_telco_title) | ||
194 | + .setMessage(R.string.cos_dlg_activate_telco_subtitle) | ||
195 | + .setPositiveButton(R.string.cos_dlg_positive_button, (dialogPositive, whichPositive) -> { | ||
196 | + activateGift(); | ||
197 | + }) | ||
198 | + .setNegativeButton(R.string.cos_dlg_negative_button2, (dialogNegative, whichNegative) -> { | ||
199 | + dialogNegative.dismiss(); | ||
200 | + }) | ||
201 | + .show(); | ||
202 | + } | ||
203 | + | ||
204 | + private void errorActivatingDialog() { | ||
205 | + mAlertDialogErrorActivating = new AlertDialog.Builder(this) | ||
206 | + .setTitle(R.string.cos_dlg_error_title) | ||
207 | + .setMessage(R.string.cos_dlg_error_subtitle) | ||
208 | + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { | ||
209 | + dialogPositive.dismiss(); | ||
210 | + }) | ||
211 | + .show(); | ||
212 | + } | ||
213 | + | ||
214 | + private void successActivatingDialog() { | ||
215 | + mAlertDialogSuccessActivating = new AlertDialog.Builder(this) | ||
216 | + .setTitle(R.string.cos_dlg_activate_success_title) | ||
217 | + .setMessage(R.string.cos_dlg_activate_success_subtitle) | ||
218 | + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { | ||
219 | + dialogPositive.dismiss(); | ||
220 | + }) | ||
221 | + .show(); | ||
222 | + } | ||
223 | + | ||
95 | // =========================================================== | 224 | // =========================================================== |
96 | // Inner and Anonymous Classes | 225 | // Inner and Anonymous Classes |
97 | // =========================================================== | 226 | // =========================================================== |
98 | 227 | ||
228 | + private final CallbackReceiver<Consumer> mConsumerCallback = new CallbackReceiver<Consumer>() { | ||
229 | + @Override | ||
230 | + public void onSuccess(Consumer result) { | ||
231 | + mConsumer = result; | ||
232 | + } | ||
233 | + | ||
234 | + @Override | ||
235 | + public void onFailure(int errorCode) { | ||
236 | + Log.v("TELCO_ACTIVITY", String.valueOf(errorCode)); | ||
237 | + } | ||
238 | + }; | ||
239 | + | ||
240 | + private CallbackReceiver<JSONObject> mSubmitCallback = new CallbackReceiver<JSONObject>() { | ||
241 | + @Override | ||
242 | + public void onSuccess(JSONObject result) { | ||
243 | + int status = result.optInt("status", 2); | ||
244 | + runOnUiThread(() -> { | ||
245 | + if (status == 1) | ||
246 | + successActivatingDialog(); | ||
247 | + else | ||
248 | + errorActivatingDialog(); | ||
249 | + }); | ||
250 | + } | ||
251 | + | ||
252 | + @Override | ||
253 | + public void onFailure(int errorCode) { | ||
254 | + runOnUiThread(() -> errorActivatingDialog()); | ||
255 | + } | ||
256 | + }; | ||
99 | } | 257 | } | ... | ... |
... | @@ -109,72 +109,72 @@ public class CosmoteSubmitOrderRequest { | ... | @@ -109,72 +109,72 @@ public class CosmoteSubmitOrderRequest { |
109 | // =========================================================== | 109 | // =========================================================== |
110 | 110 | ||
111 | public CosmoteSubmitOrderRequest setCommunicationUuid(String communicationUuid) { | 111 | public CosmoteSubmitOrderRequest setCommunicationUuid(String communicationUuid) { |
112 | - mCommunicationUuid = communicationUuid; | 112 | + this.mCommunicationUuid = communicationUuid; |
113 | return this; | 113 | return this; |
114 | } | 114 | } |
115 | 115 | ||
116 | public CosmoteSubmitOrderRequest setUserMsisdn(String userMsisdn) { | 116 | public CosmoteSubmitOrderRequest setUserMsisdn(String userMsisdn) { |
117 | - mUserMsisdn = userMsisdn; | 117 | + this.mUserMsisdn = userMsisdn; |
118 | return this; | 118 | return this; |
119 | } | 119 | } |
120 | 120 | ||
121 | public CosmoteSubmitOrderRequest setBusinessService(String businessService) { | 121 | public CosmoteSubmitOrderRequest setBusinessService(String businessService) { |
122 | - mBusinessService = businessService; | 122 | + this.mBusinessService = businessService; |
123 | return this; | 123 | return this; |
124 | } | 124 | } |
125 | 125 | ||
126 | public CosmoteSubmitOrderRequest setOfferName(String offerName) { | 126 | public CosmoteSubmitOrderRequest setOfferName(String offerName) { |
127 | - mOfferName = offerName; | 127 | + this.mOfferName = offerName; |
128 | return this; | 128 | return this; |
129 | } | 129 | } |
130 | 130 | ||
131 | public CosmoteSubmitOrderRequest setProductType(String productType) { | 131 | public CosmoteSubmitOrderRequest setProductType(String productType) { |
132 | - mProductType = productType; | 132 | + this.mProductType = productType; |
133 | return this; | 133 | return this; |
134 | } | 134 | } |
135 | 135 | ||
136 | public CosmoteSubmitOrderRequest setProvDuration(String provDuration) { | 136 | public CosmoteSubmitOrderRequest setProvDuration(String provDuration) { |
137 | - mProvDuration = provDuration; | 137 | + this.mProvDuration = provDuration; |
138 | return this; | 138 | return this; |
139 | } | 139 | } |
140 | 140 | ||
141 | public CosmoteSubmitOrderRequest setNoOfRecurrance(String noOfRecurrance) { | 141 | public CosmoteSubmitOrderRequest setNoOfRecurrance(String noOfRecurrance) { |
142 | - mNoOfRecurrance = noOfRecurrance; | 142 | + this.mNoOfRecurrance = noOfRecurrance; |
143 | return this; | 143 | return this; |
144 | } | 144 | } |
145 | 145 | ||
146 | public CosmoteSubmitOrderRequest setPrice(String price) { | 146 | public CosmoteSubmitOrderRequest setPrice(String price) { |
147 | - mPrice = price; | 147 | + this.mPrice = price; |
148 | return this; | 148 | return this; |
149 | } | 149 | } |
150 | 150 | ||
151 | public CosmoteSubmitOrderRequest setDiscount(String discount) { | 151 | public CosmoteSubmitOrderRequest setDiscount(String discount) { |
152 | - mDiscount = discount; | 152 | + this.mDiscount = discount; |
153 | return this; | 153 | return this; |
154 | } | 154 | } |
155 | 155 | ||
156 | public CosmoteSubmitOrderRequest setVoiceCategory(String voiceCategory) { | 156 | public CosmoteSubmitOrderRequest setVoiceCategory(String voiceCategory) { |
157 | - mVoiceCategory = voiceCategory; | 157 | + this.mVoiceCategory = voiceCategory; |
158 | return this; | 158 | return this; |
159 | } | 159 | } |
160 | 160 | ||
161 | public CosmoteSubmitOrderRequest setDataCategory(String dataCategory) { | 161 | public CosmoteSubmitOrderRequest setDataCategory(String dataCategory) { |
162 | - mDataCategory = dataCategory; | 162 | + this.mDataCategory = dataCategory; |
163 | return this; | 163 | return this; |
164 | } | 164 | } |
165 | 165 | ||
166 | public CosmoteSubmitOrderRequest setMinsValue(String minsValue) { | 166 | public CosmoteSubmitOrderRequest setMinsValue(String minsValue) { |
167 | - mMinsValue = minsValue; | 167 | + this.mMinsValue = minsValue; |
168 | return this; | 168 | return this; |
169 | } | 169 | } |
170 | 170 | ||
171 | public CosmoteSubmitOrderRequest setDataValue(String dataValue) { | 171 | public CosmoteSubmitOrderRequest setDataValue(String dataValue) { |
172 | - mDataValue = dataValue; | 172 | + this.mDataValue = dataValue; |
173 | return this; | 173 | return this; |
174 | } | 174 | } |
175 | 175 | ||
176 | public CosmoteSubmitOrderRequest setProvStepValueMins(String provStepValueMins) { | 176 | public CosmoteSubmitOrderRequest setProvStepValueMins(String provStepValueMins) { |
177 | - mProvStepValueMins = provStepValueMins; | 177 | + this.mProvStepValueMins = provStepValueMins; |
178 | return this; | 178 | return this; |
179 | } | 179 | } |
180 | 180 | ||
... | @@ -241,7 +241,24 @@ public class CosmoteSubmitOrderRequest { | ... | @@ -241,7 +241,24 @@ public class CosmoteSubmitOrderRequest { |
241 | JSONObject extraJson = new JSONObject(); | 241 | JSONObject extraJson = new JSONObject(); |
242 | extraJson.putOpt(KEY_ACTION, KEY_ACTION_VALUE); | 242 | extraJson.putOpt(KEY_ACTION, KEY_ACTION_VALUE); |
243 | extraJson.putOpt(KEY_PRODUCT_UUID, KEY_PRODUCT_UUID_VALUE); | 243 | extraJson.putOpt(KEY_PRODUCT_UUID, KEY_PRODUCT_UUID_VALUE); |
244 | - | 244 | + extraJson.putOpt(KEY_COMMUNICATION_UUID, mCommunicationUuid); |
245 | + | ||
246 | + JSONObject extraData = new JSONObject(); | ||
247 | + extraData.putOpt(KEY_USER_MSISDN, mUserMsisdn); | ||
248 | + extraData.putOpt(KEY_BUSINESS_SERVICE, mBusinessService); | ||
249 | + extraData.putOpt(KEY_OFFER_NAME, mOfferName); | ||
250 | + extraData.putOpt(KEY_PRODUCT_TYPE, mProductType); | ||
251 | + extraData.putOpt(KEY_PROV_DURATION, mProvDuration); | ||
252 | + extraData.putOpt(KEY_NO_OF_RECURRANCE, mNoOfRecurrance); | ||
253 | + extraData.putOpt(KEY_PRICE, mPrice); | ||
254 | + extraData.putOpt(KEY_DISCOUNT, mDiscount); | ||
255 | + extraData.putOpt(KEY_VOICE_CATEGORY, mVoiceCategory); | ||
256 | + extraData.putOpt(KEY_DATA_CATEGORY, mDataCategory); | ||
257 | + extraData.putOpt(KEY_MINS_VALUE, mMinsValue); | ||
258 | + extraData.putOpt(KEY_DATA_VALUE, mDataValue); | ||
259 | + extraData.putOpt(KEY_PROV_STEP_VALUE_MINS, mProvStepValueMins); | ||
260 | + | ||
261 | + extraJson.putOpt(KEY_EXTRA_DATA, extraData); | ||
245 | bodyJsonObject.putOpt(KEY_MAPP, extraJson); | 262 | bodyJsonObject.putOpt(KEY_MAPP, extraJson); |
246 | } catch (JSONException e) { | 263 | } catch (JSONException e) { |
247 | if (WarpConstants.DEBUG) | 264 | if (WarpConstants.DEBUG) | ... | ... |
... | @@ -2256,7 +2256,7 @@ public class WarplyManager { | ... | @@ -2256,7 +2256,7 @@ public class WarplyManager { |
2256 | public void onSuccess(JSONObject result) { | 2256 | public void onSuccess(JSONObject result) { |
2257 | int status = result.optInt("status", 2); | 2257 | int status = result.optInt("status", 2); |
2258 | if (status == 1) { | 2258 | if (status == 1) { |
2259 | - | 2259 | + receiver.onSuccess(result); |
2260 | } else | 2260 | } else |
2261 | receiver.onFailure(status); | 2261 | receiver.onFailure(status); |
2262 | } | 2262 | } | ... | ... |
... | @@ -90,6 +90,7 @@ | ... | @@ -90,6 +90,7 @@ |
90 | android:paddingHorizontal="32dp" | 90 | android:paddingHorizontal="32dp" |
91 | android:textColor="#415564" | 91 | android:textColor="#415564" |
92 | android:textSize="16sp" | 92 | android:textSize="16sp" |
93 | + tools:text="test test" | ||
93 | app:layout_constraintEnd_toEndOf="parent" | 94 | app:layout_constraintEnd_toEndOf="parent" |
94 | app:layout_constraintStart_toStartOf="parent" | 95 | app:layout_constraintStart_toStartOf="parent" |
95 | app:layout_constraintTop_toBottomOf="@+id/textView13" /> | 96 | app:layout_constraintTop_toBottomOf="@+id/textView13" /> | ... | ... |
... | @@ -104,6 +104,10 @@ | ... | @@ -104,6 +104,10 @@ |
104 | <string name="cos_dlg_error_subtitle2">Τα πεδία δεν είναι σωστά</string> | 104 | <string name="cos_dlg_error_subtitle2">Τα πεδία δεν είναι σωστά</string> |
105 | <string name="cos_dlg_success_couponset_title">Το κουπόνι σου ενεργοποιήθηκε</string> | 105 | <string name="cos_dlg_success_couponset_title">Το κουπόνι σου ενεργοποιήθηκε</string> |
106 | <string name="cos_dlg_success_couponset_subtitle">Μπορείς να το βρεις στην αρχική οθόνη της εφαρμογής και στην ενότητα ενεργά δώρα!</string> | 106 | <string name="cos_dlg_success_couponset_subtitle">Μπορείς να το βρεις στην αρχική οθόνη της εφαρμογής και στην ενότητα ενεργά δώρα!</string> |
107 | + <string name="cos_dlg_activate_telco_title">Ενεργοποίηση υπηρεσίας</string> | ||
108 | + <string name="cos_dlg_activate_telco_subtitle">Θέλετε να γίνει ενεργοποίηση στο Κινητό μου;</string> | ||
109 | + <string name="cos_dlg_activate_success_title">Το αίτημά σου ολοκληρώθηκε επιτυχώς!</string> | ||
110 | + <string name="cos_dlg_activate_success_subtitle">Θα ενημερωθείς άμεσα για την ενεργοποίηση του πακέτου σου.</string> | ||
107 | 111 | ||
108 | <string-array name="coupons_array"> | 112 | <string-array name="coupons_array"> |
109 | <item>Κουπόνια</item> | 113 | <item>Κουπόνια</item> | ... | ... |
-
Please register or login to post a comment