Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amazon API V2 #6

Open
wants to merge 45 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
8cb41d0
Basic API Functions to communicate with Amazon V2 API
hf2186 Nov 8, 2019
193b144
Updating Spree Functions to use V2 Flow and Functions Part 1
hf2186 Nov 10, 2019
5c71400
Updating Payment Processing and Library Functions
hf2186 Nov 11, 2019
cd05a98
Refactoring and streamlining functions
hf2186 Nov 11, 2019
e560525
Update Complete Flow to check for order state
hf2186 Nov 11, 2019
f0b0aa4
check if null webcheckout
hf2186 Nov 11, 2019
b44df8b
Updating logic to account for delayed capture
hf2186 Nov 11, 2019
2e8102f
Updating IPN to use V2 JSON
hf2186 Nov 11, 2019
9112d4f
Updating Close and Fixing Logic
hf2186 Nov 11, 2019
14da6bf
Removed unused code
hf2186 Nov 12, 2019
6c0e666
Clean up & Generalize Reponses
hf2186 Nov 12, 2019
250c265
Fixing Address Creation issues
hf2186 Nov 12, 2019
560907b
Fixing response logic on failures
hf2186 Nov 12, 2019
1509c5f
Updating URL Generation
hf2186 Nov 12, 2019
bde351d
Fixing errors
hf2186 Nov 12, 2019
048e786
Fix multiple payments issue
hf2186 Nov 12, 2019
1222def
Adding Address Restrictions
hf2186 Nov 13, 2019
868b89c
Fixing returns
hf2186 Nov 13, 2019
af54667
Adding Change of Payment / Address
hf2186 Nov 13, 2019
6dd9dcc
Updating gemspec and removing puts
hf2186 Nov 15, 2019
7dac072
make sure to move to payment so tax and payment calculations are correct
hf2186 Nov 15, 2019
40c8759
Changing inhertance and fixing order processing
hf2186 Nov 17, 2019
543b837
Fixing order address issues and cleaning up code
hf2186 Nov 17, 2019
f1cefd3
Fixing address issues
hf2186 Nov 18, 2019
74a8072
Override Registration Check
hf2186 Nov 18, 2019
571fe5f
Adding Additional Error Handling
hf2186 Nov 18, 2019
611a17d
Fixing order state issues
hf2186 Nov 19, 2019
7fcd556
removing state change
hf2186 Nov 19, 2019
fdd16a1
Fixing phone number being empty
hf2186 Nov 19, 2019
e7eebfa
Fixing order address clone issues
hf2186 Nov 19, 2019
74662bc
adding temp address
hf2186 Nov 19, 2019
19ad789
Fixes issue with state being null
hf2186 Nov 22, 2019
5140780
Fix Phone number issues
hf2186 Nov 22, 2019
5612013
Adding null buyer fixes
hf2186 Nov 25, 2019
a03ce4a
Merge pull request #7 from ShopFelixGray/hotfix/state-issue
hf2186 Nov 26, 2019
7ba4c05
Make sure a uid and email is there before moving forward
hf2186 Dec 18, 2019
67e6a60
Merge pull request #8 from ShopFelixGray/hotfix/null-auth
hf2186 Dec 20, 2019
11458aa
Making redirects dynamic
hf2186 Mar 11, 2020
a4a7a14
Merge pull request #9 from ShopFelixGray/hotfix/redirects
hf2186 Mar 12, 2020
f0759cb
Adding Amazon Delivery Notifications Code
hf2186 Jun 21, 2020
1e68df4
Adding Error Checking for random edge cases
hf2186 Jun 29, 2020
750f64d
Merge pull request #11 from ShopFelixGray/hotfix/v2-500errors
hf2186 Jun 29, 2020
af89fd6
Merge pull request #10 from ShopFelixGray/alexa-dn
hf2186 Jun 29, 2020
3b9d641
Fixes issue with null tracking or code
hf2186 Jul 3, 2020
55f9b00
Merge pull request #12 from ShopFelixGray/hotfix/alexa-dn
hf2186 Jul 3, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
##
source 'https://rubygems.org'

branch = ENV.fetch('SPREE_BRANCH', 'master')
gem 'spree' #, github: 'spree/spree', branch: branch
gem 'spree'

group :development, :test do
gem 'pry-rails'
Expand All @@ -21,7 +20,4 @@ group :test do
gem 'webmock'
end

gem 'pg'
gem 'mysql2'

gemspec
19 changes: 15 additions & 4 deletions app/controllers/spree/amazon_callback_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,24 @@
class Spree::AmazonCallbackController < ApplicationController
skip_before_action :verify_authenticity_token

# This is the body that is sent from Amazon's IPN
#
# {
# "merchantId": "Relevant Merchant for the notification",
# "objectType": "one of: Charge, Refund",
# "objectId": "Id of relevant object",
# "notificationType": "STATE_CHANGE",
# "notificationId": "Randomly generated Id, used for tracking only",
# "notificationVersion": "V1"
# }

def new
response = JSON.parse(request.body.read)
if JSON.parse(response["Message"])["NotificationType"] == "PaymentRefund"
refund_id = Hash.from_xml(JSON.parse(response["Message"])[ "NotificationData"])["RefundNotification"]["RefundDetails"]["AmazonRefundId"]
response = JSON.parse(response.body, symbolize_names: true)
if response[:objectType] == 'Refund'
refund_id = response[:objectId]
payment = Spree::LogEntry.where('details LIKE ?', "%#{refund_id}%").last.try(:source)
if payment
l = payment.log_entries.build(details: response.to_yaml)
l = payment.log_entries.build(details: response)
l.save
end
end
Expand Down
272 changes: 0 additions & 272 deletions app/controllers/spree/amazon_controller.rb

This file was deleted.

Loading