solidus_nexio 0.4.4 → 0.4.5

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: e5611e58e74746578d853b1330c02a4b68d60f85dbecba1d0f658806a9689fef
4
- data.tar.gz: a822798ec702e7fb9d579a6a6f27b13bd0734de9a759bd2aecce29ccca11d5a9
3
+ metadata.gz: a4f32f942482ab71b677fe06a8c00e9c464ea74e9e83ec92958d40a4eb0ba7ce
4
+ data.tar.gz: fec0dcf3f189afb377b5caf19299c34e30d4c7c79258ae86ece6719bdfebdca4
5
5
  SHA512:
6
- metadata.gz: 391a3b0cbcafdc0d8190f484f8331c0fbb1aad116f2cc87d55a7a7963883abee90f608f882671157813c7bc96002eb358a541c6459c87a1ecf7da3087e0b3514
7
- data.tar.gz: 47c244e166ad27b11929a73341fe8a2c6ff232e919e471cf288610454438e9153246890216da8801fe911dd6667978871ed6d1ac829383c813e2f75489c91fed
6
+ metadata.gz: 867b62c3d119bf846226c4e0bd4c1e32dc5250239645763f339a7b9e61e38f65216101f140f6a8e5d85889cb5c14d88db3287e8f20d21c025d2c4e17ca9e1a87
7
+ data.tar.gz: 859a74fe74eb4a88b78f557c13349864510abfc8f5aca95213ad2ef989d337f42d109b1a4367baf9226dd04d144af3b32360ff21b3ce40f26ce2a6cc3f5a493e
@@ -82,6 +82,17 @@ module SolidusNexio
82
82
  gateway.store(card, options.except(:card, :one_time_token))
83
83
  end
84
84
 
85
+ def cancel(id)
86
+ transaction = gateway.get_transaction(id)
87
+ return unless transaction
88
+
89
+ if transaction['transactionStatus'] == 20
90
+ credit(transaction['amount'].to_money.cents, id)
91
+ else
92
+ void(id)
93
+ end
94
+ end
95
+
85
96
  protected
86
97
 
87
98
  def gateway_class
@@ -89,9 +100,10 @@ module SolidusNexio
89
100
  end
90
101
 
91
102
  def add_transaction_options(options)
92
- result = %i(currency billing_address shipping_address).each_with_object({}) do |key, acc|
103
+ result = %i(currency billing_address).each_with_object({}) do |key, acc|
93
104
  acc[key] = options[key] if options[key].present?
94
105
  end
106
+ result[:address] = options[:shipping_address] if options[:shipping_address].present?
95
107
  if options[:originator].is_a?(::Spree::Payment) && options[:originator].order
96
108
  payment = options[:originator]
97
109
  result.merge!(SolidusNexio::NexioData.purchase(payment.order))
@@ -75,7 +75,7 @@ module SolidusNexio
75
75
  {
76
76
  id: line_item.id,
77
77
  description: line_item.product.name,
78
- price: line_item.price,
78
+ price: line_item.price.to_money.cents,
79
79
  quantity: line_item.quantity
80
80
  }
81
81
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SolidusNexio
4
- VERSION = '0.4.4'
4
+ VERSION = '0.4.5'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solidus_nexio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Whitespectre
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-20 00:00:00.000000000 Z
11
+ date: 2021-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails