venmo / venmo-ios-sdk

Make and accept payments in your iOS app via Venmo
MIT License
178 stars 57 forks source link

VENTransation+VenmoSDK transactionWithSignedRequestDictionary broken #100

Open btrzupek opened 8 years ago

btrzupek commented 8 years ago

The code has a comment stating that the response will be in this format: // { // "payments": [ // { // "payment_id": "1234", // "verb": "pay", // "actor_user_id": "1", // "target_user_id": "2", // "amount": "1.00", // "note": "Have a drink on me!", // "success": 1 // } // ] // } However, the response is actually in this format: { action = charge; actor = { about = " "; "date_joined" = "2013-10-01T18:39:13"; "display_name" = "xxx"; "first_name" = xxx; "friends_count" = 18; id = ; "is_active" = 1; "is_blocked" = 0; "is_group" = 0; "last_name" = xxx; "profile_picture_url" = "xxxx"; username = "xxxx"; }; amount = "-9.00"; audience = public; "date_created" = "2015-10-29T21:21:38"; id = ; medium = iphone; note = "xxxxxx"; status = pending; success = 1; target = { type = email; }; }

This means that the following lines (as well as a few more): transaction.transactionID = cleanDictionary[@"payment_id"]; NSString *transactionType = cleanDictionary[@"verb"];

need to be updated to reference the correct keys from the actual response dictionary. The correct keys being: transaction.transactionID = cleanDictionary[@"id"]; NSString *transactionType = cleanDictionary[@"action"];

btrzupek commented 8 years ago

Upon further review, either the server responses are somehow incorrect or this class has not been updated in quite some time. There are several items that are completely out of sync in here.