Sha256: a7c0356c70e2e82855539503971e425d214e5e3fd47f5cb70b76eafd2db6d542

Contents?: true

Size: 1.46 KB

Versions: 6

Compression:

Stored size: 1.46 KB

Contents

module StarkitBanking
  module YBL
    module Payment
      class ByIMT
        include ApiClient
      
        private
        
        def service_name
          'IMT TRANSFER'
        end
      
        def invoke(env, req)
          ApiBanking::InstantMoneyTransferService.transfer(env, req)
          # send email
        end
      
        def credentials(payment)
          payment.payment_account.credentials
        end
        
        def response(res)
          Transfer::Status.new('INITIATED', res.initiateTransferResult.bankReferenceNo, 'IMT')
        end
      
        def request(subscription, payment)
          request = ApiBanking::InstantMoneyTransferService::InitiateTransfer::Request.new()

          # every payment is identified by its ID, repeated API attempts can be identified when the ID is used as the URN
          @req_reference = request.uniqueRequestNo = payment.id 
        
          request.appID = subscription.app_id
          request.customerID = payment.payment_account.customer_id
          request.beneficiaryMobileNo = payment.beneficiary_mobile_no
          request.transferAmount = payment.transfer_amount
          request.passCode = payment.imt_passcode
          request.remitterToBeneficiaryInfo = payment.transfer_description
        
          request
        end
      
        def subscription(payment)
          payment.payment_account.service_subscriptions.find_by(service_name: service_name)
        end
      
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
starkit_banking-0.1.9 lib/starkit_banking/api/ybl/payment/imt.rb
starkit_banking-0.1.8 lib/starkit_banking/api/ybl/payment/imt.rb
starkit_banking-0.1.7 lib/starkit_banking/api/ybl/payment/imt.rb
starkit_banking-0.1.6 lib/starkit_banking/api/ybl/payment/imt.rb
starkit_banking-0.1.5 lib/starkit_banking/api/ybl/payment/imt.rb
starkit_banking-0.1.4 lib/starkit_banking/api/ybl/payment/imt.rb