def get_statement(start_date = '2016-08-29', end_date = '2016-09-01') 
      return nil unless @access_token

      @timestamp = Time.now.iso8601(3)
      @start_date = start_date.to_s
      @end_date = end_date.to_s
      @path = "/banking/v3/corporates/"
      @relative_url = "#{@path}#{@corporate_id}/accounts/#{@account_number}/statements?EndDate=#{@end_date}&StartDate=#{@start_date}"
      begin
        response = RestClient.get("#{@base_url}#{@relative_url}",
        "Content-Type": 'application/json',
        "Authorization": "Bearer #{@access_token}",
        "Origin": @domain,
        "X-BCA-Key": @api_key,
        "X-BCA-Timestamp":  @timestamp,
        "X-BCA-Signature": signature)
        elements = JSON.parse response.body
        statements = []

        elements['Data'].each do |element|
          year = Date.parse(@start_date).strftime('%m').to_i.eql?(12) ? Date.parse(@start_date).strftime('%Y') : Date.parse(@end_date).strftime('%Y')
          date = element['TransactionDate'].eql?("PEND") ? element['TransactionDate'] : "#{element['TransactionDate']}/#{year}"
          attribute = {
            date: date,
            brance_code: element['BranchCode'],
            type: element['TransactionType'],
            amount: element['TransactionAmount'].to_f,
            name: element['TransactionName'],
            trailer: element['Trailer']
          }
          statements << BcaStatement::Entities::Statement.new(attribute)
        end
        statements
      rescue RestClient::ExceptionWithResponse => err
        return nil
      end 
    end
def get_statement(start_date = '2016-08-29', end_date = '2016-09-01') 
      return nil unless @access_token

      @timestamp = Time.now.iso8601(3)
      @start_date = start_date.to_s
      @end_date = end_date.to_s
      @path = "/banking/v3/corporates/"
      @relative_url = "#{@path}#{@corporate_id}/accounts/#{@account_number}/statements?EndDate=#{@end_date}&StartDate=#{@start_date}"
      begin
        response = RestClient.get("#{@base_url}#{@relative_url}",
        "Content-Type": 'application/json',
        "Authorization": "Bearer #{@access_token}",
        "Origin": @domain,
        "X-BCA-Key": @api_key,
        "X-BCA-Timestamp":  @timestamp,
        "X-BCA-Signature": signature)
        elements = JSON.parse response.body
        statements = []

        elements['Data'].each do |element|
          year = Date.parse(@start_date).strftime('%m').to_i.eql?(12) ? Date.parse(@start_date).strftime('%Y') : Date.parse(@end_date).strftime('%Y')
          date = element['TransactionDate'].eql?("PEND") ? element['TransactionDate'] : "#{element['TransactionDate']}/#{year}"
          attribute = {
            date: date,
            brance_code: element['BranchCode'],
            type: element['TransactionType'],
            amount: element['TransactionAmount'].to_f,
            name: element['TransactionName'],
            trailer: element['Trailer']
          }
          statements << BcaStatement::Entities::Statement.new(attribute)
        end
        statements
      rescue RestClient::ExceptionWithResponse => err
        return nil
      end 
    end
Get your BCA Bisnis account statement for a period up to 31 days.