omniauth-uber-eats-oauth2 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: cea19e4b210768c9b76023ad072499cfb20e97e46797f8a7ef2b7caec39dfe25
|
|
4
|
+
data.tar.gz: 308a306de3280c6eed9f0f75eca1919fa9bdbc6d426f7bb4b398ebf4146fcd18
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7350e7c0c56a3786c6743afbc75be6b186a83e2fd74f27e7c1a5bbd474ed44a2ca35335f5d31eeef204d9370589c3bf70994378c1ea3282754c6b6c4f5d487e4
|
|
7
|
+
data.tar.gz: 6805ee5e9e3d1e9adf72f3db8c8a9ba19e4fe2aecd812f344beba03591dc12f6db5304b0e0ef9f463a3b8274f586fbc23810e6e897031c4c5e028f6dc49bc003
|
|
@@ -73,12 +73,15 @@ module OmniAuth
|
|
|
73
73
|
raise
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
# UID: prefer store_id from API, fall back to uber_user_id from token
|
|
77
|
+
uid do
|
|
78
|
+
raw_info['store_id'] || raw_info['id'] || uber_user_id
|
|
79
|
+
end
|
|
77
80
|
|
|
78
81
|
info do
|
|
79
82
|
{
|
|
80
|
-
name: raw_info['store_name'],
|
|
81
|
-
business_name: raw_info['store_name'],
|
|
83
|
+
name: raw_info['store_name'] || "Uber Eats Store",
|
|
84
|
+
business_name: raw_info['store_name'] || "Uber Eats Store",
|
|
82
85
|
email: nil # Uber Eats doesn't provide merchant email via API
|
|
83
86
|
}
|
|
84
87
|
end
|
|
@@ -93,9 +96,20 @@ module OmniAuth
|
|
|
93
96
|
|
|
94
97
|
private
|
|
95
98
|
|
|
99
|
+
# Extract user ID from the access token response.
|
|
100
|
+
# Uber's token response includes uber_user_id or we can derive from token params.
|
|
101
|
+
def uber_user_id
|
|
102
|
+
return @uber_user_id if defined?(@uber_user_id)
|
|
103
|
+
|
|
104
|
+
@uber_user_id = access_token.params['uber_user_id'] ||
|
|
105
|
+
access_token.params['user_id'] ||
|
|
106
|
+
access_token.token&.first(32) # last resort: use token prefix as stable ID
|
|
107
|
+
end
|
|
108
|
+
|
|
96
109
|
def fetch_store_info
|
|
97
110
|
response = access_token.get('/v1/eats/stores')
|
|
98
111
|
parsed = response.parsed
|
|
112
|
+
log(:info, "Store info response: #{parsed.inspect}")
|
|
99
113
|
stores = parsed['stores'] || []
|
|
100
114
|
store = stores.first
|
|
101
115
|
|
|
@@ -107,10 +121,11 @@ module OmniAuth
|
|
|
107
121
|
'status' => store['status']
|
|
108
122
|
}
|
|
109
123
|
else
|
|
124
|
+
log(:warn, "No stores found in response, using fallback UID")
|
|
110
125
|
{ 'store_id' => nil }
|
|
111
126
|
end
|
|
112
127
|
rescue StandardError => e
|
|
113
|
-
log(:warn, "Failed to fetch store info: #{e.message}")
|
|
128
|
+
log(:warn, "Failed to fetch store info: #{e.message} — using fallback UID")
|
|
114
129
|
{ 'store_id' => nil }
|
|
115
130
|
end
|
|
116
131
|
|