@method @name Exchange#setSandboxMode @description set the sandbox mode for the exchange @param {boolean} enabled true to enable sandbox mode, false to disable it
(Object enabled)
| 4632 | * @param {boolean} enabled true to enable sandbox mode, false to disable it |
| 4633 | */ |
| 4634 | public void setSandboxMode(Object enabled) |
| 4635 | { |
| 4636 | if (Helpers.isTrue(enabled)) |
| 4637 | { |
| 4638 | if (Helpers.isTrue(Helpers.inOp(this.urls, "test"))) |
| 4639 | { |
| 4640 | if (Helpers.isTrue((Helpers.GetValue(this.urls, "api") instanceof String))) |
| 4641 | { |
| 4642 | Helpers.addElementToObject(this.urls, "apiBackup", Helpers.GetValue(this.urls, "api")); |
| 4643 | Helpers.addElementToObject(this.urls, "api", Helpers.GetValue(this.urls, "test")); |
| 4644 | } else |
| 4645 | { |
| 4646 | Helpers.addElementToObject(this.urls, "apiBackup", this.clone(Helpers.GetValue(this.urls, "api"))); |
| 4647 | Helpers.addElementToObject(this.urls, "api", this.clone(Helpers.GetValue(this.urls, "test"))); |
| 4648 | } |
| 4649 | } else |
| 4650 | { |
| 4651 | throw new NotSupported((String)Helpers.add(this.id, " does not have a sandbox URL")) ; |
| 4652 | } |
| 4653 | // set flag |
| 4654 | this.isSandboxModeEnabled = true; |
| 4655 | } else if (Helpers.isTrue(Helpers.inOp(this.urls, "apiBackup"))) |
| 4656 | { |
| 4657 | if (Helpers.isTrue((Helpers.GetValue(this.urls, "api") instanceof String))) |
| 4658 | { |
| 4659 | Helpers.addElementToObject(this.urls, "api", ((Object)Helpers.GetValue(this.urls, "apiBackup"))); |
| 4660 | } else |
| 4661 | { |
| 4662 | Helpers.addElementToObject(this.urls, "api", this.clone(Helpers.GetValue(this.urls, "apiBackup"))); |
| 4663 | } |
| 4664 | Object newUrls = this.omit(this.urls, "apiBackup"); |
| 4665 | this.urls = newUrls; |
| 4666 | // set flag |
| 4667 | this.isSandboxModeEnabled = false; |
| 4668 | } |
| 4669 | } |
| 4670 | |
| 4671 | /** |
| 4672 | * @method |