App crash when using apple pay
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 30/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- ios, typescript
調査の方向性
Start with the Apple Pay authorization handler at node_modules/@nativescript/apple-pay/payment-authorization-view-controller-delegate.ios.js:43 and trace the request and paymentData shown in the issue. Reproduce the crash using the provided onApplePayTap flow, then verify that authorization no longer terminates the application and the payment sheet completes normally.
索引モデルが issue の本文から書いたものです。
説明
Error:
***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error: Uncaught Error: The data couldn’t be read because it isn’t in the correct format.
at
PKPaymentAuthorizationViewControllerDelegateImpl.paymentAuthorizationViewControllerDidAuthorizePaymentHandler(file: src/webpack:/vois-mgov/node_modules/@nativescript/apple-pay/payment-authorization-view-controller-delegate.ios.js:43:0)
(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught Error: The data couldn’t be read because it isn’t in the correct format.
at
PKPaymentAuthorizationViewControllerDelegateImpl.paymentAuthorizationViewControllerDidAuthorizePaymentHandler(file: src/webpack:/vois-mgov/node_modules/@nativescript/apple-pay/payment-authorization-view-controller-delegate.ios.js:43:0)
', reason: '(null)'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff20406d44 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201a4a65 objc_exception_throw + 48
2 NativeScript 0x000000010610de7e __copy_helper_block_e8_32o + 0
3 libdispatch.dylib 0x00007fff201148e4 _dispatch_call_block_and_release + 12
4 libdispatch.dylib 0x00007fff20115b25 _dispatch_client_callout + 8
5 libdispatch.dylib 0x00007fff20123043 _dispatch_main_queue_drain + 1050
6 libdispatch.dylib 0x00007fff20122c1b _dispatch_main_queue_callback_4
code:
const MERCHANTID = '388333172821828292929';
const SomeIdentifierFromPaymentProvider = '89290109290129912088';
export const onApplePayTap = async (args?: any) => {
//try {
// just ensuring this runs only on iOS
if (isIOS) {
const applePayBtn = args.object as ApplePayBtn
// setup the event listeners for the delegate for apple pay for our button
applePayBtn.once(ApplePayEvents.DidAuthorizePaymentHandler, async (args: any) => {
console.log('in authorize handler')
console.log(ApplePayEvents.DidAuthorizePaymentHandler)
// this is where you do backend processing with your payment provider (Stripe, PayPal, etc.)
// this payload is just a sample, your payload to a provider will likely be different
// you can see here how to access the encrypted values from Apple Pay inside the `args.data.paymentData`
const payloadToBackend = {
transaction_type: 'purchase',
merchant_ref: args.data.paymentData.header.transactionId,
method: '3DS',
'3DS': {
merchantIdentifier: SomeIdentifierFromPaymentProvider,
data: args.data.paymentData.data,
signature: args.data.paymentData.signature,
version: args.data.paymentData.version,
header: args.data.paymentData.header
}
}
const result = true //await this.someHttpMethodToYourProviderBackend(payloadToBackend)
if (result) {
// need this to call when the payment is successful to close the payment sheet correctly on iOS
args.completion(ApplePayTransactionStatus.Success)
// now you can follow through with your user flow since the transaction has been successful with your provider
} else {
// payment failed on the backend, so show the FAILURE to close the Apple Pay sheet
args.completion(ApplePayTransactionStatus.Failure)
}
})
// these are the items your customer is paying for
const paymentItems = ([
{
amount: 20.5,
label: 'Balance',
type: ApplePayPaymentItemType.Final
}
] as unknown) as ApplePayItems[]
const request = {
paymentItems,
merchantId: MERCHANTID // the merchant ID for this app
merchantCapabilities: ApplePayMerchantCapability.ThreeDS,
countryCode: 'US',
currencyCode: 'USD',
shippingContactFields: [ApplePayContactFields.Name, ApplePayContactFields.PostalAddress],
billingContactFields: [ApplePayContactFields.Name, ApplePayContactFields.PostalAddress],
supportedNetworks: [
ApplePayNetworks.Amex,
ApplePayNetworks.Visa,
ApplePayNetworks.Discover,
ApplePayNetworks.MasterCard
]
} as ApplePayRequest
// `createPaymentRequest` will call into the Apple Pay SDK and present the user with the payment sheet for the configuration provided
await applePayBtn.createPaymentRequest(request).catch((err) => {
console.log('Apple Pay Error', err)
})
}
- 主要言語
- TypeScript
- スター
- 35
- フォーク
- 13
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NativeScript/payments のほかの issue
-
com.android.billingclient:billing@@8.0.0 - com.google.android.gms.internal.play_billing.zzbg.zzeオープン
難易度 4/5 3〜5日 初心者へのやさしさ 28/100
NativeScript/payments#45 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
NativeScript/payments#43 · リアクション 2 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
NativeScript/payments#39 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
NativeScript/payments#36 · コメント 2 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
NativeScript/payments#35 ·
NativeScript/payments の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
メンテナーはふだん 2 日以内に返信
-
reproduced
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
anomalyco/opencode#62052 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
strapi/design-system#2084 ·
メンテナーはふだん 3 日以内に返信
-
check:passed streams:remove
難易度 1/5 1時間未満 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
OAuth documentation for GET /api/v2/users/me/ appears inconsistent with required global read scopeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信