Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task: add support for cart items #32

Merged

Conversation

luca-gr4vy
Copy link
Collaborator

@luca-gr4vy luca-gr4vy commented Jun 26, 2024

Description: Adds support for the missing cartItems properties: discountAmount, taxAmount, externalIdentifier, sku, productUrl, imageUrl, categories and productType.

Tested locally with simulators, the values appear in the transaction response and on dashboard.

Note: the iOS part requires this gr4vy-ios update to be available (will need to upgrade to 2.2.1) gr4vy/gr4vy-ios#12

Screenshot 2024-06-26 at 11 37 20

Ticket: https://gr4vy.atlassian.net/browse/TA-7501

@luca-gr4vy luca-gr4vy added minor Increment the minor version when merged release Create a release when this pr is merged labels Jun 26, 2024
Comment on lines 184 to 185
let discountAmount = dict["discountAmount"] as? Int ?? 0
let taxAmount = dict["taxAmount"] as? Int ?? 0
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is waiting for the type update in the iOS SDK https://github.com/gr4vy/gr4vy-ios/blob/main/gr4vy-iOS/Models/Gr4vyCartItem.swift. We don't want to pass a default of 0 as this would cause a mismatch between the passed prop and the value in the JWT if people don't pass anything

@@ -29,6 +29,8 @@
},
"resolutions": {
"braces": "^3.0.3",
"tar": "^6.2.1"
"tar": "^6.2.1",
"ws": "^7.5.10",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fix ws vulnerability

@@ -61,6 +66,25 @@ public static <T> T coalesce(T... items) {
return null;
}

public static Object getMapOptionalValue(ReadableMap map, String key) {
Copy link
Collaborator Author

@luca-gr4vy luca-gr4vy Jun 26, 2024

Choose a reason for hiding this comment

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

ReadableMap doesn't seem to have a method to get options values and fallback to null, so adding one here

@luca-gr4vy luca-gr4vy requested a review from gryevns June 26, 2024 11:37
@@ -311,7 +333,7 @@ class EmbedReactNative: NSObject {
]
)
return
case .transactionCreated(let transactionID, let status, let paymentMethodID):
case .transactionCreated(let transactionID, let status, let paymentMethodID, let approvalUrl):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is needed by the latest update otherwise the build fails gr4vy/gr4vy-ios#10

@luca-gr4vy luca-gr4vy requested a review from victormferrara July 1, 2024 08:59
@luca-gr4vy luca-gr4vy merged commit 8acbe03 into main Jul 1, 2024
3 checks passed
@luca-gr4vy luca-gr4vy deleted the task/TA-7501-add-support-for-connection-options-and-cart-items branch July 1, 2024 09:11
@gr4vy-code
Copy link
Contributor

🚀 PR was released in v1.2.0 🚀

@gr4vy-code gr4vy-code added the released This issue/pull request has been released. label Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged release Create a release when this pr is merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants