Skip to content

Commit

Permalink
Merge pull request #14 from bayonetio/develop
Browse files Browse the repository at this point in the history
Ecommerce api - add support for `order_id` and `bayonet_tracking_id`
  • Loading branch information
imran-arshad authored Mar 12, 2018
2 parents 0b9c8db + 11cf640 commit 6522ed7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ Once you have Bayonet's SDK configured, you can call the APIs with the following
zip_code: '64000'
},
payment_method: 'card',
transaction_id: '<your internal ID for this transaction>',
order_id: '<your internal ID for this order (mandatory)>',
transaction_id: '<your internal ID for this transaction (optional)>',
payment_gateway: 'stripe',
coupon: 'discount_buen_fin',
expedited_shipping: true,
Expand All @@ -103,10 +104,13 @@ Once you have Bayonet's SDK configured, you can call the APIs with the following
```ruby
BayonetClient::Ecommerce.update-transaction({
order_id: '<your internal ID for this order (as sent in the consult step)>',
transaction_id: '<your internal ID for this transaction (as sent in the consult step)>',
bayonet_tracking_id: '<tracking ID returned by the API in the consult step>',
transaction_status: 'success',
...
})
# please note that you can use either one of 'order_id', 'transaction_id', or 'bayonet_tracking_id' to update the status of a transaction
```
* Feedback-historical API
Expand Down
5 changes: 4 additions & 1 deletion lib/bayonet_client/response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module BayonetClient

class BayonetResponse
attr_accessor :rules_triggered,
:decision, :payload, :reason_code,
:decision, :bayonet_tracking_id, :payload, :reason_code,
:reason_message, :request_body, :bayonet_fingerprint,
:raw

Expand All @@ -16,6 +16,9 @@ def initialize(parsed_response)
if parsed_response.key?('decision')
self.decision = parsed_response['decision']
end
if parsed_response.key?('bayonet_tracking_id')
self.bayonet_tracking_id = parsed_response['bayonet_tracking_id']
end
if parsed_response.key?('payload')
self.payload = parsed_response['payload']
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bayonet_client/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module BayonetClient
VERSION = '2.1.2'
VERSION = '2.2.1'
SUPPORTED_API_VERSIONS = ['2']
end
1 change: 1 addition & 0 deletions spec/fixtures/api_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ params_consult: {
},
payment_method: card,
transaction_time: 1476813671,
order_id: test_ruby_123,
transaction_id: test_ruby_123,
payment_gateway: stripe,
channel: ecommerce,
Expand Down

0 comments on commit 6522ed7

Please sign in to comment.