razorpay / razorpay-pod

:iphone: CocoaPod implementation of Razorpay's Payment SDK. Refer for instructions:
https://docs.razorpay.com/v1/page/ios-integration
MIT License
21 stars 18 forks source link

Merchant Image inside the options for 1.0.16, Swift 4.1, Xcode 9.3 #23

Closed akashvercetti closed 6 years ago

akashvercetti commented 6 years ago

Using pod 1.0.16, Xcode 9.3, Swift 4.1. The options dictionary used to accept a UIImage object in the previous versions but now they don't. So I converted it to base64 but that doesn't work either. SO is an online URL the only way to add a merchant image now?

AbhinavArora95 commented 6 years ago

Hi @akashvercetti . The options dictionary still accepts a UIImage object against the key image. Please confirm the options you are using.

akashvercetti commented 6 years ago

@AbhinavArora95 Heres the debug console options log

["description": "request", "name": "Secure", "amount": 1000, "image": <UIImage: 0x1c00b9e60> size {60, 60} orientation 0 scale 2.000000, "theme": ["color": "#14254b"], "notes": ["Consumer": 2, "RequestID": 0, "id": "UDSGAF167SS7FB6HDB7907GGEVAUGKBN", "app": "Secure"]]

And here's the output crash log

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Invalid type in JSON write (UIImage)'

The UIImage is not null, its the same as the one used in previous Razorpay versions. The only thing that has changed is the pod version.

AbhinavArora95 commented 6 years ago

The crash that you are getting is because of the way you are creating the UIImage. Please confirm the options that you are sending to checkout (in the code and not the debug). Also, attach the code you are using to create the UIImage.

akashvercetti commented 6 years ago
var options: [String : Any] = [
                "amount" : amount,
                "name":AppUtility.sharedInstance.app.displayName,
                "image": UIImage(named: "AppIcon60x60") ?? UIImage(),
                "description": "Service request",
                "theme": [
                    "color": Color.primary.value.shortHex
                ],
                "notes": notes
            ]

The UIImage(named: "AppIcon60x60") is not nil, I did a po command to double check it. This dictionary works with 1.0.8

AbhinavArora95 commented 6 years ago

Hi @akashvercetti, It appears in some specific scenarios the issue might arise in our sdks. We will be rolling out a fix for this in a couple of days. Till then you can pass the url of the image you want to show under the same key. Apologies for the inconvenience.

iThink32 commented 6 years ago

closing this issue now , reopen if any issue exists