Skip to content

Commit 897cca9

Browse files
author
ehowlsla
committed
webapp example update
1 parent e223fc0 commit 897cca9

File tree

8 files changed

+165
-8
lines changed

8 files changed

+165
-8
lines changed

bootpay/src/main/java/kr/co/bootpay/BootpayBuilder.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,11 @@ public void show() {
419419
}
420420

421421
public void request() {
422+
423+
if(context == null) throw new IllegalStateException("context cannot be null from " + request.getUx());
424+
if (presenter == null) presenter = new BootpayPresenter(context);
425+
426+
422427
validCheck();
423428
UserInfo.update();
424429

@@ -430,6 +435,8 @@ public void request() {
430435
else throw new IllegalStateException(ux.toString() + " is not supported!");
431436
}
432437

438+
// public
439+
433440
private void requestDialog() {
434441
dialog = new BootpayDialog()
435442
.setData(request)

bootpay/src/main/java/kr/co/bootpay/BootpayWebView.kt

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,32 @@ internal class BootpayWebView @JvmOverloads constructor(context: Context, attrs:
171171

172172
private fun parse(url: String): Intent? {
173173
return try {
174-
Intent.parseUri(url, Intent.URI_INTENT_SCHEME)
174+
var intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME)
175+
if(intent?.`package` == null) {
176+
if(url == null) return intent
177+
if (url.startsWith("shinhan-sr-ansimclick"))
178+
intent.setPackage("com.shcard.smartpay")
179+
else if (url.startsWith("kftc-bankpay"))
180+
intent.setPackage("com.kftc.bankpay")
181+
else if (url.startsWith("ispmobile"))
182+
intent.setPackage("kvp.jjy.MispAndroid320")
183+
else if (url.startsWith("hdcardappcardansimclick"))
184+
intent.setPackage("com.hyundaicard.appcard")
185+
else if (url.startsWith("kb-acp"))
186+
intent.setPackage("com.kbcard.kbkookmincard")
187+
else if (url.startsWith("mpocket.online.ansimclick"))
188+
intent.setPackage("kr.co.samsungcard.mpocket")
189+
else if (url.startsWith("lotteappcard"))
190+
intent.setPackage("com.lcacApp")
191+
else if (url.startsWith("cloudpay"))
192+
intent.setPackage("com.hanaskcard.paycla")
193+
else if (url.startsWith("nhappvardansimclick"))
194+
intent.setPackage("nh.smart.nhallonepay")
195+
else if (url.startsWith("citispay"))
196+
intent.setPackage("kr.co.citibank.citimobile")
197+
else if (url.startsWith("kakaotalk")) intent.setPackage("com.kakao.talk")
198+
}
199+
intent
175200
} catch (e: URISyntaxException) {
176201
null
177202
}

bootpay/src/main/java/kr/co/bootpay/api/BootpayRestApi.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import retrofit2.http.*
77
import rx.Observable
88

99
internal interface BootpayRestApi {
10+
11+
12+
13+
1014
@FormUrlEncoded
1115
@POST("/app/rest/remote_link")
1216
fun request_link(

bootpay/src/main/java/kr/co/bootpay/api/BootpayRestService.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ internal class BootpayRestService(context: Context) {
1717
}
1818

1919
internal val api: BootpayRestApi by lazy {
20+
// https@ //api.play-pickle.com/account/auth/verification/phoneNumber
21+
2022
Retrofit.Builder()
2123
.baseUrl("https://api-ehowlsla.bootpay.co.kr")
2224
.client(client)

bootpay/src/main/java/kr/co/bootpay/model/RemoteLink.kt

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,82 @@ class RemoteLink {
2424
var delivery_price: Double? = null // 배달 금액
2525
var push_policy_type: Int? = null
2626

27+
28+
fun setMember(value: String): RemoteLink {
29+
member = value
30+
return this
31+
}
32+
33+
fun setIsReceiveMember(value: Boolean): RemoteLink {
34+
is_receive_member = value
35+
return this
36+
}
37+
38+
fun setSellerName(value: String): RemoteLink {
39+
seller_name = value
40+
return this
41+
}
42+
43+
fun setMemo(value: String): RemoteLink {
44+
memo = value
45+
return this
46+
}
47+
48+
fun setImgUrl(value: String): RemoteLink {
49+
img_url = value
50+
return this
51+
}
52+
53+
fun setDescHtml(value: String): RemoteLink {
54+
desc_html = value
55+
return this
56+
}
57+
58+
fun setDeliveryAreaPriceJeju(value: Double): RemoteLink {
59+
delivery_area_price_jeju = value
60+
return this
61+
}
62+
63+
fun setDeliveryAreaPriceNonJeju(value: Double): RemoteLink {
64+
delivery_area_price_nonjeju = value
65+
return this
66+
}
67+
68+
fun setIsAddr(value: Boolean): RemoteLink {
69+
is_addr = value
70+
return this
71+
}
72+
73+
fun setIsDeliveryArea(value: Boolean): RemoteLink {
74+
is_delivery_area = value
75+
return this
76+
}
77+
78+
fun setIsMemo(value: Boolean): RemoteLink {
79+
is_memo = value
80+
return this
81+
}
82+
83+
fun setItemPrice(value: Double): RemoteLink {
84+
item_price = value
85+
return this
86+
}
87+
88+
fun setPromotionPrice(value: Double): RemoteLink {
89+
promotion_price = value
90+
return this
91+
}
92+
93+
fun setDeliveryPrice(value: Double): RemoteLink {
94+
delivery_price = value
95+
return this
96+
}
97+
98+
fun setPushPolicyType(value: Int): RemoteLink {
99+
push_policy_type = value
100+
return this
101+
}
102+
27103
private fun remoteLink(vararg etcs: String) = "{${etcs.filter(String::isNotEmpty).joinToString()}}"
28104
private fun member() = member?.takeIf(String::isNotEmpty)?.let { "member: '$it'" } ?: ""
29105
private fun isReceiveMember() = is_receive_member?.let { "is_receive_member: '$it'" } ?: ""

sample/src/main/java/bootpay/co/kr/samplepayment/LocalHtmlActivity.java

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,22 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
117117

118118
private Intent parse(String url) {
119119
try {
120-
return Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
120+
Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
121+
if(intent.getPackage() == null) {
122+
if (url == null) return intent;
123+
if (url.startsWith("shinhan-sr-ansimclick")) intent.setPackage("com.shcard.smartpay");
124+
else if (url.startsWith("kftc-bankpay")) intent.setPackage("com.kftc.bankpay");
125+
else if (url.startsWith("ispmobile")) intent.setPackage("kvp.jjy.MispAndroid320");
126+
else if (url.startsWith("hdcardappcardansimclick")) intent.setPackage("com.hyundaicard.appcard");
127+
else if (url.startsWith("kb-acp")) intent.setPackage("com.kbcard.kbkookmincard");
128+
else if (url.startsWith("mpocket.online.ansimclick")) intent.setPackage("kr.co.samsungcard.mpocket");
129+
else if (url.startsWith("lotteappcard")) intent.setPackage("com.lcacApp");
130+
else if (url.startsWith("cloudpay")) intent.setPackage("com.hanaskcard.paycla");
131+
else if (url.startsWith("nhappvardansimclick")) intent.setPackage("nh.smart.nhallonepay");
132+
else if (url.startsWith("citispay")) intent.setPackage("kr.co.citibank.citimobile");
133+
else if (url.startsWith("kakaotalk")) intent.setPackage("com.kakao.talk");
134+
}
135+
return intent;
121136
} catch (URISyntaxException e) {
122137
e.printStackTrace();
123138
return null;

sample/src/main/java/bootpay/co/kr/samplepayment/MainActivity.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,16 @@
2828
import kr.co.bootpay.listner.ReadyListener;
2929
import kr.co.bootpay.model.BootExtra;
3030
import kr.co.bootpay.model.BootUser;
31+
import kr.co.bootpay.model.RemoteLink;
3132
import kr.co.bootpay.model.RemoteOrderForm;
3233
import kr.co.bootpay.model.RemoteOrderPre;
3334
import kr.co.bootpay.model.SMSPayload;
3435

3536
public class MainActivity extends AppCompatActivity {
36-
final String application_id = "59a4d4a1929b3f3b8b6422c8"; //dev
37-
// final String application_id = "5b9f51264457636ab9a07cdc"; //dev2
37+
// final String application_id = "5c99d9b8b6d49c516e19099a"; //dev
38+
final String application_id = "5b9f51264457636ab9a07cdc"; //dev2
39+
//private BootpayPresenter presenter;
40+
// BootpayPresenter present;
3841

3942
// private final String application_id = "5b14c0ffb6d49c40cda92c4e"; //pro
4043

@@ -58,6 +61,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
5861
}
5962

6063
public void goRequest(View v) {
64+
// BootpayRestService
65+
6166
// Spinner mySpinner = (Spinner) findViewById(R.id.your_spinner);
6267
// String text = mySpinner.getSelectedItem().toString();
6368
BootUser bootUser = new BootUser().setPhone("010-1234-5678"); // 구매자 정보
@@ -233,7 +238,11 @@ public void goFlutterActivity(View v) {
233238
public void goRemoteLink(View v) {
234239
BootUser bootUser = new BootUser().setPhone("010-1234-5678");
235240
BootExtra bootExtra = new BootExtra().setQuotas(new int[] {0,2,3});
236-
SMSPayload payload = new SMSPayload().setMessage("결제링크 안내입니다\n[결제링크]").setSenderPhone("010-1234-5678").setReceieverPhones(Arrays.asList("010-1234-5678"));
241+
SMSPayload payload = new SMSPayload().setMessage("결제링크 안내입니다\n[결제링크]").setSenderPhone("010-4033-4678").setReceieverPhones(Arrays.asList("010-4033-4678"));
242+
//.setStartAt(System.currentTimeMillis() + 5000);
243+
244+
// RemoteLink remoteLink = new RemoteLink().s();
245+
237246

238247
// 결제호출
239248
Bootpay.init(getFragmentManager())

sample/src/main/java/bootpay/co/kr/samplepayment/WebAppActivity.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.content.ActivityNotFoundException;
66
import android.content.Context;
77
import android.content.Intent;
8+
import android.content.pm.PackageInfo;
89
import android.content.pm.PackageManager;
910
import android.content.pm.ResolveInfo;
1011
import android.net.Uri;
@@ -20,6 +21,8 @@
2021
import android.webkit.WebViewClient;
2122
import java.net.URISyntaxException;
2223

24+
import kr.co.bootpay.Bootpay;
25+
2326

2427
public class WebAppActivity extends Activity implements WebAppBridgeInterface {
2528
WebView webview;
@@ -44,7 +47,8 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
4447
webview.getSettings().setJavaScriptEnabled(true);
4548
webview.getSettings().setDomStorageEnabled(true);
4649
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
47-
webview.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
50+
webview.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
51+
CookieManager.getInstance().setAcceptThirdPartyCookies(webview, true);
4852
}
4953

5054
webview.setWebChromeClient(new WebChromeClient() {
@@ -164,7 +168,22 @@ private Boolean isSpecialCase(String url) {
164168

165169
private Intent parse(String url) {
166170
try {
167-
return Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
171+
Intent intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);
172+
if(intent.getPackage() == null) {
173+
if (url == null) return intent;
174+
if (url.startsWith("shinhan-sr-ansimclick")) intent.setPackage("com.shcard.smartpay");
175+
else if (url.startsWith("kftc-bankpay")) intent.setPackage("com.kftc.bankpay");
176+
else if (url.startsWith("ispmobile")) intent.setPackage("kvp.jjy.MispAndroid320");
177+
else if (url.startsWith("hdcardappcardansimclick")) intent.setPackage("com.hyundaicard.appcard");
178+
else if (url.startsWith("kb-acp")) intent.setPackage("com.kbcard.kbkookmincard");
179+
else if (url.startsWith("mpocket.online.ansimclick")) intent.setPackage("kr.co.samsungcard.mpocket");
180+
else if (url.startsWith("lotteappcard")) intent.setPackage("com.lcacApp");
181+
else if (url.startsWith("cloudpay")) intent.setPackage("com.hanaskcard.paycla");
182+
else if (url.startsWith("nhappvardansimclick")) intent.setPackage("nh.smart.nhallonepay");
183+
else if (url.startsWith("citispay")) intent.setPackage("kr.co.citibank.citimobile");
184+
else if (url.startsWith("kakaotalk")) intent.setPackage("com.kakao.talk");
185+
}
186+
return intent;
168187
} catch (URISyntaxException e) {
169188
e.printStackTrace();
170189
return null;
@@ -191,7 +210,7 @@ private Boolean isExistInfo(Intent intent, Context context) {
191210
}
192211

193212
private Boolean isExistPackage(Intent intent, Context context) {
194-
return intent != null && context.getPackageManager().getLaunchIntentForPackage(intent.getPackage()) != null;
213+
return intent != null && intent.getPackage() != null && context.getPackageManager().getLaunchIntentForPackage(intent.getPackage()) != null;
195214
}
196215

197216
private boolean start(Intent intent, Context context) {

0 commit comments

Comments
 (0)