active_payment 1.0.2 → 1.0.3

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
  SHA1:
3
- metadata.gz: 86cc807af32728220a2a5b0aa04fdefd7d3c3fa9
4
- data.tar.gz: d8da2706c270520c49f6923e86aa2223257e3fb7
3
+ metadata.gz: 0896a5bea7ca3f4ad64160c9a83d71c97da93f43
4
+ data.tar.gz: 4a1d6ce9a6d12ec602c220a1a28bfc98e5452a5c
5
5
  SHA512:
6
- metadata.gz: 67cae441864d18349b48636dcbf5591525efa6dc3d288f07801f11196620f08d69e062dc98eedd90ba214e9a012600c2413813da3d1611621d69fc224f9eee69
7
- data.tar.gz: 0e16ade868cb1c79bd319969b61d04ec3f2a5640c45711bf93fec703946e6b25a37fb0e7276ce8477b2a347594247a3abb83af2897464911ba4f3ac38581f8ec
6
+ metadata.gz: e9c87745a4e4ecdb7a1f42fa4968187e93366b680c55dd5da35b3ccfe9ac131949aedd4b8a647d5c78d249f2d1ae3a8e9d8fe3a41a8f16ab90f00c9cf373a872
7
+ data.tar.gz: c9342816bd91964f00a9c11b11c2e2b9208fbafe9e98ba597e760562c6794341282e75813977919fc07f057aa156c3cd9bbe09b4209228a21911506ede22422a
@@ -17,7 +17,7 @@ module ActivePayment
17
17
  @sales = sales
18
18
 
19
19
  response = @gateway.setup_purchase(purchase_data(sales))
20
- raise ActivePayment::InvalidGatewayResponseError unless response.success?
20
+ raise ActivePayment::InvalidGatewayResponseError.new(response) unless response.success?
21
21
 
22
22
  @purchase_token = response['payKey']
23
23
  @gateway.set_payment_options(payment_options_data(@purchase_token, @sales))
@@ -20,7 +20,7 @@ module ActivePayment
20
20
  amount = @sales.amount_in_cents.to_i
21
21
 
22
22
  response = @gateway.setup_purchase(amount, paypal_data(payables))
23
- raise ActivePayment::InvalidGatewayResponseError unless response.success?
23
+ raise ActivePayment::InvalidGatewayResponseError.new(response) unless response.success?
24
24
 
25
25
  @purchase_token = response.token
26
26
  @gateway.redirect_url_for(response.token)
@@ -32,11 +32,11 @@ module ActivePayment
32
32
 
33
33
  begin
34
34
  response = @gateway.details_for(token)
35
- fail ActivePayment::InvalidGatewayResponseError unless response.success?
35
+ fail ActivePayment::InvalidGatewayResponseError.new(response) unless response.success?
36
36
 
37
37
  amount = params[:amount]
38
38
  purchase_response = @gateway.purchase(amount, params.merge(payer_id: response.payer_id))
39
- fail ActivePayment::InvalidGatewayResponseError unless purchase_response.success?
39
+ fail ActivePayment::InvalidGatewayResponseError.new(purchase_response) unless purchase_response.success?
40
40
  rescue ActivePayment::InvalidGatewayResponseError
41
41
  return false
42
42
  end
@@ -1,3 +1,3 @@
1
1
  module ActivePayment
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
@@ -18,7 +18,15 @@ require 'active_payment/models/payable'
18
18
  module ActivePayment
19
19
  attr_accessor :configuration
20
20
 
21
- class InvalidGatewayResponseError < StandardError; end
21
+ class StandardResponseError < StandardError
22
+ attr_accessor :response
23
+
24
+ def initialize(response = nil)
25
+ @response = response
26
+ end
27
+ end
28
+
29
+ class InvalidGatewayResponseError < StandardResponseError; end
22
30
  class InvalidAmountError < StandardError; end
23
31
  class InvalidItemsError < StandardError; end
24
32
  class InvalidGatewayUserError < StandardError; end
Binary file