1
0
mirror of https://github.com/oceanprotocol-archive/squid-js.git synced 2024-02-02 15:31:51 +01:00
squid-js/src/ocean/Order.ts
Sebastian Gerske 61bd56ba54 fixed imports
2018-10-16 15:08:04 +02:00

72 lines
1.5 KiB
TypeScript

import Keeper from "../keeper/Keeper"
import Logger from "../utils/Logger"
import Account from "./Account"
import Asset from "./Asset"
import OceanBase from "./OceanBase"
export default class Order extends OceanBase {
private paid: boolean
private status: number
private accessUrl: string
private accessId: string
constructor(private asset: Asset, private timeout: number,
private pubkey: string, private key: any) {
super()
}
public setAccessUrl(url: string) {
this.accessUrl = url
}
public getAccessUrl() {
return this.accessUrl
}
public setStatus(status: number) {
this.status = status
}
public setAccessId(accessId: string) {
Logger.log("accessId", accessId)
this.accessId = accessId
}
public getStatus() {
return this.status
}
public setPaid(paid: boolean) {
this.paid = paid
}
public getPaid() {
return this.paid
}
public getAsset() {
return this.asset
}
public getPubkey() {
return this.pubkey
}
public getTimeout() {
return this.timeout
}
public getKey() {
return this.key
}
public async pay(account: Account) {
const {market} = await Keeper.getInstance()
// send payment
Logger.log("Sending payment: ", this.getId(), this.accessId,
this.asset.publisher.getId(), this.asset.price, this.timeout)
return market.payOrder(this, account.getId())
}
}