Skip to content

Issue/5801 simple payments link#6241

Merged
wzieba merged 18 commits intotrunkfrom
issue/5801-simple-payments-link
Apr 14, 2022
Merged

Issue/5801 simple payments link#6241
wzieba merged 18 commits intotrunkfrom
issue/5801-simple-payments-link

Conversation

@nbradbury
Copy link
Copy Markdown
Contributor

@nbradbury nbradbury commented Apr 12, 2022

Closes #5801 - adds a "Share payment link" row to the simple payment flow to enable users to easily share the link to taking payment. Note that this requires WooCommerce 6.4 for testing since the payment_url field wasn't available until that version.

This means either using the WooCommerce beta tester plugin to install the latest 6.4 RC, or downloading the RC from here and uploading it manually.

To test:

  • Before updating to the 6.4 RC, step through the simple payment flow and verify the "Share payment link" does not appear
  • Update to the 6.4 RC and verify that it does show, and tapping it enables sharing the link
payment-link.mp4

@peril-woocommerce
Copy link
Copy Markdown

peril-woocommerce bot commented Apr 12, 2022

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@wpmobilebot
Copy link
Copy Markdown
Collaborator

wpmobilebot commented Apr 12, 2022

You can test the changes on this Pull Request by downloading an installable build, or scanning this QR code:

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 12, 2022

Codecov Report

Merging #6241 (3fa49b1) into trunk (729be76) will increase coverage by 24.45%.
The diff coverage is 27.08%.

❗ Current head 3fa49b1 differs from pull request most recent head a51f790. Consider uploading reports for the commit a51f790 to get more accurate results

@@             Coverage Diff              @@
##             trunk    #6241       +/-   ##
============================================
+ Coverage         0   24.45%   +24.45%     
- Complexity       0     2554     +2554     
============================================
  Files            0      787      +787     
  Lines            0    45250    +45250     
  Branches         0     5676     +5676     
============================================
+ Hits             0    11066    +11066     
- Misses           0    33161    +33161     
- Partials         0     1023     +1023     
Impacted Files Coverage Δ
...merce/android/ui/inbox/domain/ObserveInboxNotes.kt 0.00% <0.00%> (ø)
...id/ui/orders/simplepayments/TakePaymentFragment.kt 0.00% <0.00%> (ø)
...d/ui/orders/simplepayments/TakePaymentViewModel.kt 20.43% <50.00%> (ø)
...main/kotlin/com/woocommerce/android/model/Order.kt 86.40% <100.00%> (ø)
...otlin/com/woocommerce/android/model/OrderMapper.kt 74.07% <100.00%> (ø)
...products/categories/ProductCategoriesRepository.kt 0.00% <0.00%> (ø)
...ocommerce/android/ui/reviews/ReviewModerationUi.kt 0.00% <0.00%> (ø)
...ommerce/android/ui/mystore/data/StatsRepository.kt 3.03% <0.00%> (ø)
...oid/ui/products/reviews/ProductReviewsViewModel.kt 0.00% <0.00%> (ø)
...otlin/com/woocommerce/android/widgets/tags/ITag.kt 0.00% <0.00%> (ø)
... and 782 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 729be76...a51f790. Read the comment docs.

…droid into issue/5801-simple-payments-link

Conflicts:
	WooCommerce/src/main/kotlin/com/woocommerce/android/ui/inbox/domain/InboxRepository.kt
	build.gradle
@wpmobilebot
Copy link
Copy Markdown
Collaborator

Found 1 violations:

The PR caused the following dependency changes:

expand

-+--- org.wordpress:fluxc:trunk-91ee60846f10b9689cd1162ccffd26313b093fd0
-|    +--- org.wordpress:wellsql:1.7.0
-|    |    \--- org.wordpress.wellsql:wellsql-annotations:1.7.0
-|    +--- org.wordpress.fluxc:fluxc-annotations:trunk-91ee60846f10b9689cd1162ccffd26313b093fd0
-|    +--- org.greenrobot:eventbus:3.3.1 (*)
-|    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.9.2 (*)
-|    +--- com.android.volley:volley:1.1.1 -> 1.2.0
-|    +--- androidx.paging:paging-runtime:2.1.2
-|    |    +--- androidx.paging:paging-common:2.1.2
-|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
-|    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
-|    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.1.0 (*)
-|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.4.0 (*)
-|    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.4.0 (*)
-|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
-|    +--- com.goterl:lazysodium-android:5.0.2
-|    +--- net.java.dev.jna:jna:5.5.0
-|    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 (*)
-|    +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.10
-|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 (*)
-|    +--- androidx.appcompat:appcompat:1.0.2 -> 1.4.1 (*)
-|    +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
-|    +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.2.0
-|    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
-|    +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0 -> 4.9.2
-|    |    +--- com.squareup.okhttp3:okhttp:4.9.2 (*)
-|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.6.10 (*)
-|    +--- com.google.code.gson:gson:2.8.5 -> 2.8.9
-|    +--- org.apache.commons:commons-text:1.1 -> 1.8 (*)
-|    +--- androidx.room:room-runtime:2.4.2
-|    |    +--- androidx.room:room-common:2.4.2
-|    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
-|    |    +--- androidx.sqlite:sqlite-framework:2.2.0
-|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
-|    |    |    \--- androidx.sqlite:sqlite:2.2.0
-|    |    |         \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
-|    |    +--- androidx.sqlite:sqlite:2.2.0 (*)
-|    |    +--- androidx.arch.core:core-runtime:2.0.1 -> 2.1.0 (*)
-|    |    \--- androidx.annotation:annotation-experimental:1.1.0
-|    +--- androidx.room:room-ktx:2.4.2
-|    |    +--- androidx.room:room-common:2.4.2 (*)
-|    |    +--- androidx.room:room-runtime:2.4.2 (*)
-|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 (*)
-|    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2 (*)
-|    +--- com.google.dagger:dagger:2.29.1 -> 2.40.5
-|    |    \--- javax.inject:javax.inject:1
-|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.5.2 (*)
-|    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.5.2 (*)
++--- org.wordpress:fluxc:trunk-884c546e3c2cdca6e743b3439082c42c5aa81b85
+|    +--- org.wordpress:wellsql:1.7.0
+|    |    \--- org.wordpress.wellsql:wellsql-annotations:1.7.0
+|    +--- org.wordpress.fluxc:fluxc-annotations:trunk-884c546e3c2cdca6e743b3439082c42c5aa81b85
+|    +--- org.greenrobot:eventbus:3.3.1 (*)
+|    +--- com.squareup.okhttp3:okhttp:4.9.0 -> 4.9.2 (*)
+|    +--- com.android.volley:volley:1.1.1 -> 1.2.0
+|    +--- androidx.paging:paging-runtime:2.1.2
+|    |    +--- androidx.paging:paging-common:2.1.2
+|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
+|    |    |    \--- androidx.arch.core:core-common:2.0.0 -> 2.1.0 (*)
+|    |    +--- androidx.arch.core:core-runtime:2.0.0 -> 2.1.0 (*)
+|    |    +--- androidx.lifecycle:lifecycle-runtime:2.0.0 -> 2.4.0 (*)
+|    |    +--- androidx.lifecycle:lifecycle-livedata:2.0.0 -> 2.4.0 (*)
+|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
+|    +--- com.goterl:lazysodium-android:5.0.2
+|    +--- net.java.dev.jna:jna:5.5.0
+|    +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 (*)
+|    +--- org.jetbrains.kotlin:kotlin-android-extensions-runtime:1.6.10
+|    |    \--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 (*)
+|    +--- androidx.appcompat:appcompat:1.0.2 -> 1.4.1 (*)
+|    +--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
+|    +--- androidx.exifinterface:exifinterface:1.0.0 -> 1.2.0
+|    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
+|    +--- com.squareup.okhttp3:okhttp-urlconnection:4.9.0 -> 4.9.2
+|    |    +--- com.squareup.okhttp3:okhttp:4.9.2 (*)
+|    |    \--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.4.10 -> 1.6.10 (*)
+|    +--- com.google.code.gson:gson:2.8.5 -> 2.8.9
+|    +--- org.apache.commons:commons-text:1.1 -> 1.8 (*)
+|    +--- androidx.room:room-runtime:2.4.2
+|    |    +--- androidx.room:room-common:2.4.2
+|    |    |    \--- androidx.annotation:annotation:1.1.0 -> 1.3.0
+|    |    +--- androidx.sqlite:sqlite-framework:2.2.0
+|    |    |    +--- androidx.annotation:annotation:1.0.0 -> 1.3.0
+|    |    |    \--- androidx.sqlite:sqlite:2.2.0
+|    |    |         \--- androidx.annotation:annotation:1.0.0 -> 1.3.0
+|    |    +--- androidx.sqlite:sqlite:2.2.0 (*)
+|    |    +--- androidx.arch.core:core-runtime:2.0.1 -> 2.1.0 (*)
+|    |    \--- androidx.annotation:annotation-experimental:1.1.0
+|    +--- androidx.room:room-ktx:2.4.2
+|    |    +--- androidx.room:room-common:2.4.2 (*)
+|    |    +--- androidx.room:room-runtime:2.4.2 (*)
+|    |    +--- org.jetbrains.kotlin:kotlin-stdlib:1.6.10 (*)
+|    |    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.5.2 (*)
+|    +--- com.google.dagger:dagger:2.29.1 -> 2.40.5
+|    |    \--- javax.inject:javax.inject:1
+|    +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.5.2 (*)
+|    \--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.5.2 (*)
-\--- org.wordpress.fluxc.plugins:woocommerce:trunk-91ee60846f10b9689cd1162ccffd26313b093fd0
-     +--- org.wordpress:wellsql:1.7.0 (*)
-     +--- org.wordpress.fluxc:fluxc-annotations:trunk-91ee60846f10b9689cd1162ccffd26313b093fd0
-     +--- androidx.room:room-ktx:2.4.2 (*)
-     +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 (*)
-     +--- org.wordpress:fluxc:trunk-91ee60846f10b9689cd1162ccffd26313b093fd0 (*)
-     +--- org.apache.commons:commons-lang3:3.7 -> 3.9
-     +--- com.google.code.gson:gson:2.8.0 -> 2.8.9
-     +--- com.google.dagger:dagger:2.29.1 -> 2.40.5 (*)
-     +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.5.2 (*)
-     +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.5.2 (*)
-     \--- androidx.room:room-runtime:2.4.2 (*)
+\--- org.wordpress.fluxc.plugins:woocommerce:trunk-884c546e3c2cdca6e743b3439082c42c5aa81b85
+     +--- org.wordpress:wellsql:1.7.0 (*)
+     +--- org.wordpress.fluxc:fluxc-annotations:trunk-884c546e3c2cdca6e743b3439082c42c5aa81b85
+     +--- androidx.room:room-ktx:2.4.2 (*)
+     +--- org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.6.10 (*)
+     +--- org.wordpress:fluxc:trunk-884c546e3c2cdca6e743b3439082c42c5aa81b85 (*)
+     +--- org.apache.commons:commons-lang3:3.7 -> 3.9
+     +--- com.google.code.gson:gson:2.8.0 -> 2.8.9
+     +--- com.google.dagger:dagger:2.29.1 -> 2.40.5 (*)
+     +--- org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9 -> 1.5.2 (*)
+     +--- org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9 -> 1.5.2 (*)
+     \--- androidx.room:room-runtime:2.4.2 (*)

Please review and act accordingly

@nbradbury nbradbury requested a review from wzieba April 13, 2022 11:14
@nbradbury nbradbury marked this pull request as ready for review April 13, 2022 11:14
Copy link
Copy Markdown
Contributor

@wzieba wzieba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Works good but I think we can simplify things by removing ViewState, WDYT?

And I've noticed that navigating back from the share screen puts the user to the list of orders - maybe we should navigate back to "take payment options" instead?

Screen.Recording.2022-04-14.at.12.13.06.mov

) : ScopedViewModel(savedState) {
private val navArgs: TakePaymentFragmentArgs by savedState.navArgs()

val viewStateLiveData = LiveDataDelegate(savedState, ViewState())
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 WDYT about not introducing observable ViewState and just take needed value from val order?

order is not a subject to change on this screen - when selected, we don't have to observe for any changes. Using order#paymentUrl directly in fragment's onCreateView will simplify this ViewModel.

private val navArgs: TakePaymentFragmentArgs by savedState.navArgs()

val viewStateLiveData = LiveDataDelegate(savedState, ViewState())
internal var viewState by viewStateLiveData
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔧 internal is not very useful here, probably private is the fit

Suggested change
internal var viewState by viewStateLiveData
private var viewState by viewStateLiveData

@peril-woocommerce
Copy link
Copy Markdown

peril-woocommerce bot commented Apr 14, 2022

Warnings
⚠️ PR is not assigned to a milestone.

Generated by 🚫 dangerJS

@nbradbury
Copy link
Copy Markdown
Contributor Author

@wzieba Thanks for the review! I've made the suggested changes, except for navigating back to the "take payment" screen when the user backs out of the share sheet.

I initially had it only leave that fragment when registerForActivityResult returned RESULT_OK, but that turned out to be unreliable. It returns RESULT_OK when the user chooses to copy the URL to the clipboard, but sometimes it resturns RESULT_CANCELED even if the user successfully shared the URL (Gmail, for example, does this).

So the choice was to either always return to the order list, or always return to "Take payment," and I opted for the former.

@wzieba
Copy link
Copy Markdown
Contributor

wzieba commented Apr 14, 2022

I see, it works really strange also with e.g. Facebook Messenger 🤷 . After sharing I had to navigate back and the result was RESULT_CANCELED.

Looks good, CI is failing but only CircleCI and it's not related to this PR (p1649933536095639-slack-CC7L49W13).

:shipit:

Copy link
Copy Markdown
Contributor

@wzieba wzieba left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding improvements!

@wzieba wzieba enabled auto-merge April 14, 2022 14:50
@wzieba
Copy link
Copy Markdown
Contributor

wzieba commented Apr 14, 2022

Oh I see that CircleCI is required step. So I think we have to wait for working CircleCI.

@wzieba wzieba merged commit 4a62832 into trunk Apr 14, 2022
@wzieba wzieba deleted the issue/5801-simple-payments-link branch April 14, 2022 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Simple Payments]: Add payment link

4 participants