fastlane-plugin-sharethemeal 0.1.4.pre.alpha.pre.5 → 0.1.4.pre.alpha.pre.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
Y2Y5ZjM4MDZiMDg2NmE3OTU0MDljYjYxM2E4OGQ1MWNkNTJhNDk3NQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MjA2MThiMjYyNmI4MWEwM2I0ZjYwZGNkNGY0Njk0NzFhZDJmODJhZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzAwYjczYzQ3ZWIzNWI5Y2FhYTU5ZWE2MGI3M2IyMmQwODcyOWI1MzJjNDQz
|
10
|
+
Nzc3ZDljMWQ4OGEwMjYyZGEzODc5MTk5YzE0ZDMxZjkzMjMxNjRjMWI0Mjdl
|
11
|
+
MWUyNWJjOWI2ZDk3YzU3YTVjYWZmOWUwNTE2ZjMyYzYwYmNmMmE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTYxMzFlODFjNjFiZDI5OGU1OTA5YmY3MDg0MGIwYjJlMTUzYmZlMTQzYTgy
|
14
|
+
OGRkZjc4OGY2MmQxODhjMjQyYTljZWIzNTM1OTE2Y2NmMDIxNTA5OGFjOTEx
|
15
|
+
MGFjZWYyMDFjZWFmOTQxMDZjNDhhMWEyMTEyZjFlOGE4MWU3M2U=
|
@@ -2,50 +2,22 @@ require 'rest-client'
|
|
2
2
|
require 'base64'
|
3
3
|
require 'json'
|
4
4
|
require 'uri'
|
5
|
+
require 'stm_api'
|
5
6
|
module Fastlane
|
6
7
|
module Actions
|
7
8
|
class SharethemealAction < Action
|
8
9
|
def self.run(params)
|
9
10
|
FastlaneCore::PrintTable.print_values(config: params, hide_keys: [:userhash], title: "Summary for ShareTheMeal")
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
'userHash' => params[:userhash],
|
14
|
-
'currency' => params[:currency]
|
15
|
-
}
|
16
|
-
|
17
|
-
client_token = RestClient.post('https://api.sharethemeal.org/api/payment/braintree/client-tokens', token_payload.to_json,
|
18
|
-
content_type: :json, accept: :json,
|
19
|
-
Authorization: "Bearer #{bearer}")
|
20
|
-
|
21
|
-
client_token_response = JSON.parse(client_token)
|
22
|
-
|
23
|
-
auth_reply = JSON.parse(Base64.decode64(client_token_response['clientToken']))
|
24
|
-
finger_print = URI.encode_www_form_component(auth_reply['authorizationFingerprint'])
|
25
|
-
|
26
|
-
payment_infos = RestClient.get("https://api.braintreegateway.com/merchants/#{auth_reply['merchantId']}/client_api/v1/payment_methods?sharedCustomerIdentifierType=undefined&braintreeLibraryVersion=braintree%2Fweb%2F2.15.5&merchantAccountId=#{auth_reply['merchantAccountId']}&authorizationFingerprint=#{finger_print}&callback=")
|
27
|
-
payment_infos_json = JSON.parse(payment_infos)
|
28
|
-
|
29
|
-
transaction_payload = {
|
30
|
-
'userHash' => params[:userhash],
|
31
|
-
'amount' => params[:amount],
|
32
|
-
'currency' => params[:currency],
|
33
|
-
'paymentMethodNonce' => payment_infos_json['paymentMethods'].first['nonce'],
|
34
|
-
'teamId' => params[:team_id]
|
35
|
-
}
|
36
|
-
|
37
|
-
transaction_response = RestClient.post('https://api.sharethemeal.org/api/payment/braintree/transactions', transaction_payload.to_json, content_type: :json, accept: :json,
|
38
|
-
'Authorization' => "Bearer #{bearer}")
|
39
|
-
|
40
|
-
transaction_response_json = JSON.parse(transaction_response)
|
41
|
-
if transaction_response_json['result']['donationCreated'] == true
|
11
|
+
api = StmApi::Donation.new(params)
|
12
|
+
result = api.donate(amount: params[:amount])
|
13
|
+
if result == true
|
42
14
|
UI.success "Successfully Donated #{params[:amount]} #{params[:currency]} to ShareTheMeal 🍔 "
|
43
15
|
else
|
44
|
-
UI.
|
16
|
+
UI.important 'Donation was not successfully accepted, maybe card is invalid or something else'
|
45
17
|
end
|
46
|
-
|
47
18
|
rescue => err
|
48
|
-
|
19
|
+
puts err.backtrace
|
20
|
+
UI.error "Donation failed, be sure that you have done atleast one manual donation with a stored payment option: #{err.backtrace}"
|
49
21
|
end
|
50
22
|
|
51
23
|
def self.description
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fastlane-plugin-sharethemeal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.4.pre.alpha.pre.
|
4
|
+
version: 0.1.4.pre.alpha.pre.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Helmut Januschka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: stm_api
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: pry
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|