Skip to content

Commit 94c0469

Browse files
committed
Merge branch '331-adjust-receipt-attachments-handling' into 'master'
Resolve "Adjust receipt attachments handling" Closes #331 See merge request pace/mobile/android/pace-cloud-sdk!359
2 parents 72fbf5b + b5bc1df commit 94c0469

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

library/src/main/java/cloud/pace/sdk/appkit/app/webview/AppWebViewModel.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ class AppWebViewModelImpl(
951951
ReceiptAttachmentsResult(ReceiptAttachmentsResult.Failure(ReceiptAttachmentsResult.Failure.StatusCode.RequestTimeout, ReceiptAttachmentsError("Timeout for receiptAttachments"))),
952952
ReceiptAttachmentsResult(ReceiptAttachmentsResult.Failure(ReceiptAttachmentsResult.Failure.StatusCode.InternalServerError, ReceiptAttachmentsError("An error occurred")))
953953
) { continuation ->
954-
appModel.onReceiptAttachmentsRequestReceived(receiptAttachmentsRequest.paymentMethod) {
954+
appModel.onReceiptAttachmentsRequestReceived(context, receiptAttachmentsRequest.paymentMethod) {
955955
continuation.resumeIfActive(ReceiptAttachmentsResult(ReceiptAttachmentsResult.Success(ReceiptAttachmentsResponse(it))))
956956
}
957957
}

library/src/main/java/cloud/pace/sdk/appkit/communication/AppCallback.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,11 @@ interface AppCallback {
188188
/**
189189
* Is called when the app asks for additional attachments that should be printed on the fueling receipt
190190
*
191+
* @param context The [cloud.pace.sdk.appkit.app.AppActivity] context.
191192
* @param paymentMethod For which payment method the attachments are requested
192193
* @param attachments Call this function to specify attachments or not
193194
*/
194-
fun onReceiptAttachmentsRequestReceived(paymentMethod: String, attachments: (List<String>?) -> Unit)
195+
fun onReceiptAttachmentsRequestReceived(context: Context, paymentMethod: String, attachments: (List<String>?) -> Unit)
195196
}
196197

197198
abstract class AppCallbackImpl : AppCallback, CloudSDKKoinComponent {
@@ -256,7 +257,7 @@ abstract class AppCallbackImpl : AppCallback, CloudSDKKoinComponent {
256257
email(null)
257258
}
258259

259-
override fun onReceiptAttachmentsRequestReceived(paymentMethod: String, attachments: (List<String>?) -> Unit) {
260+
override fun onReceiptAttachmentsRequestReceived(context: Context, paymentMethod: String, attachments: (List<String>?) -> Unit) {
260261
attachments(null)
261262
}
262263
}

library/src/main/java/cloud/pace/sdk/appkit/communication/AppModel.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ interface AppModel {
7575
fun onGooglePayPayment(googlePayPaymentRequest: GooglePayPaymentRequest, onResult: (Completion<GooglePayPaymentResponse>) -> Unit)
7676
fun onNavigationRequestReceived(lat: Double, lon: Double, name: String)
7777
fun onReceiptEmailRequestReceived(paymentMethod: String, email: (String?) -> Unit)
78-
fun onReceiptAttachmentsRequestReceived(paymentMethod: String, attachments: (List<String>?) -> Unit)
78+
fun onReceiptAttachmentsRequestReceived(context: Context, paymentMethod: String, attachments: (List<String>?) -> Unit)
7979

8080
class Result<T>(val onResult: (T) -> Unit)
8181
}
@@ -394,9 +394,9 @@ class AppModelImpl(
394394
}
395395
}
396396

397-
override fun onReceiptAttachmentsRequestReceived(paymentMethod: String, attachments: (List<String>?) -> Unit) {
397+
override fun onReceiptAttachmentsRequestReceived(context: Context, paymentMethod: String, attachments: (List<String>?) -> Unit) {
398398
coroutineScope.launch {
399-
callback?.onReceiptAttachmentsRequestReceived(paymentMethod, attachments)
399+
callback?.onReceiptAttachmentsRequestReceived(context, paymentMethod, attachments)
400400
}
401401
}
402402

0 commit comments

Comments
 (0)