Module: PaysonAPI::V1

Defined in:
lib/payson_api/v1/client.rb,
lib/payson_api/v1/config.rb,
lib/payson_api/v1/sender.rb,
lib/payson_api/v1/funding.rb,
lib/payson_api/v1/envelope.rb,
lib/payson_api/v1/receiver.rb,
lib/payson_api/v1/order_item.rb,
lib/payson_api/v1/remote_error.rb,
lib/payson_api/v1/requests/ipn.rb,
lib/payson_api/v1/responses/ipn.rb,
lib/payson_api/v1/requests/payment.rb,
lib/payson_api/v1/shipping_address.rb,
lib/payson_api/v1/responses/payment.rb,
lib/payson_api/v1/responses/validate.rb,
lib/payson_api/v1/requests/payment_update.rb,
lib/payson_api/v1/requests/payment_details.rb,
lib/payson_api/v1/responses/payment_update.rb,
lib/payson_api/v1/responses/payment_details.rb,
lib/payson_api/v1/errors/unknown_locale_error.rb,
lib/payson_api/v1/errors/unknown_currency_error.rb,
lib/payson_api/v1/errors/unknown_fees_payer_error.rb,
lib/payson_api/v1/errors/unknown_payment_action_error.rb,
lib/payson_api/v1/errors/unknown_funding_constraint_error.rb,
lib/payson_api/v1/errors/unknown_guarantee_offering_error.rb

Defined Under Namespace

Modules: Errors, Requests, Responses Classes: Client, Configuration, Envelope, Funding, OrderItem, Receiver, RemoteError, Sender, ShippingAddress

Constant Summary collapse

PAYSON_WWW_HOST_ENDPOINT =
'https://www.payson.se'
PAYSON_WWW_PAY_FORWARD_URL =
'/paysecure/?token=%s'
PAYSON_API_ENDPOINT =
'https://api.payson.se'
PAYSON_API_VERSION =
'1.0'
PAYSON_API_PAY_ACTION =
'Pay'
PAYSON_API_PAYMENT_DETAILS_ACTION =
'PaymentDetails'
PAYSON_API_PAYMENT_UPDATE_ACTION =
'PaymentUpdate'
PAYSON_API_PAYMENT_VALIDATE_ACTION =
'Validate'
PAYSON_API_TEST_ENDPOINT =
'https://test-api.payson.se'
PAYSON_WWW_HOST_TEST_ENDPOINT =
'https://test-www.payson.se'
LOCALES =
%w[SV EN FI].freeze
CURRENCIES =
%w[SEK EUR].freeze
FEES_PAYERS =
%w[EACHRECEIVER SENDER PRIMARYRECEIVER SECONDARYONLY].freeze
FUNDING_CONSTRAINTS =
%w[CREDITCARD BANK INVOICE SMS].freeze
GUARANTEE_OFFERINGS =
%w[OPTIONAL REQUIRED NO].freeze
PAYMENT_STATUSES =
%w[CREATED PENDING PROCESSING COMPLETED CREDITED
INCOMPLETE ERROR EXPIRED REVERSALERROR ABORTED].freeze
PAYMENT_TYPES =
%w[TRANSFER GUARANTEE INVOICE].freeze
GUARANTEE_STATUSES =
%w[WAITINGFORSEND WAITINGFORACCEPTANCE WAITINGFORRETURN
WAITINGFORRETURNACCEPTANCE RETURNNOTACCEPTED NOTRECEIVED RETURNNOTRECEIVED
MONEYRETURNEDTOSENDER RETURNACCEPTED].freeze
INVOICE_STATUSES =
%w[PENDING ORDERCREATED CANCELED SHIPPED DONE CREDITED].freeze
PAYMENT_ACTIONS =
%w[CANCELORDER SHIPORDER CREDITORDER REFUND].freeze

Class Method Summary collapse

Class Method Details

.api_base_urlObject



55
56
57
# File 'lib/payson_api/v1/config.rb', line 55

def api_base_url
  test? ? PAYSON_API_TEST_ENDPOINT : PAYSON_API_ENDPOINT
end

.configObject



38
39
40
# File 'lib/payson_api/v1/config.rb', line 38

def config
  @config
end

.configure {|@config ||= Configuration.new| ... } ⇒ Object

Yields:



34
35
36
# File 'lib/payson_api/v1/config.rb', line 34

def configure
  yield @config ||= Configuration.new # rubocop:disable Naming/MemoizedInstanceVariableName
end

.forward_url(token) ⇒ Object



59
60
61
# File 'lib/payson_api/v1/config.rb', line 59

def forward_url(token)
  (test? ? PAYSON_WWW_HOST_TEST_ENDPOINT : PAYSON_WWW_HOST_ENDPOINT) + PAYSON_WWW_PAY_FORWARD_URL % token
end

.test?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/payson_api/v1/config.rb', line 51

def test?
  @config.test_mode || @config.api_user_id == '4'
end