Skip to content

Commit 569a30f

Browse files
committed
npay support
1 parent e398a7f commit 569a30f

File tree

4 files changed

+30
-9
lines changed

4 files changed

+30
-9
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import android.os.AsyncTask;
99
import android.telephony.TelephonyManager;
1010
import android.text.TextUtils;
11+
import android.util.Log;
1112

1213

1314
import com.google.android.gms.ads.identifier.AdvertisingIdClient;
@@ -18,6 +19,10 @@ public class Bootpay {
1819
private static Context context;
1920
protected static BootpayBuilder builder;
2021

22+
public static void setContext(Context context) {
23+
Bootpay.context = context;
24+
}
25+
2126

2227
public static void useOnestoreApi(Context context) {
2328
useOnestoreApi(context, true);
@@ -72,8 +77,8 @@ protected String doInBackground(final Void... params) {
7277

7378
try {
7479

80+
// Log.d("intent", e.getMessage());
7581
return AdvertisingIdClient.getAdvertisingIdInfo(context).getId();
76-
// Logger.logDebug("adid : " + adId);
7782
} catch (IllegalStateException ex) {
7883
ex.printStackTrace();
7984
// Logger.logError("IllegalStateException");
@@ -109,6 +114,7 @@ public static BootpayBuilder init(Fragment fragment) {
109114
}
110115

111116
public static BootpayBuilder init(FragmentManager fragmentManager) {
117+
// fragmentManager.c
112118
return builder = new BootpayBuilder(fragmentManager);
113119
}
114120

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ public BootpayBuilder(FragmentManager manager) {
5959
}
6060

6161
public BootpayBuilder setContext(Context context) {
62+
Bootpay.setContext(context);
6263
this.context = context;
6364
return this;
6465
}
@@ -308,6 +309,9 @@ public BootpayBuilder setMethod(Method method) {
308309
case KAKAO:
309310
request.setMethod("kakao");
310311
break;
312+
case NPAY:
313+
request.setMethod("npay");
314+
break;
311315
}
312316
return this;
313317
}
@@ -428,7 +432,7 @@ private void validCheck() {
428432
if(ux == null || ux == UX.NONE) { request.setUX(UX.PG_DIALOG); }
429433
ux = request.getUX();
430434
if(ux == UX.PG_DIALOG) {
431-
if (fragmentManager == null && fragmentManager.isDestroyed()) { error("fragment 값은 null 이 될 수 없습니다."); }
435+
if (fragmentManager == null || fragmentManager.isDestroyed()) { error("fragment 값은 null 이 될 수 없습니다."); }
432436

433437
} else if(ux == UX.APP2APP_CARD_SIMPLE
434438
|| ux == UX.APP2APP_NFC

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

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@
1313
import android.os.Message;
1414
import android.util.AttributeSet;
1515
import android.util.Log;
16+
import android.view.Gravity;
1617
import android.view.KeyEvent;
1718
import android.view.View;
19+
import android.view.ViewGroup;
1820
import android.webkit.CookieManager;
1921
import android.webkit.JavascriptInterface;
2022
import android.webkit.JsResult;
2123
import android.webkit.WebChromeClient;
2224
import android.webkit.WebSettings;
2325
import android.webkit.WebView;
2426
import android.webkit.WebViewClient;
27+
import android.widget.FrameLayout;
28+
import android.widget.LinearLayout;
2529

2630
import java.net.URISyntaxException;
2731
import java.util.List;
@@ -33,7 +37,7 @@
3337
import kr.co.bootpay.pref.UserInfo;
3438

3539
public class BootpayWebView extends WebView {
36-
private static final String BOOTPAY = "https://inapp.bootpay.co.kr/3.2.0/production.html";
40+
private static final String BOOTPAY = "https://inapp.bootpay.co.kr/3.2.1/production.html";
3741

3842
private Dialog dialog;
3943
// private ConnectivityManager connManager;
@@ -110,6 +114,10 @@ public BootpayWebView(Context context, AttributeSet attrs, int defStyleAttr) {
110114
public void onPageFinished(WebView view, String url) {
111115
super.onPageFinished(view, url);
112116
if (request == null) return;
117+
// if ("about:blank".equals(url)) {
118+
// loadUrl(BOOTPAY);
119+
// return;
120+
// }
113121
if (!isLoaded) {
114122
isLoaded = true;
115123
setDevice();
@@ -594,11 +602,14 @@ public boolean onCreateWindow(WebView view, boolean isDialog, boolean isUserGest
594602
} else if(listener != null){
595603
newWindow.setOnResponseListener(listener);
596604
}
597-
// if(javascriptInterfaceObject != null)
598-
// newWindow.setJavascriptInterface(javascriptInterfaceObject, javascriptInterfaceName);
599605

606+
addView(newWindow,
607+
new FrameLayout.LayoutParams(
608+
ViewGroup.LayoutParams.MATCH_PARENT,
609+
ViewGroup.LayoutParams.MATCH_PARENT,
610+
Gravity.NO_GRAVITY)
611+
);
600612

601-
addView(newWindow);
602613
WebView.WebViewTransport tr = (WebView.WebViewTransport) resultMsg.obj;
603614
tr.setWebView(newWindow);
604615
resultMsg.sendToTarget();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ protected void onCreate(Bundle savedInstanceState) {
3939
BootpayAnalytics.init(this, application_id);
4040
// BootpayAnalytics.init(this, "5b14c0ffb6d49c40cda92c4e");
4141

42-
Bootpay.useOnestoreApi(this);
42+
// Bootpay.useOnestoreApi(this);
4343

4444
// BootpayAnalytics.init(this, "59a7e647396fa64fcad4a8c2");
4545

@@ -74,8 +74,8 @@ public void onClick_request(View v) {
7474
Bootpay.init(getFragmentManager())
7575
.setContext(this)
7676
.setApplicationId(application_id) // 해당 프로젝트(안드로이드)의 application id 값
77-
.setPG(PG.DANAL) // 결제할 PG 사
78-
.setMethod(Method.CARD)
77+
.setPG(PG.INICIS) // 결제할 PG 사
78+
.setMethod(Method.BANK)
7979
.setBootExtra(bootExtra)
8080
.setBootUser(bootUser)
8181
// .setUserPhone("010-1234-5678") // 구매자 전화번호

0 commit comments

Comments
 (0)