class Gcen::Client::API
Constants
- API_HOST
Attributes
Public Class Methods
Authentication
With each request, You must send an extra HTTP header, 'Authentication' We suggest using JSON as the data transfer type, hence you should set the Content Type to application/json All API
requests must be made over HTTPS in POST format.
# File lib/gcen/client/api.rb, line 16 def initialize(gcen_token:) @gcen_token = gcen_token end
Public Instance Methods
AML Registration This method will register a client with GCEN
@since 0.1.0
@see app.gcen.co.uk/Api/AMLRegister
# File lib/gcen/client/api.rb, line 26 def aml_register(params:) post_request('AMLRegister', params) end
Card Payment Deposit Make an investment/deposit by credit/debit card.
@since 0.1.0
@see app.gcen.co.uk/Api/CardPayment
# File lib/gcen/client/api.rb, line 59 def card_payment(params:) post_request('CardPayment', params) end
Check Card Payment Response This method checks whether a card payment was authorised and payment was successfully taken.
@since 0.1.0
@see app.gcen.co.uk/Api/CheckCardPaymentResponse
# File lib/gcen/client/api.rb, line 69 def check_card_payment_response(ref:, return_mac:) post_request('CheckCardPaymentResponse', { REF: ref, RETURNMAC: return_mac }) end
Confirm FX Quote - Bank Transfer This method confirms a given FX quote and returns the amount and bank account that the client must pay in to.
@since 0.1.0
@see app.gcen.co.uk/Api/ConfirmQuoteWithBankTransfer
# File lib/gcen/client/api.rb, line 127 def confirm_quote_with_bank_transfer(params:) post_request('ConfirmQuoteWithBankTransfer', params) end
Confirm FX Quote - Card Payment This method confirms a given FX quote and sets up the payment system so the user can place their transaction.
@since 0.1.0
@see app.gcen.co.uk/Api/ConfirmQuoteWithCardPayment
# File lib/gcen/client/api.rb, line 116 def confirm_quote_with_card_payment(params:) post_request('ConfirmQuoteWithCardPayment', params) end
Credit GCS Balance Makes a manual adjustment to a client's GCS balance.
@since 0.1.0
@see app.gcen.co.uk/Api/CreditGCSBalance
# File lib/gcen/client/api.rb, line 137 def credit_gcs_balance(client_id:, currency:, amount:) post_request('CreditGCSBalance', { ClientId: client_id, Currency: currency, Amount: amount }) end
GCS Balance This method will return the GCS balance for a given client's currency
@since 0.1.0
@see app.gcen.co.uk/Api/GCSBalance
# File lib/gcen/client/api.rb, line 36 def gcs_balance(client_id:, currency:) post_request('GCSBalance', { ClientId: client_id, Currency: currency }) end
GCS Balance Transfer Instructs GCEN to move money from one GCS client balance to another. Internally, GCEN creates a virutal deal for the “FromClient”. Money is moved from the “FromClient” balance to the virtual deal, and money is moved from the virutal deal to the “ToClient” balance.
@since 0.1.0
@see app.gcen.co.uk/Api/GCSBalanceTransfer
# File lib/gcen/client/api.rb, line 94 def gcs_balance_transfer(params:) post_request('GCSBalanceTransfer', params) end
FX Quote Generates a unique quote from GCEN to exchange currency. Returns an FX Online Deal Quotation with a quotation reference. Quote is valid for purchase up to 30 minutes.
@since 0.1.0
@see app.gcen.co.uk/Api/GetFXQuote
# File lib/gcen/client/api.rb, line 105 def get_fx_quote(params:) post_request('GetFXQuote', params) end
Bank transfer deposit Instructs GCEN of impending bank transfer deposit. Supplies the bank details and reference necessary.
@since 0.1.0
@see app.gcen.co.uk/Api/InvestmentDeposit
# File lib/gcen/client/api.rb, line 49 def investment_deposit(params:) post_request('InvestmentDeposit', params) end
Payment return from balance Instructs GCEN to make a payment out using one of the clients' GCS balances.
@since 0.1.0
@see app.gcen.co.uk/Api/PaymentReturnFromGCSBalance
# File lib/gcen/client/api.rb, line 82 def payment_return_from_gcs_balance(params:) post_request('PaymentReturnFromGCSBalance', params) end
Upload Documentation This method allows you to send GCEN the client's Id documents for them to verify and confirm the identity of the client.
@since 0.1.0
@see app.gcen.co.uk/Api/UploadIdDocuments
# File lib/gcen/client/api.rb, line 152 def upload_id_documents(client_id:, document_1:, document_2:) post_request('UploadIdDocuments', { ClientId: client_id, Document1: document_1, Document2: document_2 }) end
Private Instance Methods
# File lib/gcen/client/api.rb, line 162 def post_request(endpoint_name, body, content_type='application/json') http = Faraday.new(url: API_HOST) do |param| param.headers['Authentication'] = gcen_token param.adapter Faraday.default_adapter end response = http.post do |request| request.url endpoint_name request.body = body.to_json request.headers['Content-Type'] = content_type end JSON.parse(response.body) end