spree_paypal_api_checkout 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6a5a5201c741e77e835868a6fda79d71b658c1b58fabca8ef39d3990199294f2
4
- data.tar.gz: d9b4e0c18fef43f234f07ed9bfc011811fbd87b49751cb524dfba3f189c428df
3
+ metadata.gz: 07c55f4fc562fc1c5cafec50afb576a3498ff4569cc6d390c1f02fc174efa002
4
+ data.tar.gz: 7ad4654823019c8eb7b7ee1b14132ce1974240ae373c42fafba6ef0d22d8656a
5
5
  SHA512:
6
- metadata.gz: fb54727dee1cef2a75bdf4527b6ba3c33d2dad98cb14a85ec36099be4c7f3dd9c0ed80918fd4a794330d47055c069113b20fc01fb8b62c0df73cfe2988dc4e33
7
- data.tar.gz: 9cf9906841e3359b96fae7f8581dcea5c24026035c7a02e46a7351efc9c1b17d8bb9a3c1f029330b07f7f4f89cb5dae9be5c04d14f034cd2335282e31fabfe45
6
+ metadata.gz: 168e3b4bf6eb7f34e7f0838853a2bdbfdc4b14bb19520cf7ec737a1e9124b8f6c972786022dccaf8353ac9fb8ffdd5f323f1d7011d096411b93f5c4dae93aaa4
7
+ data.tar.gz: 36ca56115090032c1487903d9f7b8bde7a7612a37d061fbd37ebe8fd7e02a81e5f4ba2e9b70d30b76b63e1538a068d5a5592db9b7eb0176f40b2df7dc8285a89
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  1. Add this extension to your Gemfile with this line:
6
6
 
7
- gem 'spree_paypal_api_checkout', '~> 0.0.8'
7
+ gem 'spree_paypal_api_checkout', '~> 0.0.9'
8
8
 
9
9
  2. Install the gem using Bundler:
10
10
 
@@ -19,7 +19,7 @@ module Spree
19
19
  items << {
20
20
  name: adjustment.label,
21
21
  quantity: 1,
22
- amount: {
22
+ unit_amount: {
23
23
  currency_code: order.currency,
24
24
  value: adjustment.amount
25
25
  }
@@ -70,13 +70,14 @@ module Spree
70
70
  def line_item(item)
71
71
  {
72
72
  name: item.product.name,
73
- number: item.variant.sku,
73
+ sku: item.variant.sku,
74
74
  quantity: item.quantity,
75
- amount: {
75
+ description: item.product.meta_description,
76
+ unit_amount: {
76
77
  currency_code: item.order.currency,
77
78
  value: item.price
78
79
  },
79
- ItemCategory: "Physical"
80
+ item_category: "Physical"
80
81
  }
81
82
  end
82
83
 
@@ -87,14 +88,38 @@ module Spree
87
88
  {
88
89
  amount: {
89
90
  currency_code: current_order.currency,
90
- value: order.total
91
+ value: order.total,
92
+ breakdown: {
93
+ item_total: {
94
+ currency_code: current_order.currency,
95
+ value: items.sum{|r| (r[:unit_amount][:value] * r[:quantity]) }
96
+ }
97
+ }
91
98
  },
92
- item: items
99
+ items: items,
100
+ shipping: address_options
93
101
  },
94
102
  ]
95
103
  }
96
104
  end
97
105
 
106
+ def address_options
107
+ address = current_order.ship_address
108
+ {
109
+ name: { full_name: address.try(:full_name) },
110
+ address: {
111
+ address_line_1: address.address1,
112
+ address_line_2: address.address2,
113
+ # phone: address.phone,
114
+ admin_area_1: address.state_text,
115
+ admin_area_2: address.city,
116
+ country_code: address.country.iso,
117
+ postal_code: address.zipcode
118
+ },
119
+ type: 'SHIPPING'
120
+ }
121
+ end
122
+
98
123
  def payment_method
99
124
  Spree::PaymentMethod.find(params[:payment_method_id])
100
125
  end
@@ -1,3 +1,3 @@
1
1
  module SpreePaypalApiCheckout
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "spree_paypal_api_checkout".freeze
3
- s.version = "0.0.8"
3
+ s.version = "0.0.9"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
6
6
  s.require_paths = ["lib".freeze]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_paypal_api_checkout
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spree Commerce
@@ -401,7 +401,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
401
401
  version: '0'
402
402
  requirements:
403
403
  - none
404
- rubygems_version: 3.2.15
404
+ rubygems_version: 3.0.3
405
405
  signing_key:
406
406
  specification_version: 4
407
407
  summary: Adds PayPal API Checkout as a Payment Method to Spree Commerce